aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libucl/ucl_emitter.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2018-03-21 15:01:31 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2018-03-21 15:03:16 +0000
commit15cc0164347a8397b324709b0ef288bd421f24cc (patch)
tree7d8807117524ff60cf9ca04e3d7dd08a61cb05e4 /contrib/libucl/ucl_emitter.c
parentad66f32f1358d30d28e5d28a61b71349f158027c (diff)
downloadrspamd-15cc0164347a8397b324709b0ef288bd421f24cc.tar.gz
rspamd-15cc0164347a8397b324709b0ef288bd421f24cc.zip
[Feature] Support single quotes in config
Issue: #2080
Diffstat (limited to 'contrib/libucl/ucl_emitter.c')
-rw-r--r--contrib/libucl/ucl_emitter.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/contrib/libucl/ucl_emitter.c b/contrib/libucl/ucl_emitter.c
index a15cd08cf..4f4465dfb 100644
--- a/contrib/libucl/ucl_emitter.c
+++ b/contrib/libucl/ucl_emitter.c
@@ -424,8 +424,16 @@ ucl_emitter_common_elt (struct ucl_emitter_context *ctx,
break;
case UCL_STRING:
ucl_emitter_print_key (print_key, ctx, obj, compact);
- if (ctx->id == UCL_EMIT_CONFIG && ucl_maybe_long_string (obj)) {
- ucl_elt_string_write_multiline (obj->value.sv, obj->len, ctx);
+ if (ctx->id == UCL_EMIT_CONFIG) {
+ if (ucl_maybe_long_string (obj)) {
+ ucl_elt_string_write_multiline (obj->value.sv, obj->len, ctx);
+ } else {
+ if (obj->flags & UCL_OBJECT_SQUOTED) {
+ ucl_elt_string_write_squoted (obj->value.sv, obj->len, ctx);
+ } else {
+ ucl_elt_string_write_json (obj->value.sv, obj->len, ctx);
+ }
+ }
}
else {
ucl_elt_string_write_json (obj->value.sv, obj->len, ctx);