[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v3 17/18] replay: Use new QAPI cloning
From: |
Eric Blake |
Subject: |
[Qemu-devel] [PATCH v3 17/18] replay: Use new QAPI cloning |
Date: |
Thu, 28 Apr 2016 22:23:38 -0600 |
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 <address@hidden>
---
v3: new patch
---
replay/replay-input.c | 30 ++----------------------------
1 file changed, 2 insertions(+), 28 deletions(-)
diff --git a/replay/replay-input.c b/replay/replay-input.c
index 03e99d5..5a23d23 100644
--- a/replay/replay-input.c
+++ b/replay/replay-input.c
@@ -20,32 +20,6 @@
#include "qapi/qmp-input-visitor.h"
#include "qapi-visit.h"
-static InputEvent *qapi_clone_InputEvent(InputEvent *src)
-{
- QmpOutputVisitor *qov;
- QmpInputVisitor *qiv;
- Visitor *ov, *iv;
- QObject *obj;
- InputEvent *dst = NULL;
-
- qov = qmp_output_visitor_new();
- ov = qmp_output_get_visitor(qov);
- visit_type_InputEvent(ov, NULL, &src, &error_abort);
- obj = qmp_output_get_qobject(qov);
- qmp_output_visitor_cleanup(qov);
- if (!obj) {
- return NULL;
- }
-
- qiv = qmp_input_visitor_new(obj, true);
- iv = qmp_input_get_visitor(qiv);
- visit_type_InputEvent(iv, NULL, &dst, &error_abort);
- qmp_input_visitor_cleanup(qiv);
- qobject_decref(obj);
-
- return dst;
-}
-
void replay_save_input_event(InputEvent *evt)
{
InputKeyEvent *key;
@@ -143,7 +117,7 @@ InputEvent *replay_read_input_event(void)
break;
}
- return qapi_clone_InputEvent(&evt);
+ return qapi_InputEvent_clone(&evt);
}
void replay_input_event(QemuConsole *src, InputEvent *evt)
@@ -151,7 +125,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_InputEvent_clone(evt));
} else {
qemu_input_event_send_impl(src, evt);
}
--
2.5.5
- [Qemu-devel] [PATCH v3 11/18] qjson: Remove unused file, (continued)
- [Qemu-devel] [PATCH v3 11/18] qjson: Remove unused file, Eric Blake, 2016/04/29
- [Qemu-devel] [PATCH v3 16/18] sockets: Use new QAPI cloning, Eric Blake, 2016/04/29
- [Qemu-devel] [PATCH v3 04/18] qapi: Factor out JSON number formatting, Eric Blake, 2016/04/29
- [Qemu-devel] [PATCH v3 07/18] qapi: Add json output visitor, Eric Blake, 2016/04/29
- [Qemu-devel] [PATCH v3 10/18] vmstate: Use new JSON output visitor, Eric Blake, 2016/04/29
- [Qemu-devel] [PATCH v3 15/18] qapi: Add new clone visitor, Eric Blake, 2016/04/29
- [Qemu-devel] [PATCH v3 13/18] qapi: Support pretty printing in JSON output visitor, Eric Blake, 2016/04/29
- [Qemu-devel] [PATCH v3 14/18] qemu-img: Use new JSON output formatter, Eric Blake, 2016/04/29
- [Qemu-devel] [PATCH v3 12/18] qapi: Add qobject_to_json_pretty_prefix(), Eric Blake, 2016/04/29
- [Qemu-devel] [PATCH v3 17/18] replay: Use new QAPI cloning,
Eric Blake <=
- [Qemu-devel] [PATCH v3 18/18] qapi: Add parameter to visit_end_*, Eric Blake, 2016/04/29