xemu/qobject
Markus Armbruster 998da0b158 qobject: Factor JSON writer out of qobject_to_json()
We have two JSON writers written in C: qobject/qjson.c provides
qobject_to_json(), and migration/qjson.c provides a more low level
imperative interface.  They don't share code.  The latter tacitly
limits numbers to int64_t, and strings contents to characters that
don't need escaping.

Factor out qobject_to_json()'s JSON writer as qobject/json-writer.c.
Straightforward, except for numbers: since the writer is to be
independent of QObject, it can't use qnum_to_string().  Open-code it
instead.  This is actually an improvement of sorts, because it
liberates qnum_to_string() from JSON's needs: its JSON-related FIXMEs
move to the JSON writer, where they belong.

The next commit will replace migration/qjson.c.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20201211171152.146877-16-armbru@redhat.com>
2020-12-19 10:39:16 +01:00
..
block-qdict.c qobject: Catch another straggler for use of qdict_put_str() 2018-10-26 17:17:32 +02:00
json-lexer.c json: Fix off-by-one assert check in next_state() 2019-03-26 08:10:11 +01:00
json-parser-int.h json: Eliminate lexer state IN_WHITESPACE, pseudo-token JSON_SKIP 2018-09-24 18:08:07 +02:00
json-parser.c json: Fix a memleak in parse_pair() 2020-11-17 15:39:53 +01:00
json-streamer.c json: Fix check for unbalanced right curly brace 2020-04-07 13:10:11 +02:00
json-writer.c qobject: Factor JSON writer out of qobject_to_json() 2020-12-19 10:39:16 +01:00
meson.build qobject: Factor JSON writer out of qobject_to_json() 2020-12-19 10:39:16 +01:00
qbool.c qobject: Move internals to qobject-internal.h 2020-12-19 10:38:43 +01:00
qdict.c qobject: Move internals to qobject-internal.h 2020-12-19 10:38:43 +01:00
qjson.c qobject: Factor JSON writer out of qobject_to_json() 2020-12-19 10:39:16 +01:00
qlist.c qobject: Move internals to qobject-internal.h 2020-12-19 10:38:43 +01:00
qlit.c qapi: Replace qobject_to_X(o) by qobject_to(X, o) 2018-03-19 14:58:36 -05:00
qnull.c qobject: Move internals to qobject-internal.h 2020-12-19 10:38:43 +01:00
qnum.c qobject: Factor JSON writer out of qobject_to_json() 2020-12-19 10:39:16 +01:00
qobject-internal.h qobject: Move internals to qobject-internal.h 2020-12-19 10:38:43 +01:00
qobject.c qobject: Move internals to qobject-internal.h 2020-12-19 10:38:43 +01:00
qstring.c qobject: Drop qstring_get_try_str() 2020-12-19 10:39:16 +01:00