| /* |
| * compare.c --- compare whether or not two UUID's are the same |
| * |
| * Returns 0 if the two UUID's are different, and 1 if they are the same. |
| * |
| * Copyright (C) 1996, 1997 Theodore Ts'o. |
| * |
| * %Begin-Header% |
| * This file may be redistributed under the terms of the GNU |
| * Library General Public License. |
| * %End-Header% |
| */ |
| |
| #include "uuidP.h" |
| #include <string.h> |
| |
| #define UUCMP(u1,u2) if (u1 != u2) return((u1 < u2) ? -1 : 1); |
| |
| int uuid_compare(uuid_t uu1, uuid_t uu2) |
| { |
| struct uuid uuid1, uuid2; |
| |
| uuid_unpack(uu1, &uuid1); |
| uuid_unpack(uu2, &uuid2); |
| |
| UUCMP(uuid1.time_low, uuid2.time_low); |
| UUCMP(uuid1.time_mid, uuid2.time_mid); |
| UUCMP(uuid1.time_hi_and_version, uuid2.time_hi_and_version); |
| UUCMP(uuid1.clock_seq, uuid2.clock_seq); |
| return memcmp(uuid1.node, uuid2.node, 6); |
| } |
| |