summaryrefslogtreecommitdiff
path: root/tests/wdt_ib700-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/wdt_ib700-test.c
parent3d3eacaeccaab718ea0e2ddaa578bfae9e311c59 (diff)
downloadqemu-cb3e7f08aeaab0ab13e629ce8496dca150a449ba.tar.gz
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/wdt_ib700-test.c')
-rw-r--r--tests/wdt_ib700-test.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/tests/wdt_ib700-test.c b/tests/wdt_ib700-test.c
index 3b5bbcf007..797288d939 100644
--- a/tests/wdt_ib700-test.c
+++ b/tests/wdt_ib700-test.c
@@ -16,7 +16,7 @@ static void qmp_check_no_event(QTestState *s)
{
QDict *resp = qtest_qmp(s, "{'execute':'query-status'}");
g_assert(qdict_haskey(resp, "return"));
- QDECREF(resp);
+ qobject_unref(resp);
}
static QDict *ib700_program_and_wait(QTestState *s)
@@ -48,8 +48,8 @@ static QDict *ib700_program_and_wait(QTestState *s)
qtest_clock_step(s, 2 * NANOSECONDS_PER_SECOND);
event = qtest_qmp_eventwait_ref(s, "WATCHDOG");
data = qdict_get_qdict(event, "data");
- QINCREF(data);
- QDECREF(event);
+ qobject_ref(data);
+ qobject_unref(event);
return data;
}
@@ -62,7 +62,7 @@ static void ib700_pause(void)
qtest_irq_intercept_in(s, "ioapic");
d = ib700_program_and_wait(s);
g_assert(!strcmp(qdict_get_str(d, "action"), "pause"));
- QDECREF(d);
+ qobject_unref(d);
qtest_qmp_eventwait(s, "STOP");
qtest_quit(s);
}
@@ -75,7 +75,7 @@ static void ib700_reset(void)
qtest_irq_intercept_in(s, "ioapic");
d = ib700_program_and_wait(s);
g_assert(!strcmp(qdict_get_str(d, "action"), "reset"));
- QDECREF(d);
+ qobject_unref(d);
qtest_qmp_eventwait(s, "RESET");
qtest_quit(s);
}
@@ -89,7 +89,7 @@ static void ib700_shutdown(void)
qtest_irq_intercept_in(s, "ioapic");
d = ib700_program_and_wait(s);
g_assert(!strcmp(qdict_get_str(d, "action"), "reset"));
- QDECREF(d);
+ qobject_unref(d);
qtest_qmp_eventwait(s, "SHUTDOWN");
qtest_quit(s);
}
@@ -102,7 +102,7 @@ static void ib700_none(void)
qtest_irq_intercept_in(s, "ioapic");
d = ib700_program_and_wait(s);
g_assert(!strcmp(qdict_get_str(d, "action"), "none"));
- QDECREF(d);
+ qobject_unref(d);
qtest_quit(s);
}