diff options
author | Eric Blake <eblake@redhat.com> | 2017-04-27 16:58:17 -0500 |
---|---|---|
committer | Markus Armbruster <armbru@redhat.com> | 2017-05-09 09:13:51 +0200 |
commit | 46f5ac205a9dc5e2c24274c7df371509a286281f (patch) | |
tree | 52cd3eab32f34963a5275f6f291386d4ad8b6624 /tests/test-qmp-commands.c | |
parent | a92c21591b5bb9543996538f14854ca6b528318b (diff) | |
download | qemu-46f5ac205a9dc5e2c24274c7df371509a286281f.zip qemu-46f5ac205a9dc5e2c24274c7df371509a286281f.tar.gz qemu-46f5ac205a9dc5e2c24274c7df371509a286281f.tar.bz2 |
qobject: Use simpler QDict/QList scalar insertion macros
We now have macros in place to make it less verbose to add a scalar
to QDict and QList, so use them.
Patch created mechanically via:
spatch --sp-file scripts/coccinelle/qobject.cocci \
--macro-file scripts/cocci-macro-file.h --dir . --in-place
then touched up manually to fix a couple of '?:' back to original
spacing, as well as avoiding a long line in monitor.c.
Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20170427215821.19397-7-eblake@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Diffstat (limited to 'tests/test-qmp-commands.c')
-rw-r--r-- | tests/test-qmp-commands.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/tests/test-qmp-commands.c b/tests/test-qmp-commands.c index ac3fd03..acdded4 100644 --- a/tests/test-qmp-commands.c +++ b/tests/test-qmp-commands.c @@ -94,7 +94,7 @@ static void test_dispatch_cmd(void) QDict *req = qdict_new(); QObject *resp; - qdict_put(req, "execute", qstring_from_str("user_def_cmd")); + qdict_put_str(req, "execute", "user_def_cmd"); resp = qmp_dispatch(&qmp_commands, QOBJECT(req)); assert(resp != NULL); @@ -111,7 +111,7 @@ static void test_dispatch_cmd_failure(void) QDict *args = qdict_new(); QObject *resp; - qdict_put(req, "execute", qstring_from_str("user_def_cmd2")); + qdict_put_str(req, "execute", "user_def_cmd2"); resp = qmp_dispatch(&qmp_commands, QOBJECT(req)); assert(resp != NULL); @@ -122,10 +122,10 @@ static void test_dispatch_cmd_failure(void) /* check that with extra arguments it throws an error */ req = qdict_new(); - qdict_put(args, "a", qint_from_int(66)); + qdict_put_int(args, "a", 66); qdict_put(req, "arguments", args); - qdict_put(req, "execute", qstring_from_str("user_def_cmd")); + qdict_put_str(req, "execute", "user_def_cmd"); resp = qmp_dispatch(&qmp_commands, QOBJECT(req)); assert(resp != NULL); @@ -164,14 +164,14 @@ static void test_dispatch_cmd_io(void) QDict *ret_dict_dict2, *ret_dict_dict2_userdef; QInt *ret3; - qdict_put(ud1a, "integer", qint_from_int(42)); - qdict_put(ud1a, "string", qstring_from_str("hello")); - qdict_put(ud1b, "integer", qint_from_int(422)); - qdict_put(ud1b, "string", qstring_from_str("hello2")); + qdict_put_int(ud1a, "integer", 42); + qdict_put_str(ud1a, "string", "hello"); + qdict_put_int(ud1b, "integer", 422); + qdict_put_str(ud1b, "string", "hello2"); qdict_put(args, "ud1a", ud1a); qdict_put(args, "ud1b", ud1b); qdict_put(req, "arguments", args); - qdict_put(req, "execute", qstring_from_str("user_def_cmd2")); + qdict_put_str(req, "execute", "user_def_cmd2"); ret = qobject_to_qdict(test_qmp_dispatch(req)); @@ -190,9 +190,9 @@ static void test_dispatch_cmd_io(void) assert(!strcmp(qdict_get_str(ret_dict_dict2, "string"), "blah4")); QDECREF(ret); - qdict_put(args3, "a", qint_from_int(66)); + qdict_put_int(args3, "a", 66); qdict_put(req, "arguments", args3); - qdict_put(req, "execute", qstring_from_str("guest-get-time")); + qdict_put_str(req, "execute", "guest-get-time"); ret3 = qobject_to_qint(test_qmp_dispatch(req)); assert(qint_get_int(ret3) == 66); @@ -244,7 +244,7 @@ static void test_dealloc_partial(void) Visitor *v; ud2_dict = qdict_new(); - qdict_put(ud2_dict, "string0", qstring_from_str(text)); + qdict_put_str(ud2_dict, "string0", text); v = qobject_input_visitor_new(QOBJECT(ud2_dict)); visit_type_UserDefTwo(v, NULL, &ud2, &err); |