diff mbox

[v2,1/4] qapi: add assert about root value

Message ID 20160921201018.20957-2-marcandre.lureau@redhat.com
State New
Headers show

Commit Message

Marc-André Lureau Sept. 21, 2016, 8:10 p.m. UTC
qiv->root should not be null, make that clearer with some assert.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 qapi/qmp-input-visitor.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Eric Blake Sept. 21, 2016, 9:05 p.m. UTC | #1
On 09/21/2016 03:10 PM, Marc-André Lureau wrote:
> qiv->root should not be null, make that clearer with some assert.
> 
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
>  qapi/qmp-input-visitor.c | 2 ++
>  1 file changed, 2 insertions(+)
> 

Reviewed-by: Eric Blake <eblake@redhat.com>
diff mbox

Patch

diff --git a/qapi/qmp-input-visitor.c b/qapi/qmp-input-visitor.c
index 64dd392..be52aaf 100644
--- a/qapi/qmp-input-visitor.c
+++ b/qapi/qmp-input-visitor.c
@@ -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;
     }
 
@@ -384,6 +385,7 @@  Visitor *qmp_input_visitor_new(QObject *obj, bool strict)
 {
     QmpInputVisitor *v;
 
+    assert(obj);
     v = g_malloc0(sizeof(*v));
 
     v->visitor.type = VISITOR_INPUT;