]> git.sur5r.net Git - openldap/commitdiff
use memchr in ber_bvchr
authorPierangelo Masarati <ando@openldap.org>
Thu, 14 Feb 2002 21:10:13 +0000 (21:10 +0000)
committerPierangelo Masarati <ando@openldap.org>
Thu, 14 Feb 2002 21:10:13 +0000 (21:10 +0000)
include/lber_pvt.h
libraries/liblber/memory.c
servers/slapd/schema_init.c

index f03d4e8cb8c78cb36c485123931405686d012c08..9fdd67f2c4bac9e1fa5215a1146790a7e40fffe7 100644 (file)
@@ -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
 
index 6dbdea72c7f904d7b14d07a4cf44021b1a98b9c2..599a542988ad757e9e3b342b4f1265fcaaec65e6 100644 (file)
@@ -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;
-}
-
index 1abba210b38068aa2340d559a2a3dfe7b17ba35d..e141a00c627bd8bb9b58763e2926f8f43ffc2318 100644 (file)
@@ -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;