diff options
author | Marc-André Lureau <marcandre.lureau@redhat.com> | 2018-04-19 17:01:43 +0200 |
---|---|---|
committer | Markus Armbruster <armbru@redhat.com> | 2018-05-04 08:27:53 +0200 |
commit | cb3e7f08aeaab0ab13e629ce8496dca150a449ba (patch) | |
tree | 189830b93bea625aac19f86f26dc4b04cd99f5a3 /tests/test-x86-cpuid-compat.c | |
parent | 3d3eacaeccaab718ea0e2ddaa578bfae9e311c59 (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/test-x86-cpuid-compat.c')
-rw-r--r-- | tests/test-x86-cpuid-compat.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/tests/test-x86-cpuid-compat.c b/tests/test-x86-cpuid-compat.c index 02e41843fc..84ce9c71ae 100644 --- a/tests/test-x86-cpuid-compat.c +++ b/tests/test-x86-cpuid-compat.c @@ -19,7 +19,7 @@ static char *get_cpu0_qom_path(void) cpu0 = qobject_to(QDict, qlist_peek(ret)); path = g_strdup(qdict_get_str(cpu0, "qom_path")); - QDECREF(resp); + qobject_unref(resp); return path; } @@ -30,8 +30,8 @@ static QObject *qom_get(const char *path, const char *prop) " 'property': %s } }", path, prop); QObject *ret = qdict_get(resp, "return"); - qobject_incref(ret); - QDECREF(resp); + qobject_ref(ret); + qobject_unref(resp); return ret; } @@ -41,7 +41,7 @@ static bool qom_get_bool(const char *path, const char *prop) QBool *value = qobject_to(QBool, qom_get(path, prop)); bool b = qbool_get_bool(value); - QDECREF(value); + qobject_unref(value); return b; } #endif @@ -66,7 +66,7 @@ static void test_cpuid_prop(const void *data) g_assert_cmpint(val, ==, args->expected_value); qtest_end(); - QDECREF(value); + qobject_unref(value); g_free(path); } @@ -142,8 +142,8 @@ static void test_feature_flag(const void *data) g_assert(!!(value & (1U << args->bitnr)) == args->expected_value); - QDECREF(present); - QDECREF(filtered); + qobject_unref(present); + qobject_unref(filtered); g_free(path); } |