1841f011 | 28-Dec-2020 |
Zhang Han <zhanghan64@huawei.com> |
qobject: braces {} are necessary for all arms of this statement
Add braces {} for arms of if/for statement
Signed-off-by: Zhang Han <zhanghan64@huawei.com> Message-Id: <20201228071129.24563-5-zhang
qobject: braces {} are necessary for all arms of this statement
Add braces {} for arms of if/for statement
Signed-off-by: Zhang Han <zhanghan64@huawei.com> Message-Id: <20201228071129.24563-5-zhanghan64@huawei.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
show more ...
|
f3d71c6e | 28-Dec-2020 |
Zhang Han <zhanghan64@huawei.com> |
qobject: spaces required around that operators
Add spaces around operators.
Signed-off-by: Zhang Han <zhanghan64@huawei.com> Message-Id: <20201228071129.24563-4-zhanghan64@huawei.com> Reviewed-by:
qobject: spaces required around that operators
Add spaces around operators.
Signed-off-by: Zhang Han <zhanghan64@huawei.com> Message-Id: <20201228071129.24563-4-zhanghan64@huawei.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
show more ...
|
be08fb18 | 28-Dec-2020 |
Zhang Han <zhanghan64@huawei.com> |
qobject: code indent should never use tabs
Transfer tabs to spaces.
Signed-off-by: Zhang Han <zhanghan64@huawei.com> Message-Id: <20201228071129.24563-3-zhanghan64@huawei.com> Reviewed-by: Markus A
qobject: code indent should never use tabs
Transfer tabs to spaces.
Signed-off-by: Zhang Han <zhanghan64@huawei.com> Message-Id: <20201228071129.24563-3-zhanghan64@huawei.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
show more ...
|
4ac76ba4 | 11-Dec-2020 |
Markus Armbruster <armbru@redhat.com> |
qobject: Make QString immutable
The functions to modify a QString's string are all unused now. Drop them, and make the string immutable. Saves 16 bytes per QString on my system.
Signed-off-by: Ma
qobject: Make QString immutable
The functions to modify a QString's string are all unused now. Drop them, and make the string immutable. Saves 16 bytes per QString on my system.
Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20201211171152.146877-21-armbru@redhat.com>
show more ...
|
998da0b1 | 11-Dec-2020 |
Markus Armbruster <armbru@redhat.com> |
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 int
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>
show more ...
|
b3119b08 | 11-Dec-2020 |
Markus Armbruster <armbru@redhat.com> |
qobject: Drop qstring_get_try_str()
No users left outside tests/, and the ones in tests/ can just as well use qstring_get_str(). Do that, and drop the function.
Signed-off-by: Markus Armbruster <a
qobject: Drop qstring_get_try_str()
No users left outside tests/, and the ones in tests/ can just as well use qstring_get_str(). Do that, and drop the function.
Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20201211171152.146877-14-armbru@redhat.com>
show more ...
|
88e25b1e | 11-Dec-2020 |
Markus Armbruster <armbru@redhat.com> |
Revert "qstring: add qstring_free()"
This reverts commit 164c374b75f87c6765a705c4418ab7005a2d356f.
A free function for a reference-counted object is in bad taste. Fortunately, this one is now also
Revert "qstring: add qstring_free()"
This reverts commit 164c374b75f87c6765a705c4418ab7005a2d356f.
A free function for a reference-counted object is in bad taste. Fortunately, this one is now also unused. Drop it.
Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20201211171152.146877-7-armbru@redhat.com>
show more ...
|
eab3a467 | 11-Dec-2020 |
Markus Armbruster <armbru@redhat.com> |
qobject: Change qobject_to_json()'s value to GString
qobject_to_json() and qobject_to_json_pretty() build a GString, then covert it to QString. Just one of the callers actually needs a QString: qem
qobject: Change qobject_to_json()'s value to GString
qobject_to_json() and qobject_to_json_pretty() build a GString, then covert it to QString. Just one of the callers actually needs a QString: qemu_rbd_parse_filename(). A few others need a string they can modify: qmp_send_response(), qga's send_response(), to_json_str(), and qmp_fd_vsend_fds(). The remainder just need a string.
Change qobject_to_json() and qobject_to_json_pretty() to return the GString.
qemu_rbd_parse_filename() now has to convert to QString. All others save a QString temporary. to_json_str() actually becomes a bit simpler, because GString provides more convenient modification functions.
Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20201211171152.146877-6-armbru@redhat.com>
show more ...
|
f1cc129d | 11-Dec-2020 |
Markus Armbruster <armbru@redhat.com> |
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 s
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>
show more ...
|
7b1cd1c6 | 15-Apr-2020 |
Markus Armbruster <armbru@redhat.com> |
qobject: Eliminate qdict_iter(), use qdict_first(), qdict_next()
qdict_iter() has just three uses and no test coverage. Replace by qdict_first(), qdict_next() for more concise code and less type pu
qobject: Eliminate qdict_iter(), use qdict_first(), qdict_next()
qdict_iter() has just three uses and no test coverage. Replace by qdict_first(), qdict_next() for more concise code and less type punning.
Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20200415083048.14339-5-armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
show more ...
|
2f2ec111 | 15-Apr-2020 |
Markus Armbruster <armbru@redhat.com> |
qobject: Eliminate qlist_iter(), use QLIST_FOREACH_ENTRY() instead
qlist_iter() has just three uses outside tests/. Replace by QLIST_FOREACH_ENTRY() for more concise code and less type punning.
Si
qobject: Eliminate qlist_iter(), use QLIST_FOREACH_ENTRY() instead
qlist_iter() has just three uses outside tests/. Replace by QLIST_FOREACH_ENTRY() for more concise code and less type punning.
Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20200415083048.14339-4-armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
show more ...
|