提交 337283df 编写于 作者: E Eric Blake 提交者: Markus Armbruster

qapi: Drop unused 'kind' for struct/enum visit

visit_start_struct() and visit_type_enum() had a 'kind' argument
that was usually set to either the stringized version of the
corresponding qapi type name, or to NULL (although some clients
didn't even get that right).  But nothing ever used the argument.
It's even hard to argue that it would be useful in a debugger,
as a stack backtrace also tells which type is being visited.

Therefore, drop the 'kind' argument as dead.
Signed-off-by: NEric Blake <eblake@redhat.com>
Reviewed-by: NMarc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <1454075341-13658-22-git-send-email-eblake@redhat.com>
[Harmless rebase mistake cleaned up]
Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
上级 0b2a0d6b
......@@ -1670,7 +1670,7 @@ void hmp_object_add(Monitor *mon, const QDict *qdict)
pdict = qdict_clone_shallow(qdict);
v = opts_get_visitor(ov);
visit_start_struct(v, NULL, NULL, NULL, 0, &err);
visit_start_struct(v, NULL, NULL, 0, &err);
if (err) {
goto out_clean;
}
......
......@@ -49,8 +49,7 @@ static void get_enum(Object *obj, Visitor *v, const char *name, void *opaque,
Property *prop = opaque;
int *ptr = qdev_get_prop_ptr(dev, prop);
visit_type_enum(v, prop->name, ptr, prop->info->enum_table,
prop->info->name, errp);
visit_type_enum(v, prop->name, ptr, prop->info->enum_table, errp);
}
static void set_enum(Object *obj, Visitor *v, const char *name, void *opaque,
......@@ -65,8 +64,7 @@ static void set_enum(Object *obj, Visitor *v, const char *name, void *opaque,
return;
}
visit_type_enum(v, prop->name, ptr, prop->info->enum_table,
prop->info->name, errp);
visit_type_enum(v, prop->name, ptr, prop->info->enum_table, errp);
}
/* Bit */
......
......@@ -260,7 +260,7 @@ static void prop_get_fdt(Object *obj, Visitor *v, const char *name,
void *fdt;
if (!drc->fdt) {
visit_start_struct(v, name, NULL, NULL, 0, &err);
visit_start_struct(v, name, NULL, 0, &err);
if (!err) {
visit_end_struct(v, &err);
}
......@@ -283,7 +283,7 @@ static void prop_get_fdt(Object *obj, Visitor *v, const char *name,
case FDT_BEGIN_NODE:
fdt_depth++;
name = fdt_get_name(fdt, fdt_offset, &name_len);
visit_start_struct(v, name, NULL, NULL, 0, &err);
visit_start_struct(v, name, NULL, 0, &err);
if (err) {
error_propagate(errp, err);
return;
......
......@@ -120,7 +120,7 @@ static void balloon_stats_get_all(Object *obj, Visitor *v, const char *name,
VirtIOBalloon *s = opaque;
int i;
visit_start_struct(v, name, NULL, "guest-stats", 0, &err);
visit_start_struct(v, name, NULL, 0, &err);
if (err) {
goto out;
}
......@@ -129,7 +129,7 @@ static void balloon_stats_get_all(Object *obj, Visitor *v, const char *name,
goto out_end;
}
visit_start_struct(v, "stats", NULL, NULL, 0, &err);
visit_start_struct(v, "stats", NULL, 0, &err);
if (err) {
goto out_end;
}
......
......@@ -19,7 +19,7 @@ struct Visitor
{
/* Must be set */
void (*start_struct)(Visitor *v, const char *name, void **obj,
const char *kind, size_t size, Error **errp);
size_t size, Error **errp);
void (*end_struct)(Visitor *v, Error **errp);
void (*start_implicit_struct)(Visitor *v, void **obj, size_t size,
......@@ -31,8 +31,7 @@ struct Visitor
void (*end_list)(Visitor *v, Error **errp);
void (*type_enum)(Visitor *v, const char *name, int *obj,
const char *const strings[], const char *kind,
Error **errp);
const char *const strings[], Error **errp);
/* May be NULL; only needed for input visitors. */
void (*get_next_type)(Visitor *v, const char *name, QType *type,
bool promote_int, Error **errp);
......@@ -61,10 +60,8 @@ struct Visitor
};
void input_type_enum(Visitor *v, const char *name, int *obj,
const char *const strings[], const char *kind,
Error **errp);
const char *const strings[], Error **errp);
void output_type_enum(Visitor *v, const char *name, int *obj,
const char *const strings[], const char *kind,
Error **errp);
const char *const strings[], Error **errp);
#endif
......@@ -28,7 +28,7 @@ typedef struct GenericList
} GenericList;
void visit_start_struct(Visitor *v, const char *name, void **obj,
const char *kind, size_t size, Error **errp);
size_t size, Error **errp);
void visit_end_struct(Visitor *v, Error **errp);
void visit_start_implicit_struct(Visitor *v, void **obj, size_t size,
Error **errp);
......@@ -54,8 +54,7 @@ bool visit_optional(Visitor *v, const char *name, bool *present);
void visit_get_next_type(Visitor *v, const char *name, QType *type,
bool promote_int, Error **errp);
void visit_type_enum(Visitor *v, const char *name, int *obj,
const char *const strings[], const char *kind,
Error **errp);
const char *const strings[], Error **errp);
void visit_type_int(Visitor *v, const char *name, int64_t *obj, Error **errp);
void visit_type_uint8(Visitor *v, const char *name, uint8_t *obj,
Error **errp);
......
......@@ -125,7 +125,7 @@ opts_visitor_insert(GHashTable *unprocessed_opts, const QemuOpt *opt)
static void
opts_start_struct(Visitor *v, const char *name, void **obj, const char *kind,
opts_start_struct(Visitor *v, const char *name, void **obj,
size_t size, Error **errp)
{
OptsVisitor *ov = to_ov(v);
......
......@@ -60,8 +60,7 @@ static void *qapi_dealloc_pop(QapiDeallocVisitor *qov)
}
static void qapi_dealloc_start_struct(Visitor *v, const char *name, void **obj,
const char *kind, size_t unused,
Error **errp)
size_t unused, Error **errp)
{
QapiDeallocVisitor *qov = to_qov(v);
qapi_dealloc_push(qov, obj);
......@@ -165,8 +164,7 @@ static void qapi_dealloc_type_anything(Visitor *v, const char *name,
}
static void qapi_dealloc_type_enum(Visitor *v, const char *name, int *obj,
const char * const strings[],
const char *kind, Error **errp)
const char * const strings[], Error **errp)
{
}
......
......@@ -20,9 +20,9 @@
#include "qapi/visitor-impl.h"
void visit_start_struct(Visitor *v, const char *name, void **obj,
const char *kind, size_t size, Error **errp)
size_t size, Error **errp)
{
v->start_struct(v, name, obj, kind, size, errp);
v->start_struct(v, name, obj, size, errp);
}
void visit_end_struct(Visitor *v, Error **errp)
......@@ -85,10 +85,9 @@ void visit_get_next_type(Visitor *v, const char *name, QType *type,
}
void visit_type_enum(Visitor *v, const char *name, int *obj,
const char *const strings[], const char *kind,
Error **errp)
const char *const strings[], Error **errp)
{
v->type_enum(v, name, obj, strings, kind, errp);
v->type_enum(v, name, obj, strings, errp);
}
void visit_type_int(Visitor *v, const char *name, int64_t *obj, Error **errp)
......@@ -222,8 +221,7 @@ void visit_type_any(Visitor *v, const char *name, QObject **obj, Error **errp)
}
void output_type_enum(Visitor *v, const char *name, int *obj,
const char *const strings[], const char *kind,
Error **errp)
const char *const strings[], Error **errp)
{
int i = 0;
int value = *obj;
......@@ -241,8 +239,7 @@ void output_type_enum(Visitor *v, const char *name, int *obj,
}
void input_type_enum(Visitor *v, const char *name, int *obj,
const char *const strings[], const char *kind,
Error **errp)
const char *const strings[], Error **errp)
{
Error *local_err = NULL;
int64_t value = 0;
......
......@@ -116,7 +116,7 @@ static void qmp_input_pop(QmpInputVisitor *qiv, Error **errp)
}
static void qmp_input_start_struct(Visitor *v, const char *name, void **obj,
const char *kind, size_t size, Error **errp)
size_t size, Error **errp)
{
QmpInputVisitor *qiv = to_qiv(v);
QObject *qobj = qmp_input_get_object(qiv, name, true);
......
......@@ -112,8 +112,7 @@ static void qmp_output_add_obj(QmpOutputVisitor *qov, const char *name,
}
static void qmp_output_start_struct(Visitor *v, const char *name, void **obj,
const char *kind, size_t unused,
Error **errp)
size_t unused, Error **errp)
{
QmpOutputVisitor *qov = to_qov(v);
QDict *dict = qdict_new();
......
......@@ -1245,7 +1245,7 @@ int object_property_get_enum(Object *obj, const char *name,
siv = string_input_visitor_new(str);
string_output_visitor_cleanup(sov);
visit_type_enum(string_input_get_visitor(siv), name, &ret,
enumprop->strings, NULL, errp);
enumprop->strings, errp);
g_free(str);
string_input_visitor_cleanup(siv);
......@@ -1916,7 +1916,7 @@ static void property_get_enum(Object *obj, Visitor *v, const char *name,
return;
}
visit_type_enum(v, name, &value, prop->strings, NULL, errp);
visit_type_enum(v, name, &value, prop->strings, errp);
}
static void property_set_enum(Object *obj, Visitor *v, const char *name,
......@@ -1926,7 +1926,7 @@ static void property_set_enum(Object *obj, Visitor *v, const char *name,
int value;
Error *err = NULL;
visit_type_enum(v, name, &value, prop->strings, NULL, &err);
visit_type_enum(v, name, &value, prop->strings, &err);
if (err) {
error_propagate(errp, err);
return;
......@@ -2007,7 +2007,7 @@ static void property_get_tm(Object *obj, Visitor *v, const char *name,
goto out;
}
visit_start_struct(v, name, NULL, "struct tm", 0, &err);
visit_start_struct(v, name, NULL, 0, &err);
if (err) {
goto out;
}
......
......@@ -63,7 +63,7 @@ def gen_event_send(name, arg_type):
qov = qmp_output_visitor_new();
v = qmp_output_get_visitor(qov);
visit_start_struct(v, "%(name)s", NULL, NULL, 0, &err);
visit_start_struct(v, "%(name)s", NULL, 0, &err);
''',
name=name)
ret += gen_err_check()
......
......@@ -122,7 +122,7 @@ void visit_type_%(c_name)s(Visitor *v, const char *name, %(c_name)s **obj, Error
{
Error *err = NULL;
visit_start_struct(v, name, (void **)obj, "%(name)s", sizeof(%(c_name)s), &err);
visit_start_struct(v, name, (void **)obj, sizeof(%(c_name)s), &err);
if (err) {
goto out;
}
......@@ -138,7 +138,7 @@ out:
error_propagate(errp, err);
}
''',
name=name, c_name=c_name(name))
c_name=c_name(name))
return ret
......@@ -183,11 +183,11 @@ def gen_visit_enum(name):
void visit_type_%(c_name)s(Visitor *v, const char *name, %(c_name)s *obj, Error **errp)
{
int value = *obj;
visit_type_enum(v, name, &value, %(c_name)s_lookup, "%(name)s", errp);
visit_type_enum(v, name, &value, %(c_name)s_lookup, errp);
*obj = value;
}
''',
c_name=c_name(name), name=name)
c_name=c_name(name))
def gen_visit_alternate(name, variants):
......@@ -259,7 +259,7 @@ void visit_type_%(c_name)s(Visitor *v, const char *name, %(c_name)s **obj, Error
{
Error *err = NULL;
visit_start_struct(v, name, (void **)obj, "%(name)s", sizeof(%(c_name)s), &err);
visit_start_struct(v, name, (void **)obj, sizeof(%(c_name)s), &err);
if (err) {
goto out;
}
......@@ -267,7 +267,7 @@ void visit_type_%(c_name)s(Visitor *v, const char *name, %(c_name)s **obj, Error
goto out_obj;
}
''',
c_name=c_name(name), name=name)
c_name=c_name(name))
if base:
ret += mcgen('''
......
......@@ -2831,7 +2831,7 @@ static int object_create(void *opaque, QemuOpts *opts, Error **errp)
pdict = qemu_opts_to_qdict(opts, NULL);
v = opts_get_visitor(ov);
visit_start_struct(v, NULL, NULL, NULL, 0, &err);
visit_start_struct(v, NULL, NULL, 0, &err);
if (err) {
goto out;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册