aboutsummaryrefslogtreecommitdiff
path: root/docs/qapi-code-gen.txt
diff options
context:
space:
mode:
Diffstat (limited to 'docs/qapi-code-gen.txt')
-rw-r--r--docs/qapi-code-gen.txt49
1 files changed, 18 insertions, 31 deletions
diff --git a/docs/qapi-code-gen.txt b/docs/qapi-code-gen.txt
index eff207502f..48b0b31f2e 100644
--- a/docs/qapi-code-gen.txt
+++ b/docs/qapi-code-gen.txt
@@ -802,32 +802,28 @@ Example:
void qapi_free_UserDefOne(UserDefOne *obj)
{
- QapiDeallocVisitor *qdv;
Visitor *v;
if (!obj) {
return;
}
- qdv = qapi_dealloc_visitor_new();
- v = qapi_dealloc_get_visitor(qdv);
+ v = qapi_dealloc_visitor_new();
visit_type_UserDefOne(v, NULL, &obj, NULL);
- qapi_dealloc_visitor_cleanup(qdv);
+ visit_free(v);
}
void qapi_free_UserDefOneList(UserDefOneList *obj)
{
- QapiDeallocVisitor *qdv;
Visitor *v;
if (!obj) {
return;
}
- qdv = qapi_dealloc_visitor_new();
- v = qapi_dealloc_get_visitor(qdv);
+ v = qapi_dealloc_visitor_new();
visit_type_UserDefOneList(v, NULL, &obj, NULL);
- qapi_dealloc_visitor_cleanup(qdv);
+ visit_free(v);
}
=== scripts/qapi-visit.py ===
@@ -904,7 +900,7 @@ Example:
}
visit_check_struct(v, &err);
out_obj:
- visit_end_struct(v);
+ visit_end_struct(v, (void **)obj);
if (err && visit_is_input(v)) {
qapi_free_UserDefOne(*obj);
*obj = NULL;
@@ -932,7 +928,7 @@ Example:
}
}
- visit_end_list(v);
+ visit_end_list(v, (void **)obj);
if (err && visit_is_input(v)) {
qapi_free_UserDefOneList(*obj);
*obj = NULL;
@@ -984,36 +980,28 @@ Example:
static void qmp_marshal_output_UserDefOne(UserDefOne *ret_in, QObject **ret_out, Error **errp)
{
Error *err = NULL;
- QmpOutputVisitor *qov = qmp_output_visitor_new();
- QapiDeallocVisitor *qdv;
Visitor *v;
- v = qmp_output_get_visitor(qov);
+ v = qmp_output_visitor_new(ret_out);
visit_type_UserDefOne(v, "unused", &ret_in, &err);
- if (err) {
- goto out;
+ if (!err) {
+ visit_complete(v, ret_out);
}
- *ret_out = qmp_output_get_qobject(qov);
-
- out:
error_propagate(errp, err);
- qmp_output_visitor_cleanup(qov);
- qdv = qapi_dealloc_visitor_new();
- v = qapi_dealloc_get_visitor(qdv);
+ visit_free(v);
+ v = qapi_dealloc_visitor_new();
visit_type_UserDefOne(v, "unused", &ret_in, NULL);
- qapi_dealloc_visitor_cleanup(qdv);
+ visit_free(v);
}
static void qmp_marshal_my_command(QDict *args, QObject **ret, Error **errp)
{
Error *err = NULL;
UserDefOne *retval;
- QmpInputVisitor *qiv = qmp_input_visitor_new(QOBJECT(args), true);
- QapiDeallocVisitor *qdv;
Visitor *v;
UserDefOneList *arg1 = NULL;
- 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;
@@ -1022,7 +1010,7 @@ Example:
if (!err) {
visit_check_struct(v, &err);
}
- visit_end_struct(v);
+ visit_end_struct(v, NULL);
if (err) {
goto out;
}
@@ -1036,13 +1024,12 @@ Example:
out:
error_propagate(errp, err);
- qmp_input_visitor_cleanup(qiv);
- qdv = qapi_dealloc_visitor_new();
- v = qapi_dealloc_get_visitor(qdv);
+ visit_free(v);
+ v = qapi_dealloc_visitor_new();
visit_start_struct(v, NULL, NULL, 0, NULL);
visit_type_UserDefOneList(v, "arg1", &arg1, NULL);
- visit_end_struct(v);
- qapi_dealloc_visitor_cleanup(qdv);
+ visit_end_struct(v, NULL);
+ visit_free(v);
}
static void qmp_init_marshal(void)