QString *qstr = qstring_from_str(value);
object_property_set_qobject(obj, QOBJECT(qstr), name, errp);
- QDECREF(qstr);
+ qobject_unref(qstr);
}
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;
}
- qstring = qobject_to(QString, ret);
- if (!qstring) {
+
+ retval = g_strdup(qobject_get_try_str(ret));
+ if (!retval) {
error_setg(errp, QERR_INVALID_PARAMETER_TYPE, name, "string");
- retval = NULL;
- } else {
- retval = g_strdup(qstring_get_str(qstring));
}
- qobject_decref(ret);
+ qobject_unref(ret);
return retval;
}
QBool *qbool = qbool_from_bool(value);
object_property_set_qobject(obj, QOBJECT(qbool), name, errp);
- QDECREF(qbool);
+ qobject_unref(qbool);
}
bool object_property_get_bool(Object *obj, const char *name,
retval = qbool_get_bool(qbool);
}
- qobject_decref(ret);
+ qobject_unref(ret);
return retval;
}
QNum *qnum = qnum_from_int(value);
object_property_set_qobject(obj, QOBJECT(qnum), name, errp);
- QDECREF(qnum);
+ qobject_unref(qnum);
}
int64_t object_property_get_int(Object *obj, const char *name,
retval = -1;
}
- qobject_decref(ret);
+ qobject_unref(ret);
return retval;
}
QNum *qnum = qnum_from_uint(value);
object_property_set_qobject(obj, QOBJECT(qnum), name, errp);
- QDECREF(qnum);
+ qobject_unref(qnum);
}
uint64_t object_property_get_uint(Object *obj, const char *name,
retval = 0;
}
- qobject_decref(ret);
+ qobject_unref(ret);
return retval;
}