Marc-André Lureau <[email protected]> writes:
> The typename parameter becomes a QAPITypeInfo pointer, and the
> validation compares prop->qapi_type against it instead of matching
> prop->type strings.
>
> Signed-off-by: Markus Armbruster <[email protected]>
> Signed-off-by: Marc-André Lureau <[email protected]>
[...]
> diff --git a/qom/object.c b/qom/object.c
> index 791d981dc689..40b569d4d574 100644
> --- a/qom/object.c
> +++ b/qom/object.c
> @@ -1775,7 +1775,7 @@ uint64_t object_property_get_uint(Object *obj, const
> char *name,
> }
>
> int object_property_get_enum(Object *obj, const char *name,
> - const char *typename, Error **errp)
> + const QAPITypeInfo *type_info, Error **errp)
> {
> char *str;
> int ret;
> @@ -1785,10 +1785,10 @@ int object_property_get_enum(Object *obj, const char
> *name,
> return -1;
> }
>
> - if (!g_str_equal(prop->type, typename)) {
> + if (prop->qapi_type != type_info) {
> error_setg(errp, "Property %s on %s is not '%s' enum type",
> - name, object_class_get_name(
> - object_get_class(obj)), typename);
> + name, object_class_get_name(object_get_class(obj)),
> + type_info->name);
How can this happen? Or is it a programming error?
> return -1;
> }
>
[...]