aboutsummaryrefslogtreecommitdiff
path: root/tests/device-introspect-test.c
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2018-04-19 17:01:43 +0200
committerMarkus Armbruster <armbru@redhat.com>2018-05-04 08:27:53 +0200
commitcb3e7f08aeaab0ab13e629ce8496dca150a449ba (patch)
tree189830b93bea625aac19f86f26dc4b04cd99f5a3 /tests/device-introspect-test.c
parent3d3eacaeccaab718ea0e2ddaa578bfae9e311c59 (diff)
qobject: Replace qobject_incref/QINCREF qobject_decref/QDECREF
Now that we can safely call QOBJECT() on QObject * as well as its subtypes, we can have macros qobject_ref() / qobject_unref() that work everywhere instead of having to use QINCREF() / QDECREF() for QObject and qobject_incref() / qobject_decref() for its subtypes. The replacement is mechanical, except I broke a long line, and added a cast in monitor_qmp_cleanup_req_queue_locked(). Unlike qobject_decref(), qobject_unref() doesn't accept void *. Note that the new macros evaluate their argument exactly once, thus no need to shout them. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-Id: <20180419150145.24795-4-marcandre.lureau@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> [Rebased, semantic conflict resolved, commit message improved] Signed-off-by: Markus Armbruster <armbru@redhat.com>
Diffstat (limited to 'tests/device-introspect-test.c')
-rw-r--r--tests/device-introspect-test.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/tests/device-introspect-test.c b/tests/device-introspect-test.c
index a01321aced..0b4f221c29 100644
--- a/tests/device-introspect-test.c
+++ b/tests/device-introspect-test.c
@@ -40,8 +40,8 @@ static QList *qom_list_types(const char *implements, bool abstract)
" 'arguments': %p }", args);
g_assert(qdict_haskey(resp, "return"));
ret = qdict_get_qlist(resp, "return");
- QINCREF(ret);
- QDECREF(resp);
+ qobject_ref(ret);
+ qobject_unref(resp);
return ret;
}
@@ -54,7 +54,7 @@ static QDict *qom_type_index(QList *types)
QLIST_FOREACH_ENTRY(types, e) {
QDict *d = qobject_to(QDict, qlist_entry_obj(e));
const char *name = qdict_get_str(d, "name");
- QINCREF(d);
+ qobject_ref(d);
qdict_put(index, name, d);
}
return index;
@@ -108,7 +108,7 @@ static void test_one_device(const char *type)
resp = qmp("{'execute': 'device-list-properties',"
" 'arguments': {'typename': %s}}",
type);
- QDECREF(resp);
+ qobject_unref(resp);
help = hmp("device_add \"%s,help\"", type);
g_free(help);
@@ -129,7 +129,7 @@ static void test_device_intro_list(void)
qtest_start(common_args);
types = device_type_list(true);
- QDECREF(types);
+ qobject_unref(types);
help = hmp("device_add help");
g_free(help);
@@ -157,8 +157,8 @@ static void test_qom_list_parents(const char *parent)
g_assert(qom_has_parent(index, name, parent));
}
- QDECREF(types);
- QDECREF(index);
+ qobject_unref(types);
+ qobject_unref(index);
}
static void test_qom_list_fields(void)
@@ -187,8 +187,8 @@ static void test_qom_list_fields(void)
test_qom_list_parents("device");
test_qom_list_parents("sys-bus-device");
- QDECREF(all_types);
- QDECREF(non_abstract);
+ qobject_unref(all_types);
+ qobject_unref(non_abstract);
qtest_end();
}
@@ -222,7 +222,7 @@ static void test_device_intro_concrete(void)
test_one_device(type);
}
- QDECREF(types);
+ qobject_unref(types);
qtest_end();
}
@@ -255,8 +255,8 @@ static void test_abstract_interfaces(void)
g_assert(qdict_haskey(d, "abstract") && qdict_get_bool(d, "abstract"));
}
- QDECREF(all_types);
- QDECREF(index);
+ qobject_unref(all_types);
+ qobject_unref(index);
qtest_end();
}