From cb3e7f08aeaab0ab13e629ce8496dca150a449ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Thu, 19 Apr 2018 17:01:43 +0200 Subject: qobject: Replace qobject_incref/QINCREF qobject_decref/QDECREF MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Eric Blake Message-Id: <20180419150145.24795-4-marcandre.lureau@redhat.com> Reviewed-by: Markus Armbruster [Rebased, semantic conflict resolved, commit message improved] Signed-off-by: Markus Armbruster --- tests/test-x86-cpuid-compat.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'tests/test-x86-cpuid-compat.c') 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); } -- cgit v1.2.3