qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 08/14] tests: Don't check qobject_type() before qobj


From: Markus Armbruster
Subject: [Qemu-devel] [PATCH 08/14] tests: Don't check qobject_type() before qobject_to_qlist()
Date: Fri, 17 Feb 2017 21:38:19 +0100

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 <address@hidden>
---
 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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]