1
2
3
4
5
6
7
8
9
10
11#ifndef QAPI_CLONE_VISITOR_H
12#define QAPI_CLONE_VISITOR_H
13
14#include "qapi/visitor.h"
15
16
17
18
19
20
21typedef struct QapiCloneVisitor QapiCloneVisitor;
22
23void *qapi_clone(const void *src, bool (*visit_type)(Visitor *, const char *,
24 void **, Error **));
25void qapi_clone_members(void *dst, const void *src, size_t sz,
26 bool (*visit_type_members)(Visitor *, void *,
27 Error **));
28
29
30
31
32
33
34
35#define QAPI_CLONE(type, src) \
36 ((type *)qapi_clone(src, \
37 (bool (*)(Visitor *, const char *, void **, \
38 Error **))visit_type_ ## type))
39
40
41
42
43
44
45
46#define QAPI_CLONE_MEMBERS(type, dst, src) \
47 qapi_clone_members(dst, src, sizeof(type), \
48 (bool (*)(Visitor *, void *, \
49 Error **))visit_type_ ## type ## _members)
50
51#endif
52