aboutsummaryrefslogtreecommitdiff
path: root/io
diff options
context:
space:
mode:
authorEric Blake <eblake@redhat.com>2016-06-09 10:48:45 -0600
committerMarkus Armbruster <armbru@redhat.com>2016-07-06 10:52:04 +0200
commit37f9e0a2b65a6dd5fe09cb0023b8001014aaaf01 (patch)
treed1fe710730adff2fa1c31449e380dbb38fad6ea6 /io
parenta15fcc3cf69ee3d408f60d6cc316488d2b0249b4 (diff)
sockets: Use new QAPI cloning
Rather than rolling our own clone via an expensive conversion in and back out of QObject, use the new clone visitor. Signed-off-by: Eric Blake <eblake@redhat.com> Message-Id: <1465490926-28625-15-git-send-email-eblake@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
Diffstat (limited to 'io')
-rw-r--r--io/channel-socket.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/io/channel-socket.c b/io/channel-socket.c
index 6ec87f8cdb..196a4f18f7 100644
--- a/io/channel-socket.c
+++ b/io/channel-socket.c
@@ -23,6 +23,7 @@
#include "io/channel-socket.h"
#include "io/channel-watch.h"
#include "trace.h"
+#include "qapi/clone-visitor.h"
#define SOCKET_MAX_FDS 16
@@ -189,7 +190,7 @@ void qio_channel_socket_connect_async(QIOChannelSocket *ioc,
OBJECT(ioc), callback, opaque, destroy);
SocketAddress *addrCopy;
- qapi_copy_SocketAddress(&addrCopy, addr);
+ addrCopy = QAPI_CLONE(SocketAddress, addr);
/* socket_connect() does a non-blocking connect(), but it
* still blocks in DNS lookups, so we must use a thread */
@@ -251,7 +252,7 @@ void qio_channel_socket_listen_async(QIOChannelSocket *ioc,
OBJECT(ioc), callback, opaque, destroy);
SocketAddress *addrCopy;
- qapi_copy_SocketAddress(&addrCopy, addr);
+ addrCopy = QAPI_CLONE(SocketAddress, addr);
/* socket_listen() blocks in DNS lookups, so we must use a thread */
trace_qio_channel_socket_listen_async(ioc, addr);
@@ -331,8 +332,8 @@ void qio_channel_socket_dgram_async(QIOChannelSocket *ioc,
struct QIOChannelSocketDGramWorkerData *data = g_new0(
struct QIOChannelSocketDGramWorkerData, 1);
- qapi_copy_SocketAddress(&data->localAddr, localAddr);
- qapi_copy_SocketAddress(&data->remoteAddr, remoteAddr);
+ data->localAddr = QAPI_CLONE(SocketAddress, localAddr);
+ data->remoteAddr = QAPI_CLONE(SocketAddress, remoteAddr);
trace_qio_channel_socket_dgram_async(ioc, localAddr, remoteAddr);
qio_task_run_in_thread(task,