4 * Copyright IBM, Corp. 2009
9 * This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
10 * See the COPYING.LIB file in the top-level directory.
16 #include "qemu-common.h"
18 static void qbool_destroy_obj(QObject *obj);
20 static const QType qbool_type = {
22 .destroy = qbool_destroy_obj,
26 * qbool_from_int(): Create a new QBool from an int
28 * Return strong reference.
30 QBool *qbool_from_int(int value)
34 qb = qemu_malloc(sizeof(*qb));
36 QOBJECT_INIT(qb, &qbool_type);
42 * qbool_get_int(): Get the stored int
44 int qbool_get_int(const QBool *qb)
50 * qobject_to_qbool(): Convert a QObject into a QBool
52 QBool *qobject_to_qbool(const QObject *obj)
54 if (qobject_type(obj) != QTYPE_QBOOL)
57 return container_of(obj, QBool, base);
61 * qbool_destroy_obj(): Free all memory allocated by a
64 static void qbool_destroy_obj(QObject *obj)
67 qemu_free(qobject_to_qbool(obj));