mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 15:23:53 -06:00
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>
This commit is contained in:
parent
3d3eacaecc
commit
cb3e7f08ae
94 changed files with 609 additions and 613 deletions
|
@ -29,7 +29,7 @@ static void add_one_netfilter(void)
|
|||
|
||||
g_assert(response);
|
||||
g_assert(!qdict_haskey(response, "error"));
|
||||
QDECREF(response);
|
||||
qobject_unref(response);
|
||||
|
||||
response = qmp("{'execute': 'object-del',"
|
||||
" 'arguments': {"
|
||||
|
@ -37,7 +37,7 @@ static void add_one_netfilter(void)
|
|||
"}}");
|
||||
g_assert(response);
|
||||
g_assert(!qdict_haskey(response, "error"));
|
||||
QDECREF(response);
|
||||
qobject_unref(response);
|
||||
}
|
||||
|
||||
/* add a netfilter to a netdev and then remove the netdev */
|
||||
|
@ -57,7 +57,7 @@ static void remove_netdev_with_one_netfilter(void)
|
|||
|
||||
g_assert(response);
|
||||
g_assert(!qdict_haskey(response, "error"));
|
||||
QDECREF(response);
|
||||
qobject_unref(response);
|
||||
|
||||
response = qmp("{'execute': 'netdev_del',"
|
||||
" 'arguments': {"
|
||||
|
@ -65,7 +65,7 @@ static void remove_netdev_with_one_netfilter(void)
|
|||
"}}");
|
||||
g_assert(response);
|
||||
g_assert(!qdict_haskey(response, "error"));
|
||||
QDECREF(response);
|
||||
qobject_unref(response);
|
||||
|
||||
/* add back the netdev */
|
||||
response = qmp("{'execute': 'netdev_add',"
|
||||
|
@ -75,7 +75,7 @@ static void remove_netdev_with_one_netfilter(void)
|
|||
"}}");
|
||||
g_assert(response);
|
||||
g_assert(!qdict_haskey(response, "error"));
|
||||
QDECREF(response);
|
||||
qobject_unref(response);
|
||||
}
|
||||
|
||||
/* add multi(2) netfilters to a netdev and then remove them */
|
||||
|
@ -95,7 +95,7 @@ static void add_multi_netfilter(void)
|
|||
|
||||
g_assert(response);
|
||||
g_assert(!qdict_haskey(response, "error"));
|
||||
QDECREF(response);
|
||||
qobject_unref(response);
|
||||
|
||||
response = qmp("{'execute': 'object-add',"
|
||||
" 'arguments': {"
|
||||
|
@ -109,7 +109,7 @@ static void add_multi_netfilter(void)
|
|||
|
||||
g_assert(response);
|
||||
g_assert(!qdict_haskey(response, "error"));
|
||||
QDECREF(response);
|
||||
qobject_unref(response);
|
||||
|
||||
response = qmp("{'execute': 'object-del',"
|
||||
" 'arguments': {"
|
||||
|
@ -117,7 +117,7 @@ static void add_multi_netfilter(void)
|
|||
"}}");
|
||||
g_assert(response);
|
||||
g_assert(!qdict_haskey(response, "error"));
|
||||
QDECREF(response);
|
||||
qobject_unref(response);
|
||||
|
||||
response = qmp("{'execute': 'object-del',"
|
||||
" 'arguments': {"
|
||||
|
@ -125,7 +125,7 @@ static void add_multi_netfilter(void)
|
|||
"}}");
|
||||
g_assert(response);
|
||||
g_assert(!qdict_haskey(response, "error"));
|
||||
QDECREF(response);
|
||||
qobject_unref(response);
|
||||
}
|
||||
|
||||
/* add multi(2) netfilters to a netdev and then remove the netdev */
|
||||
|
@ -145,7 +145,7 @@ static void remove_netdev_with_multi_netfilter(void)
|
|||
|
||||
g_assert(response);
|
||||
g_assert(!qdict_haskey(response, "error"));
|
||||
QDECREF(response);
|
||||
qobject_unref(response);
|
||||
|
||||
response = qmp("{'execute': 'object-add',"
|
||||
" 'arguments': {"
|
||||
|
@ -159,7 +159,7 @@ static void remove_netdev_with_multi_netfilter(void)
|
|||
|
||||
g_assert(response);
|
||||
g_assert(!qdict_haskey(response, "error"));
|
||||
QDECREF(response);
|
||||
qobject_unref(response);
|
||||
|
||||
response = qmp("{'execute': 'netdev_del',"
|
||||
" 'arguments': {"
|
||||
|
@ -167,7 +167,7 @@ static void remove_netdev_with_multi_netfilter(void)
|
|||
"}}");
|
||||
g_assert(response);
|
||||
g_assert(!qdict_haskey(response, "error"));
|
||||
QDECREF(response);
|
||||
qobject_unref(response);
|
||||
|
||||
/* add back the netdev */
|
||||
response = qmp("{'execute': 'netdev_add',"
|
||||
|
@ -177,7 +177,7 @@ static void remove_netdev_with_multi_netfilter(void)
|
|||
"}}");
|
||||
g_assert(response);
|
||||
g_assert(!qdict_haskey(response, "error"));
|
||||
QDECREF(response);
|
||||
qobject_unref(response);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue