Author: metze Date: 2007-01-12 17:17:02 +0000 (Fri, 12 Jan 2007) New Revision: 20712
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=20712 Log: add a function to compare GUID's metze Modified: branches/SAMBA_4_0/source/librpc/ndr/uuid.c Changeset: Modified: branches/SAMBA_4_0/source/librpc/ndr/uuid.c =================================================================== --- branches/SAMBA_4_0/source/librpc/ndr/uuid.c 2007-01-12 17:13:51 UTC (rev 20711) +++ branches/SAMBA_4_0/source/librpc/ndr/uuid.c 2007-01-12 17:17:02 UTC (rev 20712) @@ -159,6 +159,31 @@ 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 */