json-builder: avoid indent on the first item

Avoids putting a \n or (now also) space as the first item.
This commit is contained in:
Wim Taymans 2026-02-26 11:17:17 +01:00
parent bdbb5f6d27
commit 03662b3dfe

View file

@ -184,7 +184,7 @@ void spa_json_builder_add_simple(struct spa_json_builder *b, const char *key, in
break;
}
fprintf(b->f, "%s%s%*s", b->delim, indent ? b->count == 0 ? "" : "\n" : space ? " " : "",
fprintf(b->f, "%s%s%*s", b->delim, b->count == 0 ? "" : indent ? "\n" : space ? " " : "",
indent ? b->level : 0, "");
if (key) {
bool key_raw = force_raw || (simple && spa_json_make_simple_string(&key, &key_len)) ||