mirror of https://github.com/xqemu/xqemu.git
qom: Clean up assertions to display values on failure
Instead of using g_assert() for integer comparisons, use g_assert_cmpint() so that we can see the respective values. While at it, fix one stray indentation. Reviewed-by: Daniel P. Berrange <berrange@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
This commit is contained in:
parent
b604a854e8
commit
8438a13543
10
qom/object.c
10
qom/object.c
|
@ -265,7 +265,7 @@ static void type_initialize(TypeImpl *ti)
|
||||||
GSList *e;
|
GSList *e;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
g_assert(parent->class_size <= ti->class_size);
|
g_assert_cmpint(parent->class_size, <=, ti->class_size);
|
||||||
memcpy(ti->class, parent->class, parent->class_size);
|
memcpy(ti->class, parent->class, parent->class_size);
|
||||||
ti->class->interfaces = NULL;
|
ti->class->interfaces = NULL;
|
||||||
|
|
||||||
|
@ -347,9 +347,9 @@ void object_initialize_with_type(void *data, size_t size, TypeImpl *type)
|
||||||
g_assert(type != NULL);
|
g_assert(type != NULL);
|
||||||
type_initialize(type);
|
type_initialize(type);
|
||||||
|
|
||||||
g_assert(type->instance_size >= sizeof(Object));
|
g_assert_cmpint(type->instance_size, >=, sizeof(Object));
|
||||||
g_assert(type->abstract == false);
|
g_assert(type->abstract == false);
|
||||||
g_assert(size >= type->instance_size);
|
g_assert_cmpint(size, >=, type->instance_size);
|
||||||
|
|
||||||
memset(obj, 0, type->instance_size);
|
memset(obj, 0, type->instance_size);
|
||||||
obj->class = type->class;
|
obj->class = type->class;
|
||||||
|
@ -450,7 +450,7 @@ static void object_finalize(void *data)
|
||||||
object_property_del_all(obj);
|
object_property_del_all(obj);
|
||||||
object_deinit(obj, ti);
|
object_deinit(obj, ti);
|
||||||
|
|
||||||
g_assert(obj->ref == 0);
|
g_assert_cmpint(obj->ref, ==, 0);
|
||||||
if (obj->free) {
|
if (obj->free) {
|
||||||
obj->free(obj);
|
obj->free(obj);
|
||||||
}
|
}
|
||||||
|
@ -880,7 +880,7 @@ void object_unref(Object *obj)
|
||||||
if (!obj) {
|
if (!obj) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
g_assert(obj->ref > 0);
|
g_assert_cmpint(obj->ref, >, 0);
|
||||||
|
|
||||||
/* parent always holds a reference to its children */
|
/* parent always holds a reference to its children */
|
||||||
if (atomic_fetch_dec(&obj->ref) == 1) {
|
if (atomic_fetch_dec(&obj->ref) == 1) {
|
||||||
|
|
Loading…
Reference in New Issue