diff options
author | Markus Armbruster <armbru@redhat.com> | 2020-12-11 18:11:36 +0100 |
---|---|---|
committer | Markus Armbruster <armbru@redhat.com> | 2020-12-19 10:38:43 +0100 |
commit | f1cc129df8341ebb6176363d24b57035bb5dabe4 (patch) | |
tree | 2caf54bd9a2894a4c78223f8a9a4e57c209da023 /include | |
parent | 6589f4599151201a61d6b1be8450adb63ae81017 (diff) |
qobject: Use GString instead of QString to accumulate JSON
QString supports modifying its string, but it's quite limited: you can
only append. The remaining callers use it for building an initial
string, never for modifying it later.
Use of GString for building the initial string is actually more
convenient here. Change qobject_to_json() & friends to do that.
Once all such uses are replaced this way, QString can become immutable.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20201211171152.146877-5-armbru@redhat.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/qapi/qmp/qstring.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/include/qapi/qmp/qstring.h b/include/qapi/qmp/qstring.h index e2e356e5e7..ae7698d6c7 100644 --- a/include/qapi/qmp/qstring.h +++ b/include/qapi/qmp/qstring.h @@ -25,6 +25,7 @@ struct QString { QString *qstring_new(void); QString *qstring_from_str(const char *str); QString *qstring_from_substr(const char *str, size_t start, size_t end); +QString *qstring_from_gstring(GString *gstr); size_t qstring_get_length(const QString *qstring); const char *qstring_get_str(const QString *qstring); const char *qstring_get_try_str(const QString *qstring); |