From: Pierangelo Masarati Date: Thu, 14 Feb 2002 21:10:13 +0000 (+0000) Subject: use memchr in ber_bvchr X-Git-Tag: OPENLDAP_REL_ENG_2_1_BP~4 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=2aec424646934e01d601198043981cd71755a2ce;p=openldap use memchr in ber_bvchr --- diff --git a/include/lber_pvt.h b/include/lber_pvt.h index f03d4e8cb8..9fdd67f2c4 100644 --- a/include/lber_pvt.h +++ b/include/lber_pvt.h @@ -83,8 +83,8 @@ ber_pvt_socket_set_nonblock LDAP_P(( ber_socket_t sd, int nb )); #define ber_strccmp(s,c) \ ( (s)[0] == (c) && (s)[1] == '\0' ) -LBER_F( char * ) -ber_bvchr LDAP_P(( struct berval *bv, char c )); +#define ber_bvchr(bv,c) \ + memchr( (bv)->bv_val, (c), (bv)->bv_len ) LDAP_END_DECL diff --git a/libraries/liblber/memory.c b/libraries/liblber/memory.c index 6dbdea72c7..599a542988 100644 --- a/libraries/liblber/memory.c +++ b/libraries/liblber/memory.c @@ -698,25 +698,3 @@ ber_bvarray_add( BerVarray *a, BerValue *bv ) return n; } -char * -ber_bvchr( struct berval *bv, char c ) -{ - ber_len_t p; - - assert( bv ); - - if ( bv->bv_len == 0 ) { - return NULL; - } - - assert( bv->bv_val ); - - for ( p = 0; p < bv->bv_len; p++ ) { - if ( bv->bv_val[ p ] == c ) { - return &bv->bv_val[ p ]; - } - } - - return NULL; -} - diff --git a/servers/slapd/schema_init.c b/servers/slapd/schema_init.c index 1abba210b3..e141a00c62 100644 --- a/servers/slapd/schema_init.c +++ b/servers/slapd/schema_init.c @@ -17,6 +17,7 @@ #include "slap.h" #include "ldap_pvt.h" +#include "lber_pvt.h" #include "ldap_utf8.h" @@ -1124,7 +1125,6 @@ retry: } p = ber_bvchr( &left, *sub->sa_any[i].bv_val ); - if ( p == NULL ) { match = 1; goto done;