aboutsummaryrefslogtreecommitdiff
path: root/qapi/qobject-output-visitor.c
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2020-07-07 18:05:45 +0200
committerMarkus Armbruster <armbru@redhat.com>2020-07-10 15:18:08 +0200
commit012d4c96e260f99d5ca95cd033274af4fb73b825 (patch)
treecae388bc5db572e4462147479e7a98e33d162fbe /qapi/qobject-output-visitor.c
parent3c4b89c3b209978f13bcb7ab4d375b81b6fdad99 (diff)
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>
Diffstat (limited to 'qapi/qobject-output-visitor.c')
-rw-r--r--qapi/qobject-output-visitor.c27
1 files changed, 18 insertions, 9 deletions
diff --git a/qapi/qobject-output-visitor.c b/qapi/qobject-output-visitor.c
index 26d7be5ec9..ba6f6ac8a7 100644
--- a/qapi/qobject-output-visitor.c
+++ b/qapi/qobject-output-visitor.c
@@ -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.