mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-01-18 11:05:48 +08:00
memcmp replacement fixes
This commit is contained in:
parent
97e4865b91
commit
d68ec7b661
@ -89,6 +89,11 @@ int (strncasecmp)();
|
||||
else AC_MEMCPY( (d), (s), (n) ); \
|
||||
} while(0)
|
||||
|
||||
#ifdef NEED_MEMCMP_REPLACEMENT
|
||||
int (lutil_memcmp)(const void *b1, const void *b2, size_t len);
|
||||
#define memcmp lutil_memcmp
|
||||
#endif
|
||||
|
||||
#define STRLENOF(s) (sizeof(s)-1)
|
||||
|
||||
#endif /* _AC_STRING_H */
|
||||
|
@ -21,14 +21,13 @@
|
||||
* Memory Compare
|
||||
*/
|
||||
int
|
||||
(memcmp)(const void *v1, const void *v2, int n)
|
||||
(lutil_memcmp)(const void *v1, const void *v2, size_t n)
|
||||
{
|
||||
if (n != 0) {
|
||||
const unsigned char *s1=v1, *s2=v2;
|
||||
do {
|
||||
if (*s1++ != *s2++)
|
||||
return (*--s1 - *--s2);
|
||||
if (*s1++ != *s2++) return *--s1 - *--s2;
|
||||
} while (--n != 0);
|
||||
}
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user