From: Hallvard Furuseth Date: Fri, 20 Nov 2009 20:43:50 +0000 (+0000) Subject: ITS#6351,6390: s/memrchr/lutil_memrchr/, but try #define lutil_memrchr->memrchr X-Git-Tag: ACLCHECK_0~95 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=3aff1b0c0c06b82f9b6e82bb2f44a755573090e2;p=openldap ITS#6351,6390: s/memrchr/lutil_memrchr/, but try #define lutil_memrchr->memrchr --- diff --git a/include/ac/string.h b/include/ac/string.h index 00c79d34a1..d383251502 100644 --- a/include/ac/string.h +++ b/include/ac/string.h @@ -94,11 +94,10 @@ int (strncasecmp)(); #define memcmp lutil_memcmp #endif +void *(lutil_memrchr)(const void *b, int c, size_t n); /* GNU extension (glibc >= 2.1.91), only declared when defined(_GNU_SOURCE) */ -#ifndef HAVE_MEMRCHR -#undef memrchr -#define memrchr lutil_memrchr -void * memrchr(const void *b, int c, size_t len); +#if defined(HAVE_MEMRCHR) && defined(_GNU_SOURCE) +#define lutil_memrchr(b, c, n) memrchr(b, c, n) #endif /* ! HAVE_MEMRCHR */ #define STRLENOF(s) (sizeof(s)-1) diff --git a/include/lber_pvt.h b/include/lber_pvt.h index 378f00b627..365a243bca 100644 --- a/include/lber_pvt.h +++ b/include/lber_pvt.h @@ -173,7 +173,7 @@ ber_bvarray_dup_x LDAP_P(( BerVarray *dst, BerVarray src, void *ctx )); ((char *) memchr( (bv)->bv_val, (c), (bv)->bv_len )) #define ber_bvrchr(bv,c) \ - ((char *) memrchr( (bv)->bv_val, (c), (bv)->bv_len )) + ((char *) lutil_memrchr( (bv)->bv_val, (c), (bv)->bv_len )) #define ber_bvchr_post(dst,bv,c) \ do { \ @@ -190,13 +190,13 @@ ber_bvarray_dup_x LDAP_P(( BerVarray *dst, BerVarray src, void *ctx )); #define ber_bvrchr_post(dst,bv,c) \ do { \ - (dst)->bv_val = memrchr( (bv)->bv_val, (c), (bv)->bv_len ); \ + (dst)->bv_val = lutil_memrchr( (bv)->bv_val, (c), (bv)->bv_len ); \ (dst)->bv_len = (dst)->bv_val ? (bv)->bv_len - ((dst)->bv_val - (bv)->bv_val) : 0; \ } while (0) #define ber_bvrchr_pre(dst,bv,c) \ do { \ - (dst)->bv_val = memrchr( (bv)->bv_val, (c), (bv)->bv_len ); \ + (dst)->bv_val = lutil_memrchr( (bv)->bv_val, (c), (bv)->bv_len ); \ (dst)->bv_len = (dst)->bv_val ? ((dst)->bv_val - (bv)->bv_val) : (bv)->bv_len; \ (dst)->bv_val = (bv)->bv_val; \ } while (0) diff --git a/libraries/liblutil/utils.c b/libraries/liblutil/utils.c index dd08642fa2..0211e5bf7b 100644 --- a/libraries/liblutil/utils.c +++ b/libraries/liblutil/utils.c @@ -445,7 +445,7 @@ int closedir(DIR *dir) * Memory Reverse Search */ void * -lutil_memrchr(const void *b, int c, size_t n) +(lutil_memrchr)(const void *b, int c, size_t n) { if (n != 0) { const unsigned char *s, *bb = b, cc = c;