diff options
author | Markus Armbruster <armbru@redhat.com> | 2020-12-11 18:11:35 +0100 |
---|---|---|
committer | Markus Armbruster <armbru@redhat.com> | 2020-12-19 10:38:43 +0100 |
commit | 6589f4599151201a61d6b1be8450adb63ae81017 (patch) | |
tree | 2f9cb1fb248871d6672fe788bec6bb5da1339f5c /qobject/qjson.c | |
parent | 20076f4a8c3b275272d0b907f37c126bd91ec1b9 (diff) |
qobject: Make qobject_to_json_pretty() take a pretty argument
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20201211171152.146877-4-armbru@redhat.com>
Diffstat (limited to 'qobject/qjson.c')
-rw-r--r-- | qobject/qjson.c | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/qobject/qjson.c b/qobject/qjson.c index f1f2c69704..523a4ab8de 100644 --- a/qobject/qjson.c +++ b/qobject/qjson.c @@ -149,8 +149,6 @@ QDict *qdict_from_jsonf_nofail(const char *string, ...) return qdict; } -static void to_json(const QObject *obj, QString *str, int pretty, int indent); - static void json_pretty_newline(QString *str, bool pretty, int indent) { int i; @@ -163,7 +161,7 @@ static void json_pretty_newline(QString *str, bool pretty, int indent) } } -static void to_json(const QObject *obj, QString *str, int pretty, int indent) +static void to_json(const QObject *obj, QString *str, bool pretty, int indent) { switch (qobject_type(obj)) { case QTYPE_QNULL: @@ -294,20 +292,16 @@ static void to_json(const QObject *obj, QString *str, int pretty, int indent) } } -QString *qobject_to_json(const QObject *obj) +QString *qobject_to_json_pretty(const QObject *obj, bool pretty) { QString *str = qstring_new(); - to_json(obj, str, 0, 0); + to_json(obj, str, pretty, 0); return str; } -QString *qobject_to_json_pretty(const QObject *obj) +QString *qobject_to_json(const QObject *obj) { - QString *str = qstring_new(); - - to_json(obj, str, 1, 0); - - return str; + return qobject_to_json_pretty(obj, false); } |