diff mbox series

[v2,06/12] qom/object: register 'type' property as class property

Message ID 20180907075948.26917-7-marcandre.lureau@redhat.com
State New
Headers show
Series Various qemu command line options help improvements | expand

Commit Message

Marc-André Lureau Sept. 7, 2018, 7:59 a.m. UTC
Let's save a few byte in each object instance.

(Is this property really used anywhere? Only qom-get could read it)

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 qom/object.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Comments

Paolo Bonzini Oct. 3, 2018, 12:59 p.m. UTC | #1
On 07/09/2018 09:59, Marc-André Lureau wrote:
> Let's save a few byte in each object instance.
> 
> (Is this property really used anywhere? Only qom-get could read it)

Well, it's not really used but it's part of the external API.

> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
>  qom/object.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/qom/object.c b/qom/object.c
> index d8666de3f2..185d1dd9f8 100644
> --- a/qom/object.c
> +++ b/qom/object.c
> @@ -2423,9 +2423,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)
> @@ -2439,7 +2440,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,
>      };
>  
> 

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
diff mbox series

Patch

diff --git a/qom/object.c b/qom/object.c
index d8666de3f2..185d1dd9f8 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -2423,9 +2423,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)
@@ -2439,7 +2440,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,
     };