4 * Copyright IBM, Corp. 2009
7 * Anthony Liguori <aliguori@us.ibm.com>
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.
14 #include "qemu/osdep.h"
15 #include "qapi/qmp/qbool.h"
16 #include "qobject-internal.h"
19 * qbool_from_bool(): Create a new QBool from a bool
21 * Return strong reference.
23 QBool
*qbool_from_bool(bool value
)
27 qb
= g_malloc(sizeof(*qb
));
28 qobject_init(QOBJECT(qb
), QTYPE_QBOOL
);
35 * qbool_get_bool(): Get the stored bool
37 bool qbool_get_bool(const QBool
*qb
)
43 * qbool_is_equal(): Test whether the two QBools are equal
45 bool qbool_is_equal(const QObject
*x
, const QObject
*y
)
47 return qobject_to(QBool
, x
)->value
== qobject_to(QBool
, y
)->value
;
51 * qbool_destroy_obj(): Free all memory allocated by a
54 void qbool_destroy_obj(QObject
*obj
)
57 g_free(qobject_to(QBool
, obj
));