Skip to contentSkip to conversation

qom: Fix object_initialize_with_type() assertion

PATCH Applied Andreas Färber 3 participants 3 messages Feb 19, 2012 – Feb 22, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 qom: Fix object_initialize_with_type() assertion

Assert the object is at least sizeof(Object), not sizeof(ObjectClass).

---
 qom/object.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
qom/object.c +1 -1
index b1ead15..dbfd6a4 100644
@@ -262,7 +262,7 @@ void object_initialize_with_type(void *data, TypeImpl *type)
     Object *obj = data;
 
     g_assert(type != NULL);
-    g_assert(type->instance_size >= sizeof(ObjectClass));
+    g_assert(type->instance_size >= sizeof(Object));
 
     type_class_init(type);
     g_assert(type->abstract == false);
Signature · 1 line
1.7.7
Reviewed-by on v1 1/1
#1 lore raw
Quoted 12 lines · Andreas Färber

Assert the object is at least sizeof(Object), not sizeof(ObjectClass).

---
 qom/object.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
qom/object.c +0 -0
index b1ead15..dbfd6a4 100644

qom/object.c void object_initialize_with_type(void *data, TypeImpl *type) · line 268

Quoted 8 lines
qom/object.c +1 -1
@@ -262,7 +262,7 @@ void object_initialize_with_type(void *data, TypeImpl *type)
     Object *obj = data;
 
     g_assert(type != NULL);
-    g_assert(type->instance_size >= sizeof(ObjectClass));
+    g_assert(type->instance_size >= sizeof(Object));
 
     type_class_init(type);
     g_assert(type->abstract == false);

Paolo

#2 lore raw
In reply to Andreas Färber
Quoted 3 lines · Andreas Färber

Assert the object is at least sizeof(Object), not sizeof(ObjectClass).

Applied. Thanks.

Regards,

Anthony Liguori

Quoted 17 lines
---
  qom/object.c |    2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)
qom/object.c +1 -1
index b1ead15..dbfd6a4 100644
@@ -262,7 +262,7 @@ void object_initialize_with_type(void *data, TypeImpl *type)
      Object *obj = data;
 
      g_assert(type != NULL);
-    g_assert(type->instance_size>= sizeof(ObjectClass));
+    g_assert(type->instance_size>= sizeof(Object));
 
      type_class_init(type);
      g_assert(type->abstract == false);