ui: avoid pointless VNC updates if framebuffer isn't dirty
[qemu/ar7.git] / qobject / qbool.c
blobac825fc5a2e65cffa19bdb7a9f525a21e4626d2c
1 /*
2 * QBool Module
4 * Copyright IBM, Corp. 2009
6 * Authors:
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 "qapi/qmp/qobject.h"
17 #include "qemu-common.h"
19 /**
20 * qbool_from_bool(): Create a new QBool from a bool
22 * Return strong reference.
24 QBool *qbool_from_bool(bool value)
26 QBool *qb;
28 qb = g_malloc(sizeof(*qb));
29 qobject_init(QOBJECT(qb), QTYPE_QBOOL);
30 qb->value = value;
32 return qb;
35 /**
36 * qbool_get_bool(): Get the stored bool
38 bool qbool_get_bool(const QBool *qb)
40 return qb->value;
43 /**
44 * qobject_to_qbool(): Convert a QObject into a QBool
46 QBool *qobject_to_qbool(const QObject *obj)
48 if (!obj || qobject_type(obj) != QTYPE_QBOOL) {
49 return NULL;
51 return container_of(obj, QBool, base);
54 /**
55 * qbool_is_equal(): Test whether the two QBools are equal
57 bool qbool_is_equal(const QObject *x, const QObject *y)
59 return qobject_to_qbool(x)->value == qobject_to_qbool(y)->value;
62 /**
63 * qbool_destroy_obj(): Free all memory allocated by a
64 * QBool object
66 void qbool_destroy_obj(QObject *obj)
68 assert(obj != NULL);
69 g_free(qobject_to_qbool(obj));