diff options
author | Eric Blake <eblake@redhat.com> | 2016-06-09 10:48:46 -0600 |
---|---|---|
committer | Markus Armbruster <armbru@redhat.com> | 2016-07-06 10:52:04 +0200 |
commit | b6954712abea03afd686b724060f9873e2c61f2b (patch) | |
tree | 0dba8d0da1944336cd7b9bb8d8f61efeab958b0e | |
parent | 37f9e0a2b65a6dd5fe09cb0023b8001014aaaf01 (diff) | |
download | qemu-b6954712abea03afd686b724060f9873e2c61f2b.zip qemu-b6954712abea03afd686b724060f9873e2c61f2b.tar.gz qemu-b6954712abea03afd686b724060f9873e2c61f2b.tar.bz2 |
replay: 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-16-git-send-email-eblake@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
-rw-r--r-- | replay/replay-input.c | 30 |
1 files 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); } |