diff options
Diffstat (limited to 'qapi/qmp-output-visitor.c')
-rw-r--r-- | qapi/qmp-output-visitor.c | 22 |
1 files changed, 2 insertions, 20 deletions
diff --git a/qapi/qmp-output-visitor.c b/qapi/qmp-output-visitor.c index f76d015..e0697b0 100644 --- a/qapi/qmp-output-visitor.c +++ b/qapi/qmp-output-visitor.c @@ -12,6 +12,7 @@ */ #include "qmp-output-visitor.h" +#include "qapi/qapi-visit-impl.h" #include "qemu-queue.h" #include "qemu-common.h" #include "qemu-objects.h" @@ -180,25 +181,6 @@ static void qmp_output_type_number(Visitor *v, double *obj, const char *name, qmp_output_add(qov, name, qfloat_from_double(*obj)); } -static void qmp_output_type_enum(Visitor *v, int *obj, const char *strings[], - const char *kind, const char *name, - Error **errp) -{ - int i = 0; - int value = *obj; - char *enum_str; - - assert(strings); - while (strings[i++] != NULL); - if (value < 0 || value >= i - 1) { - error_set(errp, QERR_INVALID_PARAMETER, name ? name : "null"); - return; - } - - enum_str = (char *)strings[value]; - qmp_output_type_str(v, &enum_str, name, errp); -} - QObject *qmp_output_get_qobject(QmpOutputVisitor *qov) { QObject *obj = qmp_output_first(qov); @@ -239,7 +221,7 @@ QmpOutputVisitor *qmp_output_visitor_new(void) v->visitor.start_list = qmp_output_start_list; v->visitor.next_list = qmp_output_next_list; v->visitor.end_list = qmp_output_end_list; - v->visitor.type_enum = qmp_output_type_enum; + v->visitor.type_enum = output_type_enum; v->visitor.type_int = qmp_output_type_int; v->visitor.type_bool = qmp_output_type_bool; v->visitor.type_str = qmp_output_type_str; |