mirror of
https://git.openldap.org/openldap/openldap.git
synced 2026-01-30 10:29:28 -05:00
8-bit memcmp()
This commit is contained in:
parent
df104514a8
commit
cedf6b4b5f
1 changed files with 19 additions and 0 deletions
19
libraries/liblutil/memcmp.c
Normal file
19
libraries/liblutil/memcmp.c
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
#include "portable.h"
|
||||
|
||||
#include <ac/string.h>
|
||||
|
||||
/*
|
||||
* Memory Compare
|
||||
*/
|
||||
int
|
||||
memcmp(const void *v1, const void *v2, int n)
|
||||
{
|
||||
if (n != 0) {
|
||||
register const unsigned char *s1=v1, *s2=v2;
|
||||
do {
|
||||
if (*s1++ != *s2++)
|
||||
return (*--s1 - *--s2);
|
||||
} while (--n != 0);
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
Loading…
Reference in a new issue