qapi: add assert about root value
authorMarc-André Lureau <marcandre.lureau@redhat.com>
Fri, 30 Sep 2016 09:59:46 +0000 (13:59 +0400)
committerMarkus Armbruster <armbru@redhat.com>
Fri, 7 Oct 2016 17:22:11 +0000 (19:22 +0200)
qiv->root should not be null, make that clearer with some assert.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20160930095948.3154-2-marcandre.lureau@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
qapi/qmp-input-visitor.c

index fc91e74..c7deca9 100644 (file)
@@ -64,6 +64,7 @@ static QObject *qmp_input_get_object(QmpInputVisitor *qiv,
 
     if (QSLIST_EMPTY(&qiv->stack)) {
         /* Starting at root, name is ignored. */
+        assert(qiv->root);
         return qiv->root;
     }
 
@@ -395,6 +396,7 @@ Visitor *qmp_input_visitor_new(QObject *obj, bool strict)
 {
     QmpInputVisitor *v;
 
+    assert(obj);
     v = g_malloc0(sizeof(*v));
 
     v->visitor.type = VISITOR_INPUT;