aboutsummaryrefslogtreecommitdiff
path: root/qom/object.c
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2020-07-07 18:05:58 +0200
committerMarkus Armbruster <armbru@redhat.com>2020-07-10 15:18:08 +0200
commitb783f54d60f8472aa61b44b682ca7af7929082e1 (patch)
treebe4731997832662013d92d32b1e6bfe6c1b8d9b7 /qom/object.c
parentf07ad48d46fdbc739dd72ac4ad1677dbbfe7ed44 (diff)
downloadqemu-b783f54d60f8472aa61b44b682ca7af7929082e1.zip
qemu-b783f54d60f8472aa61b44b682ca7af7929082e1.tar.gz
qemu-b783f54d60f8472aa61b44b682ca7af7929082e1.tar.bz2
qom: Make functions taking Error ** return bool, not 0/-1
Just for consistency. Also fix the example in object_set_props()'s documentation. 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-31-armbru@redhat.com>
Diffstat (limited to 'qom/object.c')
-rw-r--r--qom/object.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/qom/object.c b/qom/object.c
index e71266b..0761881 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -557,7 +557,7 @@ bool object_initialize_child_with_propsv(Object *parentobj,
object_initialize(childobj, size, type);
obj = OBJECT(childobj);
- if (object_set_propv(obj, errp, vargs) < 0) {
+ if (!object_set_propv(obj, errp, vargs)) {
goto out;
}
@@ -752,7 +752,7 @@ Object *object_new_with_propv(const char *typename,
}
obj = object_new_with_type(klass->type);
- if (object_set_propv(obj, errp, vargs) < 0) {
+ if (!object_set_propv(obj, errp, vargs)) {
goto error;
}
@@ -780,12 +780,12 @@ Object *object_new_with_propv(const char *typename,
}
-int object_set_props(Object *obj,
+bool object_set_props(Object *obj,
Error **errp,
...)
{
va_list vargs;
- int ret;
+ bool ret;
va_start(vargs, errp);
ret = object_set_propv(obj, errp, vargs);
@@ -795,7 +795,7 @@ int object_set_props(Object *obj,
}
-int object_set_propv(Object *obj,
+bool object_set_propv(Object *obj,
Error **errp,
va_list vargs)
{
@@ -809,12 +809,12 @@ int object_set_propv(Object *obj,
g_assert(value != NULL);
if (!object_property_parse(obj, propname, value, &local_err)) {
error_propagate(errp, local_err);
- return -1;
+ return false;
}
propname = va_arg(vargs, char *);
}
- return 0;
+ return true;
}