diff options
author | Markus Armbruster <armbru@redhat.com> | 2020-05-05 17:29:12 +0200 |
---|---|---|
committer | Markus Armbruster <armbru@redhat.com> | 2020-05-15 06:26:02 +0200 |
commit | b555f89fcbdc797423f6d6a41b76ef5fa5272235 (patch) | |
tree | 49940b7cf084b2e3325a4bf488d9e377cc1cd1dd /qom/object.c | |
parent | f73a32a5147ef7ff90f682d6ba3a6ef11ff97d9e (diff) |
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 <armbru@redhat.com>
Message-Id: <20200505152926.18877-5-armbru@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'qom/object.c')
-rw-r--r-- | qom/object.c | 11 |
1 files changed, 2 insertions, 9 deletions
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); |