[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 18/26] object: return self in object_ref()
From: |
Marc-André Lureau |
Subject: |
[PATCH 18/26] object: return self in object_ref() |
Date: |
Fri, 10 Jan 2020 19:30:31 +0400 |
This allow for simpler assignment with ref: foo = object_ref(bar)
Signed-off-by: Marc-André Lureau <address@hidden>
---
include/qom/object.h | 3 ++-
qom/object.c | 5 +++--
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/include/qom/object.h b/include/qom/object.h
index ead9129ac8..933e5c6cb9 100644
--- a/include/qom/object.h
+++ b/include/qom/object.h
@@ -1013,8 +1013,9 @@ GSList *object_class_get_list_sorted(const char
*implements_type,
*
* Increase the reference count of a object. A object cannot be freed as long
* as its reference count is greater than zero.
+ * Returns: @obj
*/
-void object_ref(Object *obj);
+Object *object_ref(Object *obj);
/**
* object_unref:
diff --git a/qom/object.c b/qom/object.c
index 3924678ec3..9f76a330ff 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -1098,12 +1098,13 @@ GSList *object_class_get_list_sorted(const char
*implements_type,
object_class_cmp);
}
-void object_ref(Object *obj)
+Object *object_ref(Object *obj)
{
if (!obj) {
- return;
+ return NULL;
}
atomic_inc(&obj->ref);
+ return obj;
}
void object_unref(Object *obj)
--
2.25.0.rc1.20.g2443f3f80d.dirty
- Re: [PATCH 10/26] object: add object_property_set_defaut_{bool, str, int, uint}(), (continued)
- Re: [PATCH 10/26] object: add object_property_set_defaut_{bool, str, int, uint}(), Paolo Bonzini, 2020/01/23
- Re: [PATCH 10/26] object: add object_property_set_defaut_{bool, str, int, uint}(), Marc-André Lureau, 2020/01/23
- Re: [PATCH 10/26] object: add object_property_set_defaut_{bool, str, int, uint}(), Paolo Bonzini, 2020/01/23
[PATCH 11/26] object: do not free class properties, Marc-André Lureau, 2020/01/10
[PATCH 12/26] object: check strong flag with &, Marc-André Lureau, 2020/01/10
[PATCH 13/26] object: rename link "child" to "target", Marc-André Lureau, 2020/01/10
[PATCH 14/26] object: add direct link flag, Marc-André Lureau, 2020/01/10
[PATCH 15/26] object: express const link with link property, Marc-André Lureau, 2020/01/10
[PATCH 16/26] object: add object_class_property_add_link(), Marc-André Lureau, 2020/01/10
[PATCH 17/26] object: release all props, Marc-André Lureau, 2020/01/10
[PATCH 18/26] object: return self in object_ref(),
Marc-André Lureau <=
[PATCH 20/26] qdev: move instance properties to class properties, Marc-André Lureau, 2020/01/10
[PATCH 21/26] qdev: register properties as class properties, Marc-André Lureau, 2020/01/10
[PATCH 19/26] qdev: set properties with device_class_set_props(), Marc-André Lureau, 2020/01/10
[PATCH 22/26] vl: print default value in object help, Marc-André Lureau, 2020/01/10
[PATCH 23/26] qom: simplify qmp_device_list_properties(), Marc-André Lureau, 2020/01/10
[PATCH 24/26] qom: introduce object_property_help(), Marc-André Lureau, 2020/01/10
[PATCH 25/26] qapi/qmp: add ObjectPropertyInfo.default-value, Marc-André Lureau, 2020/01/10