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/check-qstring.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/check-qstring.c')
-rw-r--r-- | tests/check-qstring.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/tests/check-qstring.c b/tests/check-qstring.c index 9c4dd3f94f..f11a7a8605 100644 --- a/tests/check-qstring.c +++ b/tests/check-qstring.c @@ -31,7 +31,7 @@ static void qstring_from_str_test(void) g_assert(strcmp(str, qstring->string) == 0); g_assert(qobject_type(QOBJECT(qstring)) == QTYPE_QSTRING); - QDECREF(qstring); + qobject_unref(qstring); } static void qstring_get_str_test(void) @@ -44,7 +44,7 @@ static void qstring_get_str_test(void) ret_str = qstring_get_str(qstring); g_assert(strcmp(ret_str, str) == 0); - QDECREF(qstring); + qobject_unref(qstring); } static void qstring_append_chr_test(void) @@ -59,7 +59,7 @@ static void qstring_append_chr_test(void) qstring_append_chr(qstring, str[i]); g_assert(strcmp(str, qstring_get_str(qstring)) == 0); - QDECREF(qstring); + qobject_unref(qstring); } static void qstring_from_substr_test(void) @@ -70,7 +70,7 @@ static void qstring_from_substr_test(void) g_assert(qs != NULL); g_assert(strcmp(qstring_get_str(qs), "tualiza") == 0); - QDECREF(qs); + qobject_unref(qs); } @@ -81,7 +81,7 @@ static void qobject_to_qstring_test(void) qstring = qstring_from_str("foo"); g_assert(qobject_to(QString, QOBJECT(qstring)) == qstring); - QDECREF(qstring); + qobject_unref(qstring); } int main(int argc, char **argv) |