提交 4b58554a 编写于 作者: M Max Reitz 提交者: Kevin Wolf

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: NMax Reitz <mreitz@redhat.com>
Reviewed-by: NEric Blake <eblake@redhat.com>
Signed-off-by: NKevin Wolf <kwolf@redhat.com>
上级 f71eaa74
......@@ -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");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册