diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2021-04-20 11:06:39 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2021-04-20 11:06:39 +0100 |
commit | b552a50d983ebf6eae97b28d21d089ef9d0637bc (patch) | |
tree | 4cd1c65e48b9f0950886bf43bd5be7c6bcb359fc | |
parent | fb47bb327b85364b070435d9df008b8da17a4c7e (diff) | |
download | rspamd-b552a50d983ebf6eae97b28d21d089ef9d0637bc.tar.gz rspamd-b552a50d983ebf6eae97b28d21d089ef9d0637bc.zip |
[Minor] Libucl: Do not expand empty objects on output
-rw-r--r-- | contrib/libucl/ucl_emitter.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/contrib/libucl/ucl_emitter.c b/contrib/libucl/ucl_emitter.c index 687e6cdae..777093aca 100644 --- a/contrib/libucl/ucl_emitter.c +++ b/contrib/libucl/ucl_emitter.c @@ -197,7 +197,7 @@ ucl_emitter_common_end_object (struct ucl_emitter_context *ctx, if (UCL_EMIT_IDENT_TOP_OBJ(ctx, obj)) { ctx->indent --; - if (compact) { + if (compact || obj->len == 0) { func->ucl_emitter_append_character ('}', 1, func->ud); } else { @@ -225,7 +225,7 @@ ucl_emitter_common_end_array (struct ucl_emitter_context *ctx, const struct ucl_emitter_functions *func = ctx->func; ctx->indent --; - if (compact) { + if (compact || obj->len == 0) { func->ucl_emitter_append_character (']', 1, func->ud); } else { @@ -257,7 +257,7 @@ ucl_emitter_common_start_array (struct ucl_emitter_context *ctx, ucl_emitter_print_key (print_key, ctx, obj, compact); - if (compact) { + if (compact || obj->len == 0) { func->ucl_emitter_append_character ('[', 1, func->ud); } else { @@ -282,8 +282,6 @@ ucl_emitter_common_start_array (struct ucl_emitter_context *ctx, cur = cur->next; } } - - } /** @@ -307,7 +305,7 @@ ucl_emitter_common_start_object (struct ucl_emitter_context *ctx, * <ident_level + 1><object content> */ if (UCL_EMIT_IDENT_TOP_OBJ(ctx, obj)) { - if (compact) { + if (compact || obj->len == 0) { func->ucl_emitter_append_character ('{', 1, func->ud); } else { |