From patchwork Thu Nov 19 14:36:07 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Andreas_F=C3=A4rber?= X-Patchwork-Id: 546497 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id D1871141466 for ; Fri, 20 Nov 2015 01:38:37 +1100 (AEDT) Received: from localhost ([::1]:42103 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZzQM7-00058o-UJ for incoming@patchwork.ozlabs.org; Thu, 19 Nov 2015 09:38:35 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49433) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZzQJr-0000ro-JH for qemu-devel@nongnu.org; Thu, 19 Nov 2015 09:36:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZzQJn-00058z-KW for qemu-devel@nongnu.org; Thu, 19 Nov 2015 09:36:15 -0500 Received: from mx2.suse.de ([195.135.220.15]:42961) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZzQJn-00058r-Dj for qemu-devel@nongnu.org; Thu, 19 Nov 2015 09:36:11 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id B6312AD43 for ; Thu, 19 Nov 2015 14:35:45 +0000 (UTC) From: =?UTF-8?q?Andreas=20F=C3=A4rber?= To: qemu-devel@nongnu.org Date: Thu, 19 Nov 2015 15:36:07 +0100 Message-Id: <1447943768-31393-10-git-send-email-afaerber@suse.de> X-Mailer: git-send-email 2.6.2 In-Reply-To: <1447943768-31393-1-git-send-email-afaerber@suse.de> References: <1447943768-31393-1-git-send-email-afaerber@suse.de> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] X-Received-From: 195.135.220.15 Cc: =?UTF-8?q?Andreas=20F=C3=A4rber?= Subject: [Qemu-devel] [PULL v2 09/10] qom: Clean up assertions to display values on failure X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 Signed-off-by: Andreas Färber --- qom/object.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/qom/object.c b/qom/object.c index ff34c86..d751569 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) {