summaryrefslogtreecommitdiff
path: root/source4/librpc/ndr
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2007-01-12 17:17:02 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:40:30 -0500
commitcf5f76bf662ad471d68424938966364032527988 (patch)
treeceb24765e1d1fd65a05a9034f8175862d6d64494 /source4/librpc/ndr
parentce87c63146d6060b92ba9590e29d7dc6009bfdeb (diff)
downloadsamba-cf5f76bf662ad471d68424938966364032527988.tar.gz
samba-cf5f76bf662ad471d68424938966364032527988.tar.bz2
samba-cf5f76bf662ad471d68424938966364032527988.zip
r20712: add a function to compare GUID's
metze (This used to be commit 6237d9f0b575ccb739b96d2a9f4c3643a727c4b7)
Diffstat (limited to 'source4/librpc/ndr')
-rw-r--r--source4/librpc/ndr/uuid.c25
1 files changed, 25 insertions, 0 deletions
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
*/