aboutsummaryrefslogtreecommitdiff
path: root/qom
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2020-01-10 19:30:31 +0400
committerPaolo Bonzini <pbonzini@redhat.com>2020-01-24 20:59:14 +0100
commitb77ade9bb37b2e9813a42008cb21d0c743aa50a1 (patch)
tree97de7f3a5680ce1d1759ac72eee970690cc52bf7 /qom
parent9859facc0487b248217f7fe10aad8680be86b19f (diff)
object: return self in object_ref()
This allow for simpler assignment with ref: foo = object_ref(bar) Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <20200110153039.1379601-19-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'qom')
-rw-r--r--qom/object.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/qom/object.c b/qom/object.c
index 66c4a5f1cb..555c8b9d07 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -1107,12 +1107,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)