1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-24 21:34:56 +03:00

r20712: add a function to compare GUID's

metze
(This used to be commit 6237d9f0b5)
This commit is contained in:
Stefan Metzmacher 2007-01-12 17:17:02 +00:00 committed by Gerald (Jerry) Carter
parent ce87c63146
commit cf5f76bf66

View File

@ -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
*/