From: Vsevolod Stakhov Date: Tue, 20 Apr 2021 10:06:39 +0000 (+0100) Subject: [Minor] Libucl: Do not expand empty objects on output X-Git-Tag: 3.0~477 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b552a50d983ebf6eae97b28d21d089ef9d0637bc;p=thirdparty%2Frspamd.git [Minor] Libucl: Do not expand empty objects on output --- diff --git a/contrib/libucl/ucl_emitter.c b/contrib/libucl/ucl_emitter.c index 687e6cdae0..777093aca7 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, * */ if (UCL_EMIT_IDENT_TOP_OBJ(ctx, obj)) { - if (compact) { + if (compact || obj->len == 0) { func->ucl_emitter_append_character ('{', 1, func->ud); } else {