From df8790284f5f90486bd0e39e149509679e7f5cfb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Mon, 8 Oct 2018 08:40:52 -0400 Subject: [PATCH] qom/object: register 'type' property as class property Let's save a few byte in each object instance. Backports commit 7439a036d58f0def85751d6d4d3232461a35ebee from qemu --- qemu/qom/object.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/qemu/qom/object.c b/qemu/qom/object.c index 591747fd..47e8282a 100644 --- a/qemu/qom/object.c +++ b/qemu/qom/object.c @@ -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,