Browse Source

[Minor] Libucl: Do not expand empty objects on output

tags/3.0
Vsevolod Stakhov 3 years ago
parent
commit
b552a50d98
1 changed files with 4 additions and 6 deletions
  1. 4
    6
      contrib/libucl/ucl_emitter.c

+ 4
- 6
contrib/libucl/ucl_emitter.c View File

@@ -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 {

Loading…
Cancel
Save