docs/devel/qapi-code-gen: Update examples to match current code

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20210712150214.624281-1-armbru@redhat.com>
Acked-by: John Snow <jsnow@redhat.com>
This commit is contained in:
Markus Armbruster 2021-07-12 17:02:14 +02:00
parent cb2f4b8750
commit e0366f9f2b
1 changed files with 16 additions and 7 deletions

View File

@ -1496,8 +1496,12 @@ Example:
bool visit_type_UserDefOne_members(Visitor *v, UserDefOne *obj, Error **errp); bool visit_type_UserDefOne_members(Visitor *v, UserDefOne *obj, Error **errp);
bool visit_type_UserDefOne(Visitor *v, const char *name, UserDefOne **obj, Error **errp);
bool visit_type_UserDefOneList(Visitor *v, const char *name, UserDefOneList **obj, Error **errp); bool visit_type_UserDefOne(Visitor *v, const char *name,
UserDefOne **obj, Error **errp);
bool visit_type_UserDefOneList(Visitor *v, const char *name,
UserDefOneList **obj, Error **errp);
bool visit_type_q_obj_my_command_arg_members(Visitor *v, q_obj_my_command_arg *obj, Error **errp); bool visit_type_q_obj_my_command_arg_members(Visitor *v, q_obj_my_command_arg *obj, Error **errp);
@ -1518,7 +1522,8 @@ Example:
return true; return true;
} }
bool visit_type_UserDefOne(Visitor *v, const char *name, UserDefOne **obj, Error **errp) bool visit_type_UserDefOne(Visitor *v, const char *name,
UserDefOne **obj, Error **errp)
{ {
bool ok = false; bool ok = false;
@ -1528,6 +1533,7 @@ Example:
if (!*obj) { if (!*obj) {
/* incomplete */ /* incomplete */
assert(visit_is_dealloc(v)); assert(visit_is_dealloc(v));
ok = true;
goto out_obj; goto out_obj;
} }
if (!visit_type_UserDefOne_members(v, *obj, errp)) { if (!visit_type_UserDefOne_members(v, *obj, errp)) {
@ -1543,7 +1549,8 @@ Example:
return ok; return ok;
} }
bool visit_type_UserDefOneList(Visitor *v, const char *name, UserDefOneList **obj, Error **errp) bool visit_type_UserDefOneList(Visitor *v, const char *name,
UserDefOneList **obj, Error **errp)
{ {
bool ok = false; bool ok = false;
UserDefOneList *tail; UserDefOneList *tail;
@ -1628,11 +1635,13 @@ Example:
$ cat qapi-generated/example-qapi-commands.c $ cat qapi-generated/example-qapi-commands.c
[Uninteresting stuff omitted...] [Uninteresting stuff omitted...]
static void qmp_marshal_output_UserDefOne(UserDefOne *ret_in, QObject **ret_out, Error **errp)
static void qmp_marshal_output_UserDefOne(UserDefOne *ret_in,
QObject **ret_out, Error **errp)
{ {
Visitor *v; Visitor *v;
v = qobject_output_visitor_new(ret_out); v = qobject_output_visitor_new_qmp(ret_out);
if (visit_type_UserDefOne(v, "unused", &ret_in, errp)) { if (visit_type_UserDefOne(v, "unused", &ret_in, errp)) {
visit_complete(v, ret_out); visit_complete(v, ret_out);
} }
@ -1650,7 +1659,7 @@ Example:
UserDefOne *retval; UserDefOne *retval;
q_obj_my_command_arg arg = {0}; q_obj_my_command_arg arg = {0};
v = qobject_input_visitor_new(QOBJECT(args)); v = qobject_input_visitor_new_qmp(QOBJECT(args));
if (!visit_start_struct(v, NULL, NULL, 0, errp)) { if (!visit_start_struct(v, NULL, NULL, 0, errp)) {
goto out; goto out;
} }