![]() |
|
|||
File indexing completed on 2025-05-11 08:24:20
0001 /* 0002 * compare.c --- compare whether or not two UUID's are the same 0003 * 0004 * Returns 0 if the two UUID's are different, and 1 if they are the same. 0005 * 0006 * Copyright (C) 1996, 1997 Theodore Ts'o. 0007 * 0008 * %Begin-Header% 0009 * Redistribution and use in source and binary forms, with or without 0010 * modification, are permitted provided that the following conditions 0011 * are met: 0012 * 1. Redistributions of source code must retain the above copyright 0013 * notice, and the entire permission notice in its entirety, 0014 * including the disclaimer of warranties. 0015 * 2. Redistributions in binary form must reproduce the above copyright 0016 * notice, this list of conditions and the following disclaimer in the 0017 * documentation and/or other materials provided with the distribution. 0018 * 3. The name of the author may not be used to endorse or promote 0019 * products derived from this software without specific prior 0020 * written permission. 0021 * 0022 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED 0023 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 0024 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF 0025 * WHICH ARE HEREBY DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE 0026 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 0027 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 0028 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 0029 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 0030 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 0031 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 0032 * USE OF THIS SOFTWARE, EVEN IF NOT ADVISED OF THE POSSIBILITY OF SUCH 0033 * DAMAGE. 0034 * %End-Header% 0035 */ 0036 0037 #ifdef HAVE_CONFIG_H 0038 #include "config.h" 0039 #endif 0040 0041 #include <string.h> 0042 #include "uuidP.h" 0043 0044 #define UUCMP(u1,u2) if (u1 != u2) return((u1 < u2) ? -1 : 1); 0045 0046 int uuid_compare(const uuid_t uu1, const uuid_t uu2) 0047 { 0048 struct uuid uuid1, uuid2; 0049 0050 uuid_unpack(uu1, &uuid1); 0051 uuid_unpack(uu2, &uuid2); 0052 0053 UUCMP(uuid1.time_low, uuid2.time_low); 0054 UUCMP(uuid1.time_mid, uuid2.time_mid); 0055 UUCMP(uuid1.time_hi_and_version, uuid2.time_hi_and_version); 0056 UUCMP(uuid1.clock_seq, uuid2.clock_seq); 0057 return memcmp(uuid1.node, uuid2.node, 6); 0058 } 0059
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |