From b555f89fcbdc797423f6d6a41b76ef5fa5272235 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Tue, 5 May 2020 17:29:12 +0200 Subject: qom: Simplify object_property_get_enum() Reuse object_property_get_str(). Switches from the string to the qobject visitor under the hood. Signed-off-by: Markus Armbruster Message-Id: <20200505152926.18877-5-armbru@redhat.com> Reviewed-by: Paolo Bonzini --- qom/object.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'qom') diff --git a/qom/object.c b/qom/object.c index 3d65658059..b374af302c 100644 --- a/qom/object.c +++ b/qom/object.c @@ -1521,8 +1521,6 @@ typedef struct EnumProperty { int object_property_get_enum(Object *obj, const char *name, const char *typename, Error **errp) { - Error *err = NULL; - Visitor *v; char *str; int ret; ObjectProperty *prop = object_property_find(obj, name, errp); @@ -1541,15 +1539,10 @@ int object_property_get_enum(Object *obj, const char *name, enumprop = prop->opaque; - v = string_output_visitor_new(false, &str); - object_property_get(obj, v, name, &err); - if (err) { - error_propagate(errp, err); - visit_free(v); + str = object_property_get_str(obj, name, errp); + if (!str) { return 0; } - visit_complete(v, &str); - visit_free(v); ret = qapi_enum_parse(enumprop->lookup, str, -1, errp); g_free(str); -- cgit v1.2.3