Commit 4b58554a authored by Max Reitz's avatar Max Reitz Committed by Kevin Wolf
Browse files

qjson: Drop trailing space for pretty formatting



For the pretty formatting, the functions converting QDicts and QLists to
JSON should not print a space after the comma separating objects,
because a newline will emitted immediately afterwards, making the
whitespace superfluous.

Signed-off-by: default avatarMax Reitz <mreitz@redhat.com>
Reviewed-by: default avatarEric Blake <eblake@redhat.com>
Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
parent f71eaa74
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -86,8 +86,9 @@ static void to_json_dict_iter(const char *key, QObject *obj, void *opaque)
    QString *qkey;
    int j;

    if (s->count)
        qstring_append(s->str, ", ");
    if (s->count) {
        qstring_append(s->str, s->pretty ? "," : ", ");
    }

    if (s->pretty) {
        qstring_append(s->str, "\n");
@@ -109,8 +110,9 @@ static void to_json_list_iter(QObject *obj, void *opaque)
    ToJsonIterState *s = opaque;
    int j;

    if (s->count)
        qstring_append(s->str, ", ");
    if (s->count) {
        qstring_append(s->str, s->pretty ? "," : ", ");
    }

    if (s->pretty) {
        qstring_append(s->str, "\n");