From patchwork Fri Apr 29 04:23:37 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Blake X-Patchwork-Id: 8977051 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 8BAD2BF29F for ; Fri, 29 Apr 2016 04:28:29 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 006302021A for ; Fri, 29 Apr 2016 04:28:29 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5104D20219 for ; Fri, 29 Apr 2016 04:28:28 +0000 (UTC) Received: from localhost ([::1]:52235 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aw02V-00081t-Jx for patchwork-qemu-devel@patchwork.kernel.org; Fri, 29 Apr 2016 00:28:27 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37853) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1avzy8-0007NT-JC for qemu-devel@nongnu.org; Fri, 29 Apr 2016 00:23:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1avzy6-0000v2-Ok for qemu-devel@nongnu.org; Fri, 29 Apr 2016 00:23:56 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42359) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1avzy6-0000ut-KJ for qemu-devel@nongnu.org; Fri, 29 Apr 2016 00:23:54 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 587838F515 for ; Fri, 29 Apr 2016 04:23:54 +0000 (UTC) Received: from red.redhat.com (ovpn-113-21.phx2.redhat.com [10.3.113.21]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u3T4NgfD016324; Fri, 29 Apr 2016 00:23:53 -0400 From: Eric Blake To: qemu-devel@nongnu.org Date: Thu, 28 Apr 2016 22:23:37 -0600 Message-Id: <1461903820-3092-17-git-send-email-eblake@redhat.com> In-Reply-To: <1461903820-3092-1-git-send-email-eblake@redhat.com> References: <1461903820-3092-1-git-send-email-eblake@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 16/18] sockets: Use new QAPI cloning X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , famz@redhat.com, armbru@redhat.com, Gerd Hoffmann Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Rather than rolling our own clone via an expensive conversion in and back out of QObject, use the generated QAPI version. Signed-off-by: Eric Blake --- v3: new patch --- util/qemu-sockets.c | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/util/qemu-sockets.c b/util/qemu-sockets.c index 2a2c524..6b70944 100644 --- a/util/qemu-sockets.c +++ b/util/qemu-sockets.c @@ -1129,25 +1129,5 @@ SocketAddress *socket_remote_address(int fd, Error **errp) void qapi_copy_SocketAddress(SocketAddress **p_dest, SocketAddress *src) { - QmpOutputVisitor *qov; - QmpInputVisitor *qiv; - Visitor *ov, *iv; - QObject *obj; - - *p_dest = NULL; - - qov = qmp_output_visitor_new(); - ov = qmp_output_get_visitor(qov); - visit_type_SocketAddress(ov, NULL, &src, &error_abort); - obj = qmp_output_get_qobject(qov); - qmp_output_visitor_cleanup(qov); - if (!obj) { - return; - } - - qiv = qmp_input_visitor_new(obj, true); - iv = qmp_input_get_visitor(qiv); - visit_type_SocketAddress(iv, NULL, p_dest, &error_abort); - qmp_input_visitor_cleanup(qiv); - qobject_decref(obj); + *p_dest = qapi_SocketAddress_clone(src); }