mirror of https://gitee.com/openkylin/qemu.git
qapi: rename QmpInputVisitor to QObjectInputVisitor
The QmpInputVisitor has no direct dependency on QMP. It is valid to use it anywhere that one has a QObject. Rename it to better reflect its functionality as a generic QObject to QAPI converter. The previous commit renamed the files, this one renames C identifiers. Reviewed-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Message-Id: <1475246744-29302-5-git-send-email-berrange@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> [Straightforwardly rebased, split into file and identifier rename] Signed-off-by: Markus Armbruster <armbru@redhat.com>
This commit is contained in:
parent
b3db211f3c
commit
09e68369a8
|
@ -1024,7 +1024,7 @@ Example:
|
||||||
Visitor *v;
|
Visitor *v;
|
||||||
UserDefOneList *arg1 = NULL;
|
UserDefOneList *arg1 = NULL;
|
||||||
|
|
||||||
v = qmp_input_visitor_new(QOBJECT(args), true);
|
v = qobject_input_visitor_new(QOBJECT(args), true);
|
||||||
visit_start_struct(v, NULL, NULL, 0, &err);
|
visit_start_struct(v, NULL, NULL, 0, &err);
|
||||||
if (err) {
|
if (err) {
|
||||||
goto out;
|
goto out;
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
#include "qapi/visitor.h"
|
#include "qapi/visitor.h"
|
||||||
#include "qapi/qmp/qobject.h"
|
#include "qapi/qmp/qobject.h"
|
||||||
|
|
||||||
typedef struct QmpInputVisitor QmpInputVisitor;
|
typedef struct QObjectInputVisitor QObjectInputVisitor;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Return a new input visitor that converts a QObject to a QAPI object.
|
* Return a new input visitor that converts a QObject to a QAPI object.
|
||||||
|
@ -25,6 +25,6 @@ typedef struct QmpInputVisitor QmpInputVisitor;
|
||||||
* Set @strict to reject a parse that doesn't consume all keys of a
|
* Set @strict to reject a parse that doesn't consume all keys of a
|
||||||
* dictionary; otherwise excess input is ignored.
|
* dictionary; otherwise excess input is ignored.
|
||||||
*/
|
*/
|
||||||
Visitor *qmp_input_visitor_new(QObject *obj, bool strict);
|
Visitor *qobject_input_visitor_new(QObject *obj, bool strict);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -34,7 +34,7 @@ typedef struct StackObject
|
||||||
QSLIST_ENTRY(StackObject) node;
|
QSLIST_ENTRY(StackObject) node;
|
||||||
} StackObject;
|
} StackObject;
|
||||||
|
|
||||||
struct QmpInputVisitor
|
struct QObjectInputVisitor
|
||||||
{
|
{
|
||||||
Visitor visitor;
|
Visitor visitor;
|
||||||
|
|
||||||
|
@ -49,14 +49,14 @@ struct QmpInputVisitor
|
||||||
bool strict;
|
bool strict;
|
||||||
};
|
};
|
||||||
|
|
||||||
static QmpInputVisitor *to_qiv(Visitor *v)
|
static QObjectInputVisitor *to_qiv(Visitor *v)
|
||||||
{
|
{
|
||||||
return container_of(v, QmpInputVisitor, visitor);
|
return container_of(v, QObjectInputVisitor, visitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
static QObject *qmp_input_get_object(QmpInputVisitor *qiv,
|
static QObject *qobject_input_get_object(QObjectInputVisitor *qiv,
|
||||||
const char *name,
|
const char *name,
|
||||||
bool consume, Error **errp)
|
bool consume, Error **errp)
|
||||||
{
|
{
|
||||||
StackObject *tos;
|
StackObject *tos;
|
||||||
QObject *qobj;
|
QObject *qobj;
|
||||||
|
@ -102,8 +102,9 @@ static void qdict_add_key(const char *key, QObject *obj, void *opaque)
|
||||||
g_hash_table_insert(h, (gpointer) key, NULL);
|
g_hash_table_insert(h, (gpointer) key, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const QListEntry *qmp_input_push(QmpInputVisitor *qiv, QObject *obj,
|
static const QListEntry *qobject_input_push(QObjectInputVisitor *qiv,
|
||||||
void *qapi, Error **errp)
|
QObject *obj, void *qapi,
|
||||||
|
Error **errp)
|
||||||
{
|
{
|
||||||
GHashTable *h;
|
GHashTable *h;
|
||||||
StackObject *tos = g_new0(StackObject, 1);
|
StackObject *tos = g_new0(StackObject, 1);
|
||||||
|
@ -125,9 +126,9 @@ static const QListEntry *qmp_input_push(QmpInputVisitor *qiv, QObject *obj,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void qmp_input_check_struct(Visitor *v, Error **errp)
|
static void qobject_input_check_struct(Visitor *v, Error **errp)
|
||||||
{
|
{
|
||||||
QmpInputVisitor *qiv = to_qiv(v);
|
QObjectInputVisitor *qiv = to_qiv(v);
|
||||||
StackObject *tos = QSLIST_FIRST(&qiv->stack);
|
StackObject *tos = QSLIST_FIRST(&qiv->stack);
|
||||||
|
|
||||||
assert(tos && !tos->entry);
|
assert(tos && !tos->entry);
|
||||||
|
@ -145,7 +146,7 @@ static void qmp_input_check_struct(Visitor *v, Error **errp)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void qmp_input_stack_object_free(StackObject *tos)
|
static void qobject_input_stack_object_free(StackObject *tos)
|
||||||
{
|
{
|
||||||
if (tos->h) {
|
if (tos->h) {
|
||||||
g_hash_table_unref(tos->h);
|
g_hash_table_unref(tos->h);
|
||||||
|
@ -154,21 +155,21 @@ static void qmp_input_stack_object_free(StackObject *tos)
|
||||||
g_free(tos);
|
g_free(tos);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void qmp_input_pop(Visitor *v, void **obj)
|
static void qobject_input_pop(Visitor *v, void **obj)
|
||||||
{
|
{
|
||||||
QmpInputVisitor *qiv = to_qiv(v);
|
QObjectInputVisitor *qiv = to_qiv(v);
|
||||||
StackObject *tos = QSLIST_FIRST(&qiv->stack);
|
StackObject *tos = QSLIST_FIRST(&qiv->stack);
|
||||||
|
|
||||||
assert(tos && tos->qapi == obj);
|
assert(tos && tos->qapi == obj);
|
||||||
QSLIST_REMOVE_HEAD(&qiv->stack, node);
|
QSLIST_REMOVE_HEAD(&qiv->stack, node);
|
||||||
qmp_input_stack_object_free(tos);
|
qobject_input_stack_object_free(tos);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void qmp_input_start_struct(Visitor *v, const char *name, void **obj,
|
static void qobject_input_start_struct(Visitor *v, const char *name, void **obj,
|
||||||
size_t size, Error **errp)
|
size_t size, Error **errp)
|
||||||
{
|
{
|
||||||
QmpInputVisitor *qiv = to_qiv(v);
|
QObjectInputVisitor *qiv = to_qiv(v);
|
||||||
QObject *qobj = qmp_input_get_object(qiv, name, true, errp);
|
QObject *qobj = qobject_input_get_object(qiv, name, true, errp);
|
||||||
Error *err = NULL;
|
Error *err = NULL;
|
||||||
|
|
||||||
if (obj) {
|
if (obj) {
|
||||||
|
@ -183,7 +184,7 @@ static void qmp_input_start_struct(Visitor *v, const char *name, void **obj,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
qmp_input_push(qiv, qobj, obj, &err);
|
qobject_input_push(qiv, qobj, obj, &err);
|
||||||
if (err) {
|
if (err) {
|
||||||
error_propagate(errp, err);
|
error_propagate(errp, err);
|
||||||
return;
|
return;
|
||||||
|
@ -195,11 +196,12 @@ static void qmp_input_start_struct(Visitor *v, const char *name, void **obj,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void qmp_input_start_list(Visitor *v, const char *name,
|
static void qobject_input_start_list(Visitor *v, const char *name,
|
||||||
GenericList **list, size_t size, Error **errp)
|
GenericList **list, size_t size,
|
||||||
|
Error **errp)
|
||||||
{
|
{
|
||||||
QmpInputVisitor *qiv = to_qiv(v);
|
QObjectInputVisitor *qiv = to_qiv(v);
|
||||||
QObject *qobj = qmp_input_get_object(qiv, name, true, errp);
|
QObject *qobj = qobject_input_get_object(qiv, name, true, errp);
|
||||||
const QListEntry *entry;
|
const QListEntry *entry;
|
||||||
|
|
||||||
if (!qobj) {
|
if (!qobj) {
|
||||||
|
@ -214,7 +216,7 @@ static void qmp_input_start_list(Visitor *v, const char *name,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
entry = qmp_input_push(qiv, qobj, list, errp);
|
entry = qobject_input_push(qiv, qobj, list, errp);
|
||||||
if (list) {
|
if (list) {
|
||||||
if (entry) {
|
if (entry) {
|
||||||
*list = g_malloc0(size);
|
*list = g_malloc0(size);
|
||||||
|
@ -224,10 +226,10 @@ static void qmp_input_start_list(Visitor *v, const char *name,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static GenericList *qmp_input_next_list(Visitor *v, GenericList *tail,
|
static GenericList *qobject_input_next_list(Visitor *v, GenericList *tail,
|
||||||
size_t size)
|
size_t size)
|
||||||
{
|
{
|
||||||
QmpInputVisitor *qiv = to_qiv(v);
|
QObjectInputVisitor *qiv = to_qiv(v);
|
||||||
StackObject *so = QSLIST_FIRST(&qiv->stack);
|
StackObject *so = QSLIST_FIRST(&qiv->stack);
|
||||||
|
|
||||||
if (!so->entry) {
|
if (!so->entry) {
|
||||||
|
@ -238,12 +240,12 @@ static GenericList *qmp_input_next_list(Visitor *v, GenericList *tail,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void qmp_input_start_alternate(Visitor *v, const char *name,
|
static void qobject_input_start_alternate(Visitor *v, const char *name,
|
||||||
GenericAlternate **obj, size_t size,
|
GenericAlternate **obj, size_t size,
|
||||||
bool promote_int, Error **errp)
|
bool promote_int, Error **errp)
|
||||||
{
|
{
|
||||||
QmpInputVisitor *qiv = to_qiv(v);
|
QObjectInputVisitor *qiv = to_qiv(v);
|
||||||
QObject *qobj = qmp_input_get_object(qiv, name, false, errp);
|
QObject *qobj = qobject_input_get_object(qiv, name, false, errp);
|
||||||
|
|
||||||
if (!qobj) {
|
if (!qobj) {
|
||||||
*obj = NULL;
|
*obj = NULL;
|
||||||
|
@ -256,11 +258,11 @@ static void qmp_input_start_alternate(Visitor *v, const char *name,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void qmp_input_type_int64(Visitor *v, const char *name, int64_t *obj,
|
static void qobject_input_type_int64(Visitor *v, const char *name, int64_t *obj,
|
||||||
Error **errp)
|
Error **errp)
|
||||||
{
|
{
|
||||||
QmpInputVisitor *qiv = to_qiv(v);
|
QObjectInputVisitor *qiv = to_qiv(v);
|
||||||
QObject *qobj = qmp_input_get_object(qiv, name, true, errp);
|
QObject *qobj = qobject_input_get_object(qiv, name, true, errp);
|
||||||
QInt *qint;
|
QInt *qint;
|
||||||
|
|
||||||
if (!qobj) {
|
if (!qobj) {
|
||||||
|
@ -276,12 +278,12 @@ static void qmp_input_type_int64(Visitor *v, const char *name, int64_t *obj,
|
||||||
*obj = qint_get_int(qint);
|
*obj = qint_get_int(qint);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void qmp_input_type_uint64(Visitor *v, const char *name, uint64_t *obj,
|
static void qobject_input_type_uint64(Visitor *v, const char *name,
|
||||||
Error **errp)
|
uint64_t *obj, Error **errp)
|
||||||
{
|
{
|
||||||
/* FIXME: qobject_to_qint mishandles values over INT64_MAX */
|
/* FIXME: qobject_to_qint mishandles values over INT64_MAX */
|
||||||
QmpInputVisitor *qiv = to_qiv(v);
|
QObjectInputVisitor *qiv = to_qiv(v);
|
||||||
QObject *qobj = qmp_input_get_object(qiv, name, true, errp);
|
QObject *qobj = qobject_input_get_object(qiv, name, true, errp);
|
||||||
QInt *qint;
|
QInt *qint;
|
||||||
|
|
||||||
if (!qobj) {
|
if (!qobj) {
|
||||||
|
@ -297,11 +299,11 @@ static void qmp_input_type_uint64(Visitor *v, const char *name, uint64_t *obj,
|
||||||
*obj = qint_get_int(qint);
|
*obj = qint_get_int(qint);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void qmp_input_type_bool(Visitor *v, const char *name, bool *obj,
|
static void qobject_input_type_bool(Visitor *v, const char *name, bool *obj,
|
||||||
Error **errp)
|
Error **errp)
|
||||||
{
|
{
|
||||||
QmpInputVisitor *qiv = to_qiv(v);
|
QObjectInputVisitor *qiv = to_qiv(v);
|
||||||
QObject *qobj = qmp_input_get_object(qiv, name, true, errp);
|
QObject *qobj = qobject_input_get_object(qiv, name, true, errp);
|
||||||
QBool *qbool;
|
QBool *qbool;
|
||||||
|
|
||||||
if (!qobj) {
|
if (!qobj) {
|
||||||
|
@ -317,11 +319,11 @@ static void qmp_input_type_bool(Visitor *v, const char *name, bool *obj,
|
||||||
*obj = qbool_get_bool(qbool);
|
*obj = qbool_get_bool(qbool);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void qmp_input_type_str(Visitor *v, const char *name, char **obj,
|
static void qobject_input_type_str(Visitor *v, const char *name, char **obj,
|
||||||
Error **errp)
|
Error **errp)
|
||||||
{
|
{
|
||||||
QmpInputVisitor *qiv = to_qiv(v);
|
QObjectInputVisitor *qiv = to_qiv(v);
|
||||||
QObject *qobj = qmp_input_get_object(qiv, name, true, errp);
|
QObject *qobj = qobject_input_get_object(qiv, name, true, errp);
|
||||||
QString *qstr;
|
QString *qstr;
|
||||||
|
|
||||||
*obj = NULL;
|
*obj = NULL;
|
||||||
|
@ -338,11 +340,11 @@ static void qmp_input_type_str(Visitor *v, const char *name, char **obj,
|
||||||
*obj = g_strdup(qstring_get_str(qstr));
|
*obj = g_strdup(qstring_get_str(qstr));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void qmp_input_type_number(Visitor *v, const char *name, double *obj,
|
static void qobject_input_type_number(Visitor *v, const char *name, double *obj,
|
||||||
Error **errp)
|
Error **errp)
|
||||||
{
|
{
|
||||||
QmpInputVisitor *qiv = to_qiv(v);
|
QObjectInputVisitor *qiv = to_qiv(v);
|
||||||
QObject *qobj = qmp_input_get_object(qiv, name, true, errp);
|
QObject *qobj = qobject_input_get_object(qiv, name, true, errp);
|
||||||
QInt *qint;
|
QInt *qint;
|
||||||
QFloat *qfloat;
|
QFloat *qfloat;
|
||||||
|
|
||||||
|
@ -365,11 +367,11 @@ static void qmp_input_type_number(Visitor *v, const char *name, double *obj,
|
||||||
"number");
|
"number");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void qmp_input_type_any(Visitor *v, const char *name, QObject **obj,
|
static void qobject_input_type_any(Visitor *v, const char *name, QObject **obj,
|
||||||
Error **errp)
|
Error **errp)
|
||||||
{
|
{
|
||||||
QmpInputVisitor *qiv = to_qiv(v);
|
QObjectInputVisitor *qiv = to_qiv(v);
|
||||||
QObject *qobj = qmp_input_get_object(qiv, name, true, errp);
|
QObject *qobj = qobject_input_get_object(qiv, name, true, errp);
|
||||||
|
|
||||||
*obj = NULL;
|
*obj = NULL;
|
||||||
if (!qobj) {
|
if (!qobj) {
|
||||||
|
@ -380,10 +382,10 @@ static void qmp_input_type_any(Visitor *v, const char *name, QObject **obj,
|
||||||
*obj = qobj;
|
*obj = qobj;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void qmp_input_type_null(Visitor *v, const char *name, Error **errp)
|
static void qobject_input_type_null(Visitor *v, const char *name, Error **errp)
|
||||||
{
|
{
|
||||||
QmpInputVisitor *qiv = to_qiv(v);
|
QObjectInputVisitor *qiv = to_qiv(v);
|
||||||
QObject *qobj = qmp_input_get_object(qiv, name, true, errp);
|
QObject *qobj = qobject_input_get_object(qiv, name, true, errp);
|
||||||
|
|
||||||
if (!qobj) {
|
if (!qobj) {
|
||||||
return;
|
return;
|
||||||
|
@ -395,10 +397,10 @@ static void qmp_input_type_null(Visitor *v, const char *name, Error **errp)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void qmp_input_optional(Visitor *v, const char *name, bool *present)
|
static void qobject_input_optional(Visitor *v, const char *name, bool *present)
|
||||||
{
|
{
|
||||||
QmpInputVisitor *qiv = to_qiv(v);
|
QObjectInputVisitor *qiv = to_qiv(v);
|
||||||
QObject *qobj = qmp_input_get_object(qiv, name, false, NULL);
|
QObject *qobj = qobject_input_get_object(qiv, name, false, NULL);
|
||||||
|
|
||||||
if (!qobj) {
|
if (!qobj) {
|
||||||
*present = false;
|
*present = false;
|
||||||
|
@ -408,44 +410,44 @@ static void qmp_input_optional(Visitor *v, const char *name, bool *present)
|
||||||
*present = true;
|
*present = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void qmp_input_free(Visitor *v)
|
static void qobject_input_free(Visitor *v)
|
||||||
{
|
{
|
||||||
QmpInputVisitor *qiv = to_qiv(v);
|
QObjectInputVisitor *qiv = to_qiv(v);
|
||||||
while (!QSLIST_EMPTY(&qiv->stack)) {
|
while (!QSLIST_EMPTY(&qiv->stack)) {
|
||||||
StackObject *tos = QSLIST_FIRST(&qiv->stack);
|
StackObject *tos = QSLIST_FIRST(&qiv->stack);
|
||||||
|
|
||||||
QSLIST_REMOVE_HEAD(&qiv->stack, node);
|
QSLIST_REMOVE_HEAD(&qiv->stack, node);
|
||||||
qmp_input_stack_object_free(tos);
|
qobject_input_stack_object_free(tos);
|
||||||
}
|
}
|
||||||
|
|
||||||
qobject_decref(qiv->root);
|
qobject_decref(qiv->root);
|
||||||
g_free(qiv);
|
g_free(qiv);
|
||||||
}
|
}
|
||||||
|
|
||||||
Visitor *qmp_input_visitor_new(QObject *obj, bool strict)
|
Visitor *qobject_input_visitor_new(QObject *obj, bool strict)
|
||||||
{
|
{
|
||||||
QmpInputVisitor *v;
|
QObjectInputVisitor *v;
|
||||||
|
|
||||||
assert(obj);
|
assert(obj);
|
||||||
v = g_malloc0(sizeof(*v));
|
v = g_malloc0(sizeof(*v));
|
||||||
|
|
||||||
v->visitor.type = VISITOR_INPUT;
|
v->visitor.type = VISITOR_INPUT;
|
||||||
v->visitor.start_struct = qmp_input_start_struct;
|
v->visitor.start_struct = qobject_input_start_struct;
|
||||||
v->visitor.check_struct = qmp_input_check_struct;
|
v->visitor.check_struct = qobject_input_check_struct;
|
||||||
v->visitor.end_struct = qmp_input_pop;
|
v->visitor.end_struct = qobject_input_pop;
|
||||||
v->visitor.start_list = qmp_input_start_list;
|
v->visitor.start_list = qobject_input_start_list;
|
||||||
v->visitor.next_list = qmp_input_next_list;
|
v->visitor.next_list = qobject_input_next_list;
|
||||||
v->visitor.end_list = qmp_input_pop;
|
v->visitor.end_list = qobject_input_pop;
|
||||||
v->visitor.start_alternate = qmp_input_start_alternate;
|
v->visitor.start_alternate = qobject_input_start_alternate;
|
||||||
v->visitor.type_int64 = qmp_input_type_int64;
|
v->visitor.type_int64 = qobject_input_type_int64;
|
||||||
v->visitor.type_uint64 = qmp_input_type_uint64;
|
v->visitor.type_uint64 = qobject_input_type_uint64;
|
||||||
v->visitor.type_bool = qmp_input_type_bool;
|
v->visitor.type_bool = qobject_input_type_bool;
|
||||||
v->visitor.type_str = qmp_input_type_str;
|
v->visitor.type_str = qobject_input_type_str;
|
||||||
v->visitor.type_number = qmp_input_type_number;
|
v->visitor.type_number = qobject_input_type_number;
|
||||||
v->visitor.type_any = qmp_input_type_any;
|
v->visitor.type_any = qobject_input_type_any;
|
||||||
v->visitor.type_null = qmp_input_type_null;
|
v->visitor.type_null = qobject_input_type_null;
|
||||||
v->visitor.optional = qmp_input_optional;
|
v->visitor.optional = qobject_input_optional;
|
||||||
v->visitor.free = qmp_input_free;
|
v->visitor.free = qobject_input_free;
|
||||||
v->strict = strict;
|
v->strict = strict;
|
||||||
|
|
||||||
v->root = obj;
|
v->root = obj;
|
||||||
|
|
2
qmp.c
2
qmp.c
|
@ -675,7 +675,7 @@ void qmp_object_add(const char *type, const char *id,
|
||||||
pdict = qdict_new();
|
pdict = qdict_new();
|
||||||
}
|
}
|
||||||
|
|
||||||
v = qmp_input_visitor_new(QOBJECT(pdict), true);
|
v = qobject_input_visitor_new(QOBJECT(pdict), true);
|
||||||
obj = user_creatable_add_type(type, id, pdict, v, errp);
|
obj = user_creatable_add_type(type, id, pdict, v, errp);
|
||||||
visit_free(v);
|
visit_free(v);
|
||||||
if (obj) {
|
if (obj) {
|
||||||
|
|
|
@ -23,7 +23,7 @@ void object_property_set_qobject(Object *obj, QObject *value,
|
||||||
{
|
{
|
||||||
Visitor *v;
|
Visitor *v;
|
||||||
/* TODO: Should we reject, rather than ignore, excess input? */
|
/* TODO: Should we reject, rather than ignore, excess input? */
|
||||||
v = qmp_input_visitor_new(value, false);
|
v = qobject_input_visitor_new(value, false);
|
||||||
object_property_set(obj, v, name, errp);
|
object_property_set(obj, v, name, errp);
|
||||||
visit_free(v);
|
visit_free(v);
|
||||||
}
|
}
|
||||||
|
|
|
@ -130,7 +130,7 @@ def gen_marshal(name, arg_type, boxed, ret_type):
|
||||||
push_indent()
|
push_indent()
|
||||||
|
|
||||||
ret += mcgen('''
|
ret += mcgen('''
|
||||||
v = qmp_input_visitor_new(QOBJECT(args), true);
|
v = qobject_input_visitor_new(QOBJECT(args), true);
|
||||||
visit_start_struct(v, NULL, NULL, 0, &err);
|
visit_start_struct(v, NULL, NULL, 0, &err);
|
||||||
if (err) {
|
if (err) {
|
||||||
goto out;
|
goto out;
|
||||||
|
|
|
@ -345,7 +345,7 @@ static void cpu_model_from_info(S390CPUModel *model, const CpuModelInfo *info,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (qdict) {
|
if (qdict) {
|
||||||
visitor = qmp_input_visitor_new(info->props, true);
|
visitor = qobject_input_visitor_new(info->props, true);
|
||||||
visit_start_struct(visitor, NULL, NULL, 0, errp);
|
visit_start_struct(visitor, NULL, NULL, 0, errp);
|
||||||
if (*errp) {
|
if (*errp) {
|
||||||
object_unref(obj);
|
object_unref(obj);
|
||||||
|
|
|
@ -47,7 +47,7 @@ static void qnull_visit_test(void)
|
||||||
|
|
||||||
g_assert(qnull_.refcnt == 1);
|
g_assert(qnull_.refcnt == 1);
|
||||||
obj = qnull();
|
obj = qnull();
|
||||||
v = qmp_input_visitor_new(obj, true);
|
v = qobject_input_visitor_new(obj, true);
|
||||||
qobject_decref(obj);
|
qobject_decref(obj);
|
||||||
visit_type_null(v, NULL, &error_abort);
|
visit_type_null(v, NULL, &error_abort);
|
||||||
visit_free(v);
|
visit_free(v);
|
||||||
|
|
|
@ -244,7 +244,7 @@ static void test_dealloc_partial(void)
|
||||||
ud2_dict = qdict_new();
|
ud2_dict = qdict_new();
|
||||||
qdict_put_obj(ud2_dict, "string0", QOBJECT(qstring_from_str(text)));
|
qdict_put_obj(ud2_dict, "string0", QOBJECT(qstring_from_str(text)));
|
||||||
|
|
||||||
v = qmp_input_visitor_new(QOBJECT(ud2_dict), true);
|
v = qobject_input_visitor_new(QOBJECT(ud2_dict), true);
|
||||||
visit_type_UserDefTwo(v, NULL, &ud2, &err);
|
visit_type_UserDefTwo(v, NULL, &ud2, &err);
|
||||||
visit_free(v);
|
visit_free(v);
|
||||||
QDECREF(ud2_dict);
|
QDECREF(ud2_dict);
|
||||||
|
|
|
@ -53,7 +53,7 @@ static Visitor *validate_test_init_internal(TestInputVisitorData *data,
|
||||||
data->obj = qobject_from_jsonv(json_string, ap);
|
data->obj = qobject_from_jsonv(json_string, ap);
|
||||||
g_assert(data->obj);
|
g_assert(data->obj);
|
||||||
|
|
||||||
data->qiv = qmp_input_visitor_new(data->obj, true);
|
data->qiv = qobject_input_visitor_new(data->obj, true);
|
||||||
g_assert(data->qiv);
|
g_assert(data->qiv);
|
||||||
return data->qiv;
|
return data->qiv;
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,7 @@ static Visitor *visitor_input_test_init_internal(TestInputVisitorData *data,
|
||||||
data->obj = qobject_from_jsonv(json_string, ap);
|
data->obj = qobject_from_jsonv(json_string, ap);
|
||||||
g_assert(data->obj);
|
g_assert(data->obj);
|
||||||
|
|
||||||
data->qiv = qmp_input_visitor_new(data->obj, false);
|
data->qiv = qobject_input_visitor_new(data->obj, false);
|
||||||
g_assert(data->qiv);
|
g_assert(data->qiv);
|
||||||
return data->qiv;
|
return data->qiv;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1040,7 +1040,7 @@ static void qmp_deserialize(void **native_out, void *datap,
|
||||||
obj = qobject_from_json(qstring_get_str(output_json));
|
obj = qobject_from_json(qstring_get_str(output_json));
|
||||||
|
|
||||||
QDECREF(output_json);
|
QDECREF(output_json);
|
||||||
d->qiv = qmp_input_visitor_new(obj, true);
|
d->qiv = qobject_input_visitor_new(obj, true);
|
||||||
qobject_decref(obj_orig);
|
qobject_decref(obj_orig);
|
||||||
qobject_decref(obj);
|
qobject_decref(obj);
|
||||||
visit(d->qiv, native_out, errp);
|
visit(d->qiv, native_out, errp);
|
||||||
|
|
Loading…
Reference in New Issue