aboutsummaryrefslogtreecommitdiff
path: root/tests/check-qdict.c
diff options
context:
space:
mode:
authorEric Blake <eblake@redhat.com>2017-04-27 16:58:15 -0500
committerMarkus Armbruster <armbru@redhat.com>2017-05-08 20:32:14 +0200
commitde6e7951fe66053dfeaac1a237f7aceb9e079619 (patch)
treeced0a9dc4f2798e16b0f773318de92683c39fdb6 /tests/check-qdict.c
parenta2f3453ebc64b1ebe094aeaf83f9e67896f90ac3 (diff)
downloadqemu-de6e7951fe66053dfeaac1a237f7aceb9e079619.zip
qemu-de6e7951fe66053dfeaac1a237f7aceb9e079619.tar.gz
qemu-de6e7951fe66053dfeaac1a237f7aceb9e079619.tar.bz2
qobject: Drop useless QObject casts
We have macros in place to make it less verbose to add a subtype of QObject to both QDict and QList. While we have made cleanups like this in the past (see commit fcfcd8ffc, for example), having it be automated by Coccinelle makes it easier to maintain. Patch created mechanically via: spatch --sp-file scripts/coccinelle/qobject.cocci \ --macro-file scripts/cocci-macro-file.h --dir . --in-place then I verified that no manual touchups were required. Signed-off-by: Eric Blake <eblake@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Alberto Garcia <berto@igalia.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20170427215821.19397-5-eblake@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
Diffstat (limited to 'tests/check-qdict.c')
-rw-r--r--tests/check-qdict.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/tests/check-qdict.c b/tests/check-qdict.c
index 6f3fbcf..3cb72fb 100644
--- a/tests/check-qdict.c
+++ b/tests/check-qdict.c
@@ -47,7 +47,7 @@ static void qdict_put_obj_test(void)
qdict = qdict_new();
// key "" will have tdb hash 12345
- qdict_put_obj(qdict, "", QOBJECT(qint_from_int(num)));
+ qdict_put(qdict, "", qint_from_int(num));
g_assert(qdict_size(qdict) == 1);
ent = QLIST_FIRST(&qdict->table[12345 % QDICT_BUCKET_MAX]);
@@ -66,8 +66,8 @@ static void qdict_destroy_simple_test(void)
QDict *qdict;
qdict = qdict_new();
- qdict_put_obj(qdict, "num", QOBJECT(qint_from_int(0)));
- qdict_put_obj(qdict, "str", QOBJECT(qstring_from_str("foo")));
+ qdict_put(qdict, "num", qint_from_int(0));
+ qdict_put(qdict, "str", qstring_from_str("foo"));
QDECREF(qdict);
}
@@ -297,16 +297,16 @@ static void qdict_flatten_test(void)
qdict_put(dict1, "a", qint_from_int(0));
qdict_put(dict1, "b", qint_from_int(1));
- qlist_append_obj(list1, QOBJECT(qint_from_int(23)));
- qlist_append_obj(list1, QOBJECT(qint_from_int(66)));
- qlist_append_obj(list1, QOBJECT(dict1));
- qlist_append_obj(list2, QOBJECT(qint_from_int(42)));
- qlist_append_obj(list2, QOBJECT(list1));
+ qlist_append(list1, qint_from_int(23));
+ qlist_append(list1, qint_from_int(66));
+ qlist_append(list1, dict1);
+ qlist_append(list2, qint_from_int(42));
+ qlist_append(list2, list1);
qdict_put(dict2, "c", qint_from_int(2));
qdict_put(dict2, "d", qint_from_int(3));
- qdict_put_obj(dict3, "e", QOBJECT(list2));
- qdict_put_obj(dict3, "f", QOBJECT(dict2));
+ qdict_put(dict3, "e", list2);
+ qdict_put(dict3, "f", dict2);
qdict_put(dict3, "g", qint_from_int(4));
qdict_flatten(dict3);