From cf5f76bf662ad471d68424938966364032527988 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Fri, 12 Jan 2007 17:17:02 +0000 Subject: r20712: add a function to compare GUID's metze (This used to be commit 6237d9f0b575ccb739b96d2a9f4c3643a727c4b7) --- source4/librpc/ndr/uuid.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'source4/librpc/ndr') diff --git a/source4/librpc/ndr/uuid.c b/source4/librpc/ndr/uuid.c index 351774eae9..56ddb9c9b5 100644 --- a/source4/librpc/ndr/uuid.c +++ b/source4/librpc/ndr/uuid.c @@ -159,6 +159,31 @@ _PUBLIC_ BOOL GUID_equal(const struct GUID *u1, const struct GUID *u2) return True; } +_PUBLIC_ int GUID_compare(const struct GUID *u1, const struct GUID *u2) +{ + if (u1->time_low != u2->time_low) { + return u1->time_low - u2->time_low; + } + + if (u1->time_mid != u2->time_mid) { + return u1->time_mid - u2->time_mid; + } + + if (u1->time_hi_and_version != u2->time_hi_and_version) { + return u1->time_hi_and_version - u2->time_hi_and_version; + } + + if (u1->clock_seq[0] != u2->clock_seq[0]) { + return u1->clock_seq[0] - u2->clock_seq[0]; + } + + if (u1->clock_seq[1] != u2->clock_seq[1]) { + return u1->clock_seq[1] - u2->clock_seq[1]; + } + + return memcmp(u1->node, u2->node, 6); +} + /** its useful to be able to display these in debugging messages */ -- cgit