diff options
author | Peter Maydell | 2016-07-06 12:38:09 +0200 |
---|---|---|
committer | Peter Maydell | 2016-07-06 12:38:09 +0200 |
commit | 975b1c3ac6ae57b3e1356b0156c68f63a8a349dc (patch) | |
tree | ecd35419f10196800c44176645084c3691f660df /include/qapi/clone-visitor.h | |
parent | Merge remote-tracking branch 'remotes/afaerber/tags/qom-devices-for-peter' in... (diff) | |
parent | replay: Use new QAPI cloning (diff) | |
download | qemu-975b1c3ac6ae57b3e1356b0156c68f63a8a349dc.tar.gz qemu-975b1c3ac6ae57b3e1356b0156c68f63a8a349dc.tar.xz qemu-975b1c3ac6ae57b3e1356b0156c68f63a8a349dc.zip |
Merge remote-tracking branch 'remotes/armbru/tags/pull-qapi-2016-07-06' into staging
QAPI patches for 2016-07-06
# gpg: Signature made Wed 06 Jul 2016 10:00:51 BST
# gpg: using RSA key 0x3870B400EB918653
# gpg: Good signature from "Markus Armbruster <armbru@redhat.com>"
# gpg: aka "Markus Armbruster <armbru@pond.sub.org>"
# Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867 4E5F 3870 B400 EB91 8653
* remotes/armbru/tags/pull-qapi-2016-07-06:
replay: Use new QAPI cloning
sockets: Use new QAPI cloning
qapi: Add new clone visitor
qapi: Add new visit_complete() function
tests: Factor out common code in qapi output tests
tests: Clean up test-string-output-visitor
qmp-output-visitor: Favor new visit_free() function
string-output-visitor: Favor new visit_free() function
qmp-input-visitor: Favor new visit_free() function
string-input-visitor: Favor new visit_free() function
opts-visitor: Favor new visit_free() function
qapi: Add new visit_free() function
qapi: Add parameter to visit_end_*
qemu-img: Don't leak errors when outputting JSON
qapi: Improve use of qmp/types.h
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'include/qapi/clone-visitor.h')
-rw-r--r-- | include/qapi/clone-visitor.h | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/include/qapi/clone-visitor.h b/include/qapi/clone-visitor.h new file mode 100644 index 0000000000..b16177e1ee --- /dev/null +++ b/include/qapi/clone-visitor.h @@ -0,0 +1,39 @@ +/* + * Clone Visitor + * + * Copyright (C) 2016 Red Hat, Inc. + * + * This work is licensed under the terms of the GNU GPL, version 2 or later. + * See the COPYING file in the top-level directory. + * + */ + +#ifndef QAPI_CLONE_VISITOR_H +#define QAPI_CLONE_VISITOR_H + +#include "qemu/typedefs.h" +#include "qapi/visitor.h" +#include "qapi-visit.h" + +/* + * The clone visitor is for direct use only by the QAPI_CLONE() macro; + * it requires that the root visit occur on an object, list, or + * alternate, and is not usable directly on built-in QAPI types. + */ +typedef struct QapiCloneVisitor QapiCloneVisitor; + +void *qapi_clone(const void *src, void (*visit_type)(Visitor *, const char *, + void **, Error **)); + +/* + * Deep-clone QAPI object @src of the given @type, and return the result. + * + * Not usable on QAPI scalars (integers, strings, enums), nor on a + * QAPI object that references the 'any' type. Safe when @src is NULL. + */ +#define QAPI_CLONE(type, src) \ + ((type *)qapi_clone(src, \ + (void (*)(Visitor *, const char *, void**, \ + Error **))visit_type_ ## type)) + +#endif |