big svn cleanup
[anytun.git] / src / openvpn / memcmp.c
blob0b1fbd2a09b1c4e11948cd936ee0724269e32e57
1 /* memcmp.c -- Replacement memcmp.c
3 * Useful on systems that don't have a working memcmp, such as SunOS
4 * 4.1.3 and NeXT x86 OpenStep.
6 * Copyright (C) 2002 - 2003 Matthias Andree <matthias.andree@gmx.de>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or (at
11 * your option) any later version.
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program (see the file COPYING included with this
20 * distribution); if not, write to the Free Software Foundation, Inc.,
21 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 #include <string.h>
26 int
27 memcmp (const void *s1, const void *s2, size_t n)
29 register unsigned const char *p1 = s1, *p2 = s2;
30 int d;
32 if (n)
33 while (n-- > 0)
35 d = *p1++ - *p2++;
36 if (d != 0)
37 return d;
39 return 0;