diff options
| author | Max Reitz | 2017-11-14 19:01:25 +0100 |
|---|---|---|
| committer | Max Reitz | 2017-11-17 18:21:30 +0100 |
| commit | b38dd678a21582e03ecd2dec76ccf8290455628a (patch) | |
| tree | 1076a9bc7235d44314418bb7ef140685692e999e /qobject/qstring.c | |
| parent | qapi/qlist: Add qlist_append_null() macro (diff) | |
| download | qemu-b38dd678a21582e03ecd2dec76ccf8290455628a.tar.gz qemu-b38dd678a21582e03ecd2dec76ccf8290455628a.tar.xz qemu-b38dd678a21582e03ecd2dec76ccf8290455628a.zip | |
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/qstring.c')
| -rw-r--r-- | qobject/qstring.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/qobject/qstring.c b/qobject/qstring.c index 5da7b5f37c..74182a1c02 100644 --- a/qobject/qstring.c +++ b/qobject/qstring.c @@ -129,6 +129,15 @@ const char *qstring_get_str(const QString *qstring) } /** + * qstring_is_equal(): Test whether the two QStrings are equal + */ +bool qstring_is_equal(const QObject *x, const QObject *y) +{ + return !strcmp(qobject_to_qstring(x)->string, + qobject_to_qstring(y)->string); +} + +/** * qstring_destroy_obj(): Free all memory allocated by a QString * object */ |
