提交 788b305c 编写于 作者: M Markus Armbruster

qapi: Convert indirect uses of FOO_lookup[...] to qapi_enum_lookup()

Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
Message-Id: <1503564371-26090-15-git-send-email-armbru@redhat.com>
Reviewed-by: NMarc-André Lureau <marcandre.lureau@redhat.com>
上级 977c736f
...@@ -72,7 +72,9 @@ static void set_enum(Object *obj, Visitor *v, const char *name, void *opaque, ...@@ -72,7 +72,9 @@ static void set_enum(Object *obj, Visitor *v, const char *name, void *opaque,
static void set_default_value_enum(Object *obj, const Property *prop) static void set_default_value_enum(Object *obj, const Property *prop)
{ {
object_property_set_str(obj, prop->info->enum_table[prop->defval.i], object_property_set_str(obj,
qapi_enum_lookup(prop->info->enum_table,
prop->defval.i),
prop->name, &error_abort); prop->name, &error_abort);
} }
...@@ -1095,7 +1097,8 @@ void qdev_prop_set_enum(DeviceState *dev, const char *name, int value) ...@@ -1095,7 +1097,8 @@ void qdev_prop_set_enum(DeviceState *dev, const char *name, int value)
Property *prop; Property *prop;
prop = qdev_prop_find(dev, name); prop = qdev_prop_find(dev, name);
object_property_set_str(OBJECT(dev), prop->info->enum_table[value], object_property_set_str(OBJECT(dev),
qapi_enum_lookup(prop->info->enum_table, value),
name, &error_abort); name, &error_abort);
} }
......
...@@ -345,7 +345,7 @@ static void output_type_enum(Visitor *v, const char *name, int *obj, ...@@ -345,7 +345,7 @@ static void output_type_enum(Visitor *v, const char *name, int *obj,
return; return;
} }
enum_str = (char *)strings[value]; enum_str = (char *)qapi_enum_lookup(strings, value);
visit_type_str(v, name, &enum_str, errp); visit_type_str(v, name, &enum_str, errp);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册