aboutsummaryrefslogtreecommitdiff
path: root/qom
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2020-12-11 18:11:43 +0100
committerMarkus Armbruster <armbru@redhat.com>2020-12-19 10:38:59 +0100
commit26c52828f6e7760407e5bb43a2fab3a276eccf43 (patch)
treed0e19f572584fb205cd70944abdd4d6d635dc497 /qom
parent410f44f59685b05fc76e813fb2716bdb17c8da8d (diff)
downloadqemu-26c52828f6e7760407e5bb43a2fab3a276eccf43.zip
qemu-26c52828f6e7760407e5bb43a2fab3a276eccf43.tar.gz
qemu-26c52828f6e7760407e5bb43a2fab3a276eccf43.tar.bz2
Revert "qobject: let object_property_get_str() use new API"
Commit aafb21a0b9 "qobject: let object_property_get_str() use new API" isn't much of a simplification. Not worth having object_property_get_str() differ from the other object_property_get_FOO(). Revert. This reverts commit aafb21a0b9cea5fa0fe52e68111bb6bd13837a02. Cc: Paolo Bonzini <pbonzini@redhat.com> Cc: Daniel P. Berrangé <berrange@redhat.com> Cc: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20201211171152.146877-12-armbru@redhat.com> Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Diffstat (limited to 'qom')
-rw-r--r--qom/object.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/qom/object.c b/qom/object.c
index f2ae6e6..5cd43fe 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -1415,15 +1415,18 @@ char *object_property_get_str(Object *obj, const char *name,
Error **errp)
{
QObject *ret = object_property_get_qobject(obj, name, errp);
+ QString *qstring;
char *retval;
if (!ret) {
return NULL;
}
-
- retval = g_strdup(qobject_get_try_str(ret));
- if (!retval) {
+ qstring = qobject_to(QString, ret);
+ if (!qstring) {
error_setg(errp, QERR_INVALID_PARAMETER_TYPE, name, "string");
+ retval = NULL;
+ } else {
+ retval = g_strdup(qstring_get_str(qstring));
}
qobject_unref(ret);