#include "qemu/queue.h"
#include "qemu-common.h"
#include "qapi/qmp/qbool.h"
+#include "qapi/qmp/qdict.h"
+#include "qapi/qmp/qlist.h"
+#include "qapi/qmp/qnull.h"
+#include "qapi/qmp/qnum.h"
#include "qapi/qmp/qstring.h"
typedef struct QStackEntry {
switch (qobject_type(cur)) {
case QTYPE_QDICT:
assert(name);
- qdict_put_obj(qobject_to_qdict(cur), name, value);
+ qdict_put_obj(qobject_to(QDict, cur), name, value);
break;
case QTYPE_QLIST:
assert(!name);
- qlist_append_obj(qobject_to_qlist(cur), value);
+ qlist_append_obj(qobject_to(QList, cur), value);
break;
default:
g_assert_not_reached();
QObject **obj, Error **errp)
{
QObjectOutputVisitor *qov = to_qov(v);
- qobject_incref(*obj);
- qobject_output_add_obj(qov, name, *obj);
+
+ qobject_output_add_obj(qov, name, qobject_ref(*obj));
}
static void qobject_output_type_null(Visitor *v, const char *name,
/* Finish building, and return the root object.
* The root object is never null. The caller becomes the object's
- * owner, and should use qobject_decref() when done with it. */
+ * owner, and should use qobject_unref() when done with it. */
static void qobject_output_complete(Visitor *v, void *opaque)
{
QObjectOutputVisitor *qov = to_qov(v);
assert(qov->root && QSLIST_EMPTY(&qov->stack));
assert(opaque == qov->result);
- qobject_incref(qov->root);
- *qov->result = qov->root;
+ *qov->result = qobject_ref(qov->root);
qov->result = NULL;
}
g_free(e);
}
- qobject_decref(qov->root);
+ qobject_unref(qov->root);
g_free(qov);
}