mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 23:33:54 -06:00
qapi: Use QNull for a more regular visit_type_null()
Make visit_type_null() take an @obj argument like its buddies. This helps keep the next commit simple. 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
006ca09f30
commit
d2f95f4d48
15 changed files with 60 additions and 25 deletions
|
@ -510,6 +510,7 @@ static void test_visitor_in_null(TestInputVisitorData *data,
|
|||
{
|
||||
Visitor *v;
|
||||
Error *err = NULL;
|
||||
QNull *null;
|
||||
char *tmp;
|
||||
|
||||
/*
|
||||
|
@ -524,12 +525,15 @@ static void test_visitor_in_null(TestInputVisitorData *data,
|
|||
v = visitor_input_test_init_full(data, false,
|
||||
"{ 'a': null, 'b': '' }");
|
||||
visit_start_struct(v, NULL, NULL, 0, &error_abort);
|
||||
visit_type_null(v, "a", &error_abort);
|
||||
visit_type_null(v, "b", &err);
|
||||
visit_type_null(v, "a", &null, &error_abort);
|
||||
g_assert(qobject_type(QOBJECT(null)) == QTYPE_QNULL);
|
||||
QDECREF(null);
|
||||
visit_type_null(v, "b", &null, &err);
|
||||
error_free_or_abort(&err);
|
||||
g_assert(!null);
|
||||
visit_type_str(v, "c", &tmp, &err);
|
||||
g_assert(!tmp);
|
||||
error_free_or_abort(&err);
|
||||
g_assert(!tmp);
|
||||
visit_check_struct(v, &error_abort);
|
||||
visit_end_struct(v, NULL);
|
||||
}
|
||||
|
@ -1087,6 +1091,7 @@ static void test_visitor_in_fail_struct_missing(TestInputVisitorData *data,
|
|||
Error *err = NULL;
|
||||
Visitor *v;
|
||||
QObject *any;
|
||||
QNull *null;
|
||||
GenericAlternate *alt;
|
||||
bool present;
|
||||
int en;
|
||||
|
@ -1120,7 +1125,7 @@ static void test_visitor_in_fail_struct_missing(TestInputVisitorData *data,
|
|||
error_free_or_abort(&err);
|
||||
visit_type_any(v, "any", &any, &err);
|
||||
error_free_or_abort(&err);
|
||||
visit_type_null(v, "null", &err);
|
||||
visit_type_null(v, "null", &null, &err);
|
||||
error_free_or_abort(&err);
|
||||
visit_start_list(v, "sub", NULL, 0, &error_abort);
|
||||
visit_start_struct(v, NULL, NULL, 0, &error_abort);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue