From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58979) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cepIU-0002YZ-Py for qemu-devel@nongnu.org; Fri, 17 Feb 2017 15:38:32 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cepIT-0004Q8-M4 for qemu-devel@nongnu.org; Fri, 17 Feb 2017 15:38:30 -0500 Received: from mx1.redhat.com ([209.132.183.28]:32918) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cepIT-0004PP-GW for qemu-devel@nongnu.org; Fri, 17 Feb 2017 15:38:29 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A19FA42BAC for ; Fri, 17 Feb 2017 20:38:29 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-116-50.ams2.redhat.com [10.36.116.50]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v1HKcSTe018330 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Fri, 17 Feb 2017 15:38:29 -0500 From: Markus Armbruster Date: Fri, 17 Feb 2017 21:38:19 +0100 Message-Id: <1487363905-9480-9-git-send-email-armbru@redhat.com> In-Reply-To: <1487363905-9480-1-git-send-email-armbru@redhat.com> References: <1487363905-9480-1-git-send-email-armbru@redhat.com> Subject: [Qemu-devel] [PATCH 08/14] tests: Don't check qobject_type() before qobject_to_qlist() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org qobject_to_qlist(obj) returns NULL when obj isn't a QList. Check that instead of qobject_type(obj) == QTYPE_QLIST. Signed-off-by: Markus Armbruster --- tests/test-qobject-output-visitor.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/tests/test-qobject-output-visitor.c b/tests/test-qobject-output-visitor.c index a874386..13a0a9b 100644 --- a/tests/test-qobject-output-visitor.c +++ b/tests/test-qobject-output-visitor.c @@ -261,7 +261,6 @@ static void test_visitor_out_list(TestOutputVisitorData *data, bool value_bool = true; int value_int = 10; QListEntry *entry; - QObject *obj; QList *qlist; int i; @@ -279,10 +278,8 @@ static void test_visitor_out_list(TestOutputVisitorData *data, visit_type_TestStructList(data->ov, NULL, &head, &error_abort); - obj = visitor_get(data); - g_assert(qobject_type(obj) == QTYPE_QLIST); - - qlist = qobject_to_qlist(obj); + qlist = qobject_to_qlist(visitor_get(data)); + g_assert(qlist); g_assert(!qlist_empty(qlist)); /* ...and ensure that the visitor sees it in order */ -- 2.7.4