summaryrefslogtreecommitdiff
path: root/qobject/qbool.c
diff options
context:
space:
mode:
authorMax Reitz <mreitz@redhat.com>2017-11-14 19:01:25 +0100
committerMax Reitz <mreitz@redhat.com>2017-11-17 18:21:30 +0100
commitb38dd678a21582e03ecd2dec76ccf8290455628a (patch)
tree1076a9bc7235d44314418bb7ef140685692e999e /qobject/qbool.c
parent254bf807e5354c7b424d6fc28cb17c4f9ba43e35 (diff)
downloadqemu-b38dd678a21582e03ecd2dec76ccf8290455628a.tar.gz
qapi: Add qobject_is_equal()
This generic function (along with its implementations for different types) determines whether two QObjects are equal. Signed-off-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Alberto Garcia <berto@igalia.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Message-id: 20171114180128.17076-4-mreitz@redhat.com Signed-off-by: Max Reitz <mreitz@redhat.com>
Diffstat (limited to 'qobject/qbool.c')
-rw-r--r--qobject/qbool.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/qobject/qbool.c b/qobject/qbool.c
index 0606bbd2a3..ac825fc5a2 100644
--- a/qobject/qbool.c
+++ b/qobject/qbool.c
@@ -52,6 +52,14 @@ QBool *qobject_to_qbool(const QObject *obj)
}
/**
+ * qbool_is_equal(): Test whether the two QBools are equal
+ */
+bool qbool_is_equal(const QObject *x, const QObject *y)
+{
+ return qobject_to_qbool(x)->value == qobject_to_qbool(y)->value;
+}
+
+/**
* qbool_destroy_obj(): Free all memory allocated by a
* QBool object
*/