diff mbox

[4/5] qapi: Use simpler QAPI_TO_QOBJECT()

Message ID 20170717155632.12754-5-eblake@redhat.com
State New
Headers show

Commit Message

Eric Blake July 17, 2017, 3:56 p.m. UTC
Use the new macro to avoid some boilerplate.

Signed-off-by: Eric Blake <eblake@redhat.com>
---
 block/qapi.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
diff mbox

Patch

diff --git a/block/qapi.c b/block/qapi.c
index 080eb8f115..23e666f108 100644
--- a/block/qapi.c
+++ b/block/qapi.c
@@ -675,14 +675,13 @@  void bdrv_image_info_specific_dump(fprintf_function func_fprintf, void *f,
                                    ImageInfoSpecific *info_spec)
 {
     QObject *obj, *data;
-    Visitor *v = qobject_output_visitor_new(&obj);

-    visit_type_ImageInfoSpecific(v, NULL, &info_spec, &error_abort);
-    visit_complete(v, &obj);
+    obj = QAPI_TO_QOBJECT(ImageInfoSpecific, info_spec, &error_abort);
+
+    assert(qobject_type(obj) == QTYPE_QDICT);
     data = qdict_get(qobject_to_qdict(obj), "data");
     dump_qobject(func_fprintf, f, 1, data);
     qobject_decref(obj);
-    visit_free(v);
 }

 void bdrv_image_info_dump(fprintf_function func_fprintf, void *f,