Skip to content

Commit

Permalink
qom/object: register 'type' property as class property
Browse files Browse the repository at this point in the history
Let's save a few byte in each object instance.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
  • Loading branch information
elmarco committed Oct 5, 2018
1 parent 684546d commit 7439a03
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions qom/object.c
Expand Up @@ -2430,9 +2430,10 @@ void object_class_property_set_description(ObjectClass *klass,
op->description = g_strdup(description);
}

static void object_instance_init(Object *obj)
static void object_class_init(ObjectClass *klass, void *data)
{
object_property_add_str(obj, "type", qdev_get_type, NULL, NULL);
object_class_property_add_str(klass, "type", qdev_get_type,
NULL, &error_abort);
}

static void register_types(void)
Expand All @@ -2446,7 +2447,7 @@ static void register_types(void)
static TypeInfo object_info = {
.name = TYPE_OBJECT,
.instance_size = sizeof(Object),
.instance_init = object_instance_init,
.class_init = object_class_init,
.abstract = true,
};

Expand Down

0 comments on commit 7439a03

Please sign in to comment.