mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-05 00:33:55 -06:00
qapi: Separate type QNull from QObject
Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
parent
df95f1a298
commit
006ca09f30
7 changed files with 28 additions and 22 deletions
|
@ -24,14 +24,14 @@ static void qnull_ref_test(void)
|
|||
{
|
||||
QObject *obj;
|
||||
|
||||
g_assert(qnull_.refcnt == 1);
|
||||
obj = qnull();
|
||||
g_assert(qnull_.base.refcnt == 1);
|
||||
obj = QOBJECT(qnull());
|
||||
g_assert(obj);
|
||||
g_assert(obj == &qnull_);
|
||||
g_assert(qnull_.refcnt == 2);
|
||||
g_assert(obj == QOBJECT(&qnull_));
|
||||
g_assert(qnull_.base.refcnt == 2);
|
||||
g_assert(qobject_type(obj) == QTYPE_QNULL);
|
||||
qobject_decref(obj);
|
||||
g_assert(qnull_.refcnt == 1);
|
||||
g_assert(qnull_.base.refcnt == 1);
|
||||
}
|
||||
|
||||
static void qnull_visit_test(void)
|
||||
|
@ -45,8 +45,8 @@ static void qnull_visit_test(void)
|
|||
* depend on layering violations to check qnull_ refcnt.
|
||||
*/
|
||||
|
||||
g_assert(qnull_.refcnt == 1);
|
||||
obj = qnull();
|
||||
g_assert(qnull_.base.refcnt == 1);
|
||||
obj = QOBJECT(qnull());
|
||||
v = qobject_input_visitor_new(obj);
|
||||
qobject_decref(obj);
|
||||
visit_type_null(v, NULL, &error_abort);
|
||||
|
@ -55,11 +55,11 @@ static void qnull_visit_test(void)
|
|||
v = qobject_output_visitor_new(&obj);
|
||||
visit_type_null(v, NULL, &error_abort);
|
||||
visit_complete(v, &obj);
|
||||
g_assert(obj == &qnull_);
|
||||
g_assert(obj == QOBJECT(&qnull_));
|
||||
qobject_decref(obj);
|
||||
visit_free(v);
|
||||
|
||||
g_assert(qnull_.refcnt == 1);
|
||||
g_assert(qnull_.base.refcnt == 1);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue