mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-06 09:13:55 -06:00
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>
This commit is contained in:
parent
a92c21591b
commit
46f5ac205a
34 changed files with 244 additions and 268 deletions
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue