From patchwork Wed Jul 6 09:14:06 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Armbruster X-Patchwork-Id: 9215875 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id ACD5D607D9 for ; Wed, 6 Jul 2016 09:31:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9DABD287C4 for ; Wed, 6 Jul 2016 09:31:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 925E5287C6; Wed, 6 Jul 2016 09:31:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 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.wl.linuxfoundation.org (Postfix) with ESMTPS id 453BC287C4 for ; Wed, 6 Jul 2016 09:31:06 +0000 (UTC) Received: from localhost ([::1]:60486 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bKjAf-0001b4-BU for patchwork-qemu-devel@patchwork.kernel.org; Wed, 06 Jul 2016 05:31:05 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51281) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bKiuP-00076t-4s for qemu-devel@nongnu.org; Wed, 06 Jul 2016 05:14:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bKiuN-0000Tj-I1 for qemu-devel@nongnu.org; Wed, 06 Jul 2016 05:14:16 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49814) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bKiuN-0000TQ-BG for qemu-devel@nongnu.org; Wed, 06 Jul 2016 05:14:15 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (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 084C780082 for ; Wed, 6 Jul 2016 09:14:15 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-116-37.ams2.redhat.com [10.36.116.37]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u669ECfl019768 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 6 Jul 2016 05:14:14 -0400 Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 99DB6110CE62; Wed, 6 Jul 2016 11:14:06 +0200 (CEST) From: Markus Armbruster To: qemu-devel@nongnu.org Date: Wed, 6 Jul 2016 11:14:06 +0200 Message-Id: <1467796446-25446-16-git-send-email-armbru@redhat.com> In-Reply-To: <1467796446-25446-1-git-send-email-armbru@redhat.com> References: <1467796446-25446-1-git-send-email-armbru@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Wed, 06 Jul 2016 09:14:15 +0000 (UTC) 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] [PULL 15/15] replay: 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: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Eric Blake 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 Message-Id: <1465490926-28625-16-git-send-email-eblake@redhat.com> Reviewed-by: Markus Armbruster Signed-off-by: Markus Armbruster --- replay/replay-input.c | 30 +++--------------------------- 1 file changed, 3 insertions(+), 27 deletions(-) diff --git a/replay/replay-input.c b/replay/replay-input.c index 296399c..bd93554 100644 --- a/replay/replay-input.c +++ b/replay/replay-input.c @@ -16,31 +16,7 @@ #include "replay-internal.h" #include "qemu/notify.h" #include "ui/input.h" -#include "qapi/qmp-output-visitor.h" -#include "qapi/qmp-input-visitor.h" -#include "qapi-visit.h" - -static InputEvent *qapi_clone_InputEvent(InputEvent *src) -{ - Visitor *ov, *iv; - QObject *obj; - InputEvent *dst = NULL; - - ov = qmp_output_visitor_new(&obj); - visit_type_InputEvent(ov, NULL, &src, &error_abort); - visit_complete(ov, &obj); - visit_free(ov); - if (!obj) { - return NULL; - } - - iv = qmp_input_visitor_new(obj, true); - visit_type_InputEvent(iv, NULL, &dst, &error_abort); - visit_free(iv); - qobject_decref(obj); - - return dst; -} +#include "qapi/clone-visitor.h" void replay_save_input_event(InputEvent *evt) { @@ -139,7 +115,7 @@ InputEvent *replay_read_input_event(void) break; } - return qapi_clone_InputEvent(&evt); + return QAPI_CLONE(InputEvent, &evt); } void replay_input_event(QemuConsole *src, InputEvent *evt) @@ -147,7 +123,7 @@ void replay_input_event(QemuConsole *src, InputEvent *evt) if (replay_mode == REPLAY_MODE_PLAY) { /* Nothing */ } else if (replay_mode == REPLAY_MODE_RECORD) { - replay_add_input_event(qapi_clone_InputEvent(evt)); + replay_add_input_event(QAPI_CLONE(InputEvent, evt)); } else { qemu_input_event_send_impl(src, evt); }