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-event.c | |
parent | a92c21591b5bb9543996538f14854ca6b528318b (diff) |
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-event.c')
-rw-r--r-- | tests/test-qmp-event.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/tests/test-qmp-event.c b/tests/test-qmp-event.c index 7bb621b027..4c0f09601d 100644 --- a/tests/test-qmp-event.c +++ b/tests/test-qmp-event.c @@ -153,7 +153,7 @@ static void test_event_a(TestEventData *data, { QDict *d; d = data->expect; - qdict_put(d, "event", qstring_from_str("EVENT_A")); + qdict_put_str(d, "event", "EVENT_A"); qapi_event_send_event_a(&error_abort); } @@ -162,7 +162,7 @@ static void test_event_b(TestEventData *data, { QDict *d; d = data->expect; - qdict_put(d, "event", qstring_from_str("EVENT_B")); + qdict_put_str(d, "event", "EVENT_B"); qapi_event_send_event_b(&error_abort); } @@ -177,16 +177,16 @@ static void test_event_c(TestEventData *data, b.has_enum1 = false; d_b = qdict_new(); - qdict_put(d_b, "integer", qint_from_int(2)); - qdict_put(d_b, "string", qstring_from_str("test1")); + qdict_put_int(d_b, "integer", 2); + qdict_put_str(d_b, "string", "test1"); d_data = qdict_new(); - qdict_put(d_data, "a", qint_from_int(1)); + qdict_put_int(d_data, "a", 1); qdict_put(d_data, "b", d_b); - qdict_put(d_data, "c", qstring_from_str("test2")); + qdict_put_str(d_data, "c", "test2"); d = data->expect; - qdict_put(d, "event", qstring_from_str("EVENT_C")); + qdict_put_str(d, "event", "EVENT_C"); qdict_put(d, "data", d_data); qapi_event_send_event_c(true, 1, true, &b, "test2", &error_abort); @@ -213,22 +213,22 @@ static void test_event_d(TestEventData *data, a.enum2 = ENUM_ONE_VALUE2; d_struct1 = qdict_new(); - qdict_put(d_struct1, "integer", qint_from_int(2)); - qdict_put(d_struct1, "string", qstring_from_str("test1")); - qdict_put(d_struct1, "enum1", qstring_from_str("value1")); + qdict_put_int(d_struct1, "integer", 2); + qdict_put_str(d_struct1, "string", "test1"); + qdict_put_str(d_struct1, "enum1", "value1"); d_a = qdict_new(); qdict_put(d_a, "struct1", d_struct1); - qdict_put(d_a, "string", qstring_from_str("test2")); - qdict_put(d_a, "enum2", qstring_from_str("value2")); + qdict_put_str(d_a, "string", "test2"); + qdict_put_str(d_a, "enum2", "value2"); d_data = qdict_new(); qdict_put(d_data, "a", d_a); - qdict_put(d_data, "b", qstring_from_str("test3")); - qdict_put(d_data, "enum3", qstring_from_str("value3")); + qdict_put_str(d_data, "b", "test3"); + qdict_put_str(d_data, "enum3", "value3"); d = data->expect; - qdict_put(d, "event", qstring_from_str("EVENT_D")); + qdict_put_str(d, "event", "EVENT_D"); qdict_put(d, "data", d_data); qapi_event_send_event_d(&a, "test3", false, NULL, true, ENUM_ONE_VALUE3, |