提交 7439a036 编写于 作者: M Marc-André Lureau

qom/object: register 'type' property as class property

Let's save a few byte in each object instance.
Signed-off-by: NMarc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: NPaolo Bonzini <pbonzini@redhat.com>
上级 684546d8
...@@ -2430,9 +2430,10 @@ void object_class_property_set_description(ObjectClass *klass, ...@@ -2430,9 +2430,10 @@ void object_class_property_set_description(ObjectClass *klass,
op->description = g_strdup(description); 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) static void register_types(void)
...@@ -2446,7 +2447,7 @@ static void register_types(void) ...@@ -2446,7 +2447,7 @@ static void register_types(void)
static TypeInfo object_info = { static TypeInfo object_info = {
.name = TYPE_OBJECT, .name = TYPE_OBJECT,
.instance_size = sizeof(Object), .instance_size = sizeof(Object),
.instance_init = object_instance_init, .class_init = object_class_init,
.abstract = true, .abstract = true,
}; };
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册