Skip to content

Commit

Permalink
qom: Introduce object_realize()
Browse files Browse the repository at this point in the history
Wrap setting of Object::realized property, error reporting and exit(1)
into a helper function.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Cc: Anthony Liguori <anthony@codemonkey.ws>
Cc: Paolo Bonzini <pbonzini@redhat.com>
  • Loading branch information
afaerber committed Mar 30, 2012
1 parent bc78ab1 commit 67db4a4
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
9 changes: 9 additions & 0 deletions include/qemu/object.h
Expand Up @@ -466,6 +466,15 @@ void object_initialize_with_type(void *data, Type type);
*/
void object_initialize(void *obj, const char *typename);

/**
* object_realize:
* @obj: The object to realize.
*
* This function will complete the initialization of an object based on
* properties set by setting the "realized" property to true.
*/
void object_realize(Object *obj);

/**
* object_finalize:
* @obj: The object to finalize.
Expand Down
11 changes: 11 additions & 0 deletions qom/object.c
Expand Up @@ -327,6 +327,17 @@ void object_initialize(void *data, const char *typename)
object_initialize_with_type(data, type);
}

void object_realize(Object *obj)
{
Error *err = NULL;

object_property_set_bool(obj, true, "realized", &err);
if (error_is_set(&err)) {
qerror_report_err(err);
exit(1);
}
}

static void object_property_del_all(Object *obj)
{
while (!QTAILQ_EMPTY(&obj->properties)) {
Expand Down

0 comments on commit 67db4a4

Please sign in to comment.