aboutsummaryrefslogtreecommitdiff
path: root/include/qom
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 /include/qom
parentf07ad48d46fdbc739dd72ac4ad1677dbbfe7ed44 (diff)
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 'include/qom')
-rw-r--r--include/qom/object.h28
1 files changed, 11 insertions, 17 deletions
diff --git a/include/qom/object.h b/include/qom/object.h
index 1088e5a34d..10fd4a2d4c 100644
--- a/include/qom/object.h
+++ b/include/qom/object.h
@@ -729,15 +729,13 @@ void object_apply_compat_props(Object *obj);
* Error *err = NULL;
* Object *obj = ...get / create object...;
*
- * obj = object_set_props(obj,
- * &err,
- * "share", "yes",
- * "mem-path", "/dev/shm/somefile",
- * "prealloc", "yes",
- * "size", "1048576",
- * NULL);
- *
- * if (!obj) {
+ * if (!object_set_props(obj,
+ * &err,
+ * "share", "yes",
+ * "mem-path", "/dev/shm/somefile",
+ * "prealloc", "yes",
+ * "size", "1048576",
+ * NULL)) {
* error_reportf_err(err, "Cannot set properties: ");
* }
* </programlisting>
@@ -746,11 +744,9 @@ void object_apply_compat_props(Object *obj);
* The returned object will have one stable reference maintained
* for as long as it is present in the object hierarchy.
*
- * Returns: -1 on error, 0 on success
+ * Returns: %true on success, %false on error.
*/
-int object_set_props(Object *obj,
- Error **errp,
- ...) QEMU_SENTINEL;
+bool object_set_props(Object *obj, Error **errp, ...) QEMU_SENTINEL;
/**
* object_set_propv:
@@ -760,11 +756,9 @@ int object_set_props(Object *obj,
*
* See object_set_props() for documentation.
*
- * Returns: -1 on error, 0 on success
+ * Returns: %true on success, %false on error.
*/
-int object_set_propv(Object *obj,
- Error **errp,
- va_list vargs);
+bool object_set_propv(Object *obj, Error **errp, va_list vargs);
/**
* object_initialize: