Correct grammar in picksplit debug messages
[PostgreSQL.git] / src / port / memcmp.c
blobf4b26833786ced69e69460c0b67454540e972e19
1 /*-------------------------------------------------------------------------
3 * memcmp.c
4 * compares memory bytes
6 * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
9 * IDENTIFICATION
10 * $PostgreSQL$
12 * This file was taken from NetBSD and is used by SunOS because memcmp
13 * on that platform does not properly compare negative bytes. The
14 * NetBSD copyright terms follow.
17 /*-
18 * Copyright (c) 1990, 1993
19 * The Regents of the University of California. All rights reserved.
21 * This code is derived from software contributed to Berkeley by
22 * Chris Torek.
24 * Redistribution and use in source and binary forms, with or without
25 * modification, are permitted provided that the following conditions
26 * are met:
27 * 1. Redistributions of source code must retain the above copyright
28 * notice, this list of conditions and the following disclaimer.
29 * 2. Redistributions in binary form must reproduce the above copyright
30 * notice, this list of conditions and the following disclaimer in the
31 * documentation and/or other materials provided with the distribution.
32 * 3. Neither the name of the University nor the names of its contributors
33 * may be used to endorse or promote products derived from this software
34 * without specific prior written permission.
36 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
37 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
38 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
39 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
40 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
41 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
42 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
43 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
44 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
45 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
46 * SUCH DAMAGE.
49 #include "c.h"
53 * Compare memory regions.
55 int
56 memcmp(const void *s1, const void *s2, size_t n)
58 if (n != 0)
60 const unsigned char *p1 = s1,
61 *p2 = s2;
65 if (*p1++ != *p2++)
66 return (*--p1 - *--p2);
67 } while (--n != 0);
69 return 0;