mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 00:03:54 -06:00
qmp-input-visitor: Favor new visit_free() function
Now that we have a polymorphic visit_free(), we no longer need qmp_input_visitor_cleanup(); which in turn means we no longer need to return a subtype from qmp_input_visitor_new() nor a public upcast function. Generated code changes to qmp-marshal.c look like: |@@ -52,11 +52,10 @@ void qmp_marshal_add_fd(QDict *args, QOb | { | Error *err = NULL; | AddfdInfo *retval; |- QmpInputVisitor *qiv = qmp_input_visitor_new(QOBJECT(args), true); | Visitor *v; | q_obj_add_fd_arg arg = {0}; | |- v = qmp_input_get_visitor(qiv); |+ v = qmp_input_visitor_new(QOBJECT(args), true); | visit_start_struct(v, NULL, NULL, 0, &err); | if (err) { | goto out; Signed-off-by: Eric Blake <eblake@redhat.com> Message-Id: <1465490926-28625-8-git-send-email-eblake@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
This commit is contained in:
parent
7a0525c7be
commit
b70ce1018a
13 changed files with 36 additions and 70 deletions
|
@ -26,7 +26,7 @@
|
|||
|
||||
typedef struct TestInputVisitorData {
|
||||
QObject *obj;
|
||||
QmpInputVisitor *qiv;
|
||||
Visitor *qiv;
|
||||
} TestInputVisitorData;
|
||||
|
||||
static void validate_teardown(TestInputVisitorData *data,
|
||||
|
@ -36,7 +36,7 @@ static void validate_teardown(TestInputVisitorData *data,
|
|||
data->obj = NULL;
|
||||
|
||||
if (data->qiv) {
|
||||
qmp_input_visitor_cleanup(data->qiv);
|
||||
visit_free(data->qiv);
|
||||
data->qiv = NULL;
|
||||
}
|
||||
}
|
||||
|
@ -48,8 +48,6 @@ static Visitor *validate_test_init_internal(TestInputVisitorData *data,
|
|||
const char *json_string,
|
||||
va_list *ap)
|
||||
{
|
||||
Visitor *v;
|
||||
|
||||
validate_teardown(data, NULL);
|
||||
|
||||
data->obj = qobject_from_jsonv(json_string, ap);
|
||||
|
@ -57,11 +55,7 @@ static Visitor *validate_test_init_internal(TestInputVisitorData *data,
|
|||
|
||||
data->qiv = qmp_input_visitor_new(data->obj, true);
|
||||
g_assert(data->qiv);
|
||||
|
||||
v = qmp_input_get_visitor(data->qiv);
|
||||
g_assert(v);
|
||||
|
||||
return v;
|
||||
return data->qiv;
|
||||
}
|
||||
|
||||
static GCC_FMT_ATTR(2, 3)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue