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

Let's save a few byte in each object instance.

Backports commit 7439a036d58f0def85751d6d4d3232461a35ebee from qemu
This commit is contained in:
Marc-André Lureau 2018-10-08 08:40:52 -04:00 committed by Lioncash
parent cc3d618e61
commit df8790284f
No known key found for this signature in database
GPG key ID: 4E3C3CC1031BA9C7

View file

@ -1973,9 +1973,10 @@ void object_class_property_set_description(struct uc_struct *uc,
op->description = g_strdup(description);
}
static void object_instance_init(struct uc_struct *uc, Object *obj, void *opaque)
static void object_class_init(struct uc_struct *uc, ObjectClass *klass, void *opaque)
{
object_property_add_str(uc, obj, "type", qdev_get_type, NULL, NULL);
object_class_property_add_str(uc, klass, "type", qdev_get_type,
NULL, &error_abort);
}
void register_types_object(struct uc_struct *uc)
@ -2009,13 +2010,13 @@ void register_types_object(struct uc_struct *uc)
sizeof(Object),
NULL,
object_instance_init,
NULL,
NULL,
NULL,
NULL,
NULL,
object_class_init,
NULL,
NULL,