mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-07-26 20:03:54 -06:00
qapi: Make visitor functions taking Error ** return bool, not void
See recent commit "error: Document Error API usage rules" for rationale. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Message-Id: <20200707160613.848843-18-armbru@redhat.com>
This commit is contained in:
parent
3c4b89c3b2
commit
012d4c96e2
14 changed files with 456 additions and 361 deletions
|
@ -103,7 +103,7 @@ static void qobject_output_add_obj(QObjectOutputVisitor *qov, const char *name,
|
|||
}
|
||||
}
|
||||
|
||||
static void qobject_output_start_struct(Visitor *v, const char *name,
|
||||
static bool qobject_output_start_struct(Visitor *v, const char *name,
|
||||
void **obj, size_t unused, Error **errp)
|
||||
{
|
||||
QObjectOutputVisitor *qov = to_qov(v);
|
||||
|
@ -111,6 +111,7 @@ static void qobject_output_start_struct(Visitor *v, const char *name,
|
|||
|
||||
qobject_output_add(qov, name, dict);
|
||||
qobject_output_push(qov, dict, obj);
|
||||
return true;
|
||||
}
|
||||
|
||||
static void qobject_output_end_struct(Visitor *v, void **obj)
|
||||
|
@ -120,7 +121,7 @@ static void qobject_output_end_struct(Visitor *v, void **obj)
|
|||
assert(qobject_type(value) == QTYPE_QDICT);
|
||||
}
|
||||
|
||||
static void qobject_output_start_list(Visitor *v, const char *name,
|
||||
static bool qobject_output_start_list(Visitor *v, const char *name,
|
||||
GenericList **listp, size_t size,
|
||||
Error **errp)
|
||||
{
|
||||
|
@ -129,6 +130,7 @@ static void qobject_output_start_list(Visitor *v, const char *name,
|
|||
|
||||
qobject_output_add(qov, name, list);
|
||||
qobject_output_push(qov, list, listp);
|
||||
return true;
|
||||
}
|
||||
|
||||
static GenericList *qobject_output_next_list(Visitor *v, GenericList *tail,
|
||||
|
@ -144,28 +146,31 @@ static void qobject_output_end_list(Visitor *v, void **obj)
|
|||
assert(qobject_type(value) == QTYPE_QLIST);
|
||||
}
|
||||
|
||||
static void qobject_output_type_int64(Visitor *v, const char *name,
|
||||
static bool qobject_output_type_int64(Visitor *v, const char *name,
|
||||
int64_t *obj, Error **errp)
|
||||
{
|
||||
QObjectOutputVisitor *qov = to_qov(v);
|
||||
qobject_output_add(qov, name, qnum_from_int(*obj));
|
||||
return true;
|
||||
}
|
||||
|
||||
static void qobject_output_type_uint64(Visitor *v, const char *name,
|
||||
static bool qobject_output_type_uint64(Visitor *v, const char *name,
|
||||
uint64_t *obj, Error **errp)
|
||||
{
|
||||
QObjectOutputVisitor *qov = to_qov(v);
|
||||
qobject_output_add(qov, name, qnum_from_uint(*obj));
|
||||
return true;
|
||||
}
|
||||
|
||||
static void qobject_output_type_bool(Visitor *v, const char *name, bool *obj,
|
||||
static bool qobject_output_type_bool(Visitor *v, const char *name, bool *obj,
|
||||
Error **errp)
|
||||
{
|
||||
QObjectOutputVisitor *qov = to_qov(v);
|
||||
qobject_output_add(qov, name, qbool_from_bool(*obj));
|
||||
return true;
|
||||
}
|
||||
|
||||
static void qobject_output_type_str(Visitor *v, const char *name, char **obj,
|
||||
static bool qobject_output_type_str(Visitor *v, const char *name, char **obj,
|
||||
Error **errp)
|
||||
{
|
||||
QObjectOutputVisitor *qov = to_qov(v);
|
||||
|
@ -174,28 +179,32 @@ static void qobject_output_type_str(Visitor *v, const char *name, char **obj,
|
|||
} else {
|
||||
qobject_output_add(qov, name, qstring_from_str(""));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static void qobject_output_type_number(Visitor *v, const char *name,
|
||||
static bool qobject_output_type_number(Visitor *v, const char *name,
|
||||
double *obj, Error **errp)
|
||||
{
|
||||
QObjectOutputVisitor *qov = to_qov(v);
|
||||
qobject_output_add(qov, name, qnum_from_double(*obj));
|
||||
return true;
|
||||
}
|
||||
|
||||
static void qobject_output_type_any(Visitor *v, const char *name,
|
||||
static bool qobject_output_type_any(Visitor *v, const char *name,
|
||||
QObject **obj, Error **errp)
|
||||
{
|
||||
QObjectOutputVisitor *qov = to_qov(v);
|
||||
|
||||
qobject_output_add_obj(qov, name, qobject_ref(*obj));
|
||||
return true;
|
||||
}
|
||||
|
||||
static void qobject_output_type_null(Visitor *v, const char *name,
|
||||
static bool qobject_output_type_null(Visitor *v, const char *name,
|
||||
QNull **obj, Error **errp)
|
||||
{
|
||||
QObjectOutputVisitor *qov = to_qov(v);
|
||||
qobject_output_add(qov, name, qnull());
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Finish building, and return the root object.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue