From b38dd678a21582e03ecd2dec76ccf8290455628a Mon Sep 17 00:00:00 2001 From: Max Reitz Date: Tue, 14 Nov 2017 19:01:25 +0100 Subject: 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 Reviewed-by: Eric Blake Reviewed-by: Alberto Garcia Reviewed-by: Markus Armbruster Message-id: 20171114180128.17076-4-mreitz@redhat.com Signed-off-by: Max Reitz --- include/qapi/qmp/qobject.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'include/qapi/qmp/qobject.h') diff --git a/include/qapi/qmp/qobject.h b/include/qapi/qmp/qobject.h index ef1d1a9237..38ac68845c 100644 --- a/include/qapi/qmp/qobject.h +++ b/include/qapi/qmp/qobject.h @@ -67,6 +67,15 @@ static inline void qobject_incref(QObject *obj) obj->refcnt++; } +/** + * qobject_is_equal(): Return whether the two objects are equal. + * + * Any of the pointers may be NULL; return true if both are. Always + * return false if only one is (therefore a QNull object is not + * considered equal to a NULL pointer). + */ +bool qobject_is_equal(const QObject *x, const QObject *y); + /** * qobject_destroy(): Free resources used by the object */ -- cgit 1.4.1