From: "Andreas Färber" <afaerber@suse.de>
To: qemu-devel@nongnu.org
Cc: "Andreas Färber" <afaerber@suse.de>
Subject: [Qemu-devel] [PULL 09/10] qom: Clean up assertions to display values on failure
Date: Wed, 18 Nov 2015 21:39:37 +0100 [thread overview]
Message-ID: <1447879178-5440-10-git-send-email-afaerber@suse.de> (raw)
In-Reply-To: <1447879178-5440-1-git-send-email-afaerber@suse.de>
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>
---
qom/object.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/qom/object.c b/qom/object.c
index 19e7561..8c5c34e 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -265,7 +265,7 @@ static void type_initialize(TypeImpl *ti)
GSList *e;
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);
ti->class->interfaces = NULL;
@@ -347,9 +347,9 @@ void object_initialize_with_type(void *data, size_t size, TypeImpl *type)
g_assert(type != NULL);
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(size >= type->instance_size);
+ g_assert_cmpint(size, >=, type->instance_size);
memset(obj, 0, type->instance_size);
obj->class = type->class;
@@ -450,7 +450,7 @@ static void object_finalize(void *data)
object_property_del_all(obj);
object_deinit(obj, ti);
- g_assert(obj->ref == 0);
+ g_assert_cmpint(obj->ref, ==, 0);
if (obj->free) {
obj->free(obj);
}
@@ -872,7 +872,7 @@ void object_ref(Object *obj)
if (!obj) {
return;
}
- atomic_inc(&obj->ref);
+ atomic_inc(&obj->ref);
}
void object_unref(Object *obj)
@@ -880,7 +880,7 @@ void object_unref(Object *obj)
if (!obj) {
return;
}
- g_assert(obj->ref > 0);
+ g_assert_cmpint(obj->ref, >, 0);
/* parent always holds a reference to its children */
if (atomic_fetch_dec(&obj->ref) == 1) {
--
2.6.2
next prev parent reply other threads:[~2015-11-18 20:40 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-18 20:39 [Qemu-devel] [PULL for-2.5 00/10] QOM devices patch queue 2015-11-18 Andreas Färber
2015-11-18 20:39 ` [Qemu-devel] [PULL 01/10] qdev: Change Property::offset field to ptrdiff_t type Andreas Färber
2015-11-18 20:39 ` [Qemu-devel] [PULL 02/10] qom: Introduce ObjectPropertyIterator struct for iteration Andreas Färber
2015-11-19 9:20 ` Markus Armbruster
2015-11-19 9:25 ` Daniel P. Berrange
2015-11-19 9:49 ` Markus Armbruster
2015-11-19 10:24 ` Andreas Färber
2015-11-19 13:42 ` Markus Armbruster
2015-11-18 20:39 ` [Qemu-devel] [PULL 03/10] qmp: Convert QMP code to use object property iterators Andreas Färber
2015-11-18 20:39 ` [Qemu-devel] [PULL 04/10] vl: Convert machine help " Andreas Färber
2015-11-18 20:39 ` [Qemu-devel] [PULL 05/10] ppc: Convert spapr " Andreas Färber
2015-11-18 20:39 ` [Qemu-devel] [PULL 06/10] net: Convert net filter " Andreas Färber
2015-11-18 20:39 ` [Qemu-devel] [PULL 07/10] qom: Add a test case for complex property finalization Andreas Färber
2015-11-18 20:39 ` [Qemu-devel] [PULL 08/10] qom: Replace object property list with GHashTable Andreas Färber
2015-11-18 20:39 ` Andreas Färber [this message]
2015-11-18 20:39 ` [Qemu-devel] [PULL 10/10] MAINTAINERS: Add check-qom-{interface, proplist} to QOM Andreas Färber
2015-11-19 13:55 ` Daniel P. Berrange
2015-11-19 13:58 ` Igor Mammedov
2015-11-19 10:54 ` [Qemu-devel] [PULL for-2.5 00/10] QOM devices patch queue 2015-11-18 Peter Maydell
2015-11-19 11:53 ` Daniel P. Berrange
2015-11-19 14:09 ` Andreas Färber
2015-11-19 14:13 ` Daniel P. Berrange
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1447879178-5440-10-git-send-email-afaerber@suse.de \
--to=afaerber@suse.de \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).