#include "qemu/osdep.h"
#include "qapi/error.h"
+#include "qapi/qmp/qdict.h"
+#include "qapi/qmp/qlist.h"
#include "qapi/qmp/qstring.h"
#include "qemu/cutils.h"
#include "qemu/option.h"
* Else, fail because we have conflicting needs on how to map
* @key_in_cur.
* In any case, take over the reference to @value, i.e. if the caller
- * wants to hold on to a reference, it needs to QINCREF().
+ * wants to hold on to a reference, it needs to qobject_ref().
* Use @key up to @key_cursor to identify the key in error messages.
* On success, return the mapped value.
* On failure, store an error through @errp and return NULL.
if (qobject_type(old) != (value ? QTYPE_QSTRING : QTYPE_QDICT)) {
error_setg(errp, "Parameters '%.*s.*' used inconsistently",
(int)(key_cursor - key), key);
- QDECREF(value);
+ qobject_unref(value);
return NULL;
}
if (!value) {
if (!next) {
return NULL;
}
- cur = qobject_to_qdict(next);
+ cur = qobject_to(QDict, next);
assert(cur);
}
has_member = true;
}
- qdict = qobject_to_qdict(ent->value);
+ qdict = qobject_to(QDict, ent->value);
if (!qdict) {
continue;
}
error_setg(errp, "Parameter '%s%d' missing", key, i);
g_free(key);
g_free(elt);
- QDECREF(list);
+ qobject_unref(list);
return NULL;
}
- qobject_incref(elt[i]);
+ qobject_ref(elt[i]);
qlist_append_obj(list, elt[i]);
}
while (*s) {
s = keyval_parse_one(qdict, s, implied_key, errp);
if (!s) {
- QDECREF(qdict);
+ qobject_unref(qdict);
return NULL;
}
implied_key = NULL;
listified = keyval_listify(qdict, NULL, errp);
if (!listified) {
- QDECREF(qdict);
+ qobject_unref(qdict);
return NULL;
}
assert(listified == QOBJECT(qdict));