qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH 12/36] nbd: Use simpler QAPI_TO_QOBJECT()


From: Eric Blake
Subject: [Qemu-devel] [PATCH 12/36] nbd: Use simpler QAPI_TO_QOBJECT()
Date: Wed, 30 Nov 2016 13:44:30 -0600

Use the new macro to avoid some boilerplate.

Signed-off-by: Eric Blake <address@hidden>
---
 block/nbd.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/block/nbd.c b/block/nbd.c
index 334748d..a1dfd86 100644
--- a/block/nbd.c
+++ b/block/nbd.c
@@ -503,7 +503,6 @@ static void nbd_refresh_filename(BlockDriverState *bs, 
QDict *options)
     BDRVNBDState *s = bs->opaque;
     QDict *opts = qdict_new();
     QObject *saddr_qdict;
-    Visitor *ov;
     const char *host = NULL, *port = NULL, *path = NULL;

     if (s->saddr->type == SOCKET_ADDRESS_KIND_INET) {
@@ -532,10 +531,7 @@ static void nbd_refresh_filename(BlockDriverState *bs, 
QDict *options)
                  "nbd://%s:%s", host, port);
     }

-    ov = qobject_output_visitor_new(&saddr_qdict);
-    visit_type_SocketAddress(ov, NULL, &s->saddr, &error_abort);
-    visit_complete(ov, &saddr_qdict);
-    visit_free(ov);
+    saddr_qdict = QAPI_TO_QOBJECT(SocketAddress, s->saddr, &error_abort);
     assert(qobject_type(saddr_qdict) == QTYPE_QDICT);

     qdict_put_obj(opts, "server", saddr_qdict);
-- 
2.7.4




reply via email to

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