diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/hw/qdev-core.h | 2 | ||||
-rw-r--r-- | include/qapi/util.h | 9 | ||||
-rw-r--r-- | include/qapi/visitor.h | 2 | ||||
-rw-r--r-- | include/qom/object.h | 4 |
4 files changed, 11 insertions, 6 deletions
diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h index ae31728..0891461 100644 --- a/include/hw/qdev-core.h +++ b/include/hw/qdev-core.h @@ -249,7 +249,7 @@ struct Property { struct PropertyInfo { const char *name; const char *description; - const char * const *enum_table; + const QEnumLookup *enum_table; int (*print)(DeviceState *dev, Property *prop, char *dest, size_t len); void (*set_default_value)(Object *obj, const Property *prop); void (*create)(Object *obj, Property *prop, Error **errp); diff --git a/include/qapi/util.h b/include/qapi/util.h index 5e50d0c..a7c3c64 100644 --- a/include/qapi/util.h +++ b/include/qapi/util.h @@ -11,8 +11,13 @@ #ifndef QAPI_UTIL_H #define QAPI_UTIL_H -const char *qapi_enum_lookup(const char *const lookup[], int val); -int qapi_enum_parse(const char * const lookup[], const char *buf, +typedef struct QEnumLookup { + const char *const *array; + int size; +} QEnumLookup; + +const char *qapi_enum_lookup(const QEnumLookup *lookup, int val); +int qapi_enum_parse(const QEnumLookup *lookup, const char *buf, int def, Error **errp); int parse_qapi_name(const char *name, bool complete); diff --git a/include/qapi/visitor.h b/include/qapi/visitor.h index 0f3b8cb..62a51a5 100644 --- a/include/qapi/visitor.h +++ b/include/qapi/visitor.h @@ -469,7 +469,7 @@ bool visit_optional(Visitor *v, const char *name, bool *present); * that visit_type_str() must have no unwelcome side effects. */ void visit_type_enum(Visitor *v, const char *name, int *obj, - const char *const strings[], Error **errp); + const QEnumLookup *lookup, Error **errp); /* * Check if visitor is an input visitor. diff --git a/include/qom/object.h b/include/qom/object.h index 1b82899..f3e5cff 100644 --- a/include/qom/object.h +++ b/include/qom/object.h @@ -1415,14 +1415,14 @@ void object_class_property_add_bool(ObjectClass *klass, const char *name, */ void object_property_add_enum(Object *obj, const char *name, const char *typename, - const char * const *strings, + const QEnumLookup *lookup, int (*get)(Object *, Error **), void (*set)(Object *, int, Error **), Error **errp); void object_class_property_add_enum(ObjectClass *klass, const char *name, const char *typename, - const char * const *strings, + const QEnumLookup *lookup, int (*get)(Object *, Error **), void (*set)(Object *, int, Error **), Error **errp); |