aboutsummaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorRoman Kagan <rkagan@virtuozzo.com>2017-11-27 15:43:55 +0300
committerFam Zheng <famz@redhat.com>2017-12-20 22:01:24 +0800
commitbfab1aede07f864b8fbd749c3a0545b949b4cc84 (patch)
tree307e5f871a0ed1e8d0203459c2b8c38537c790fe /util
parentdbd73b569b61893ebfe460b0be254997e2cbfb0a (diff)
util: add is_equal to UUID API
It's going to be useful, in particular, in VMBus code massively using uuids aka GUIDs. Signed-off-by: Roman Kagan <rkagan@virtuozzo.com> Message-Id: <20171127124355.26015-1-rkagan@virtuozzo.com> Signed-off-by: Fam Zheng <famz@redhat.com>
Diffstat (limited to 'util')
-rw-r--r--util/uuid.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/util/uuid.c b/util/uuid.c
index dd6b5fdf05..ebf06c049a 100644
--- a/util/uuid.c
+++ b/util/uuid.c
@@ -41,7 +41,12 @@ void qemu_uuid_generate(QemuUUID *uuid)
int qemu_uuid_is_null(const QemuUUID *uu)
{
static QemuUUID null_uuid;
- return memcmp(uu, &null_uuid, sizeof(QemuUUID)) == 0;
+ return qemu_uuid_is_equal(uu, &null_uuid);
+}
+
+int qemu_uuid_is_equal(const QemuUUID *lhv, const QemuUUID *rhv)
+{
+ return memcmp(lhv, rhv, sizeof(QemuUUID)) == 0;
}
void qemu_uuid_unparse(const QemuUUID *uuid, char *out)