From: Pierangelo Masarati Date: Wed, 16 Jan 2002 19:18:41 +0000 (+0000) Subject: more ber_*cmp optimizations X-Git-Tag: LDBM_PRE_GIANT_RWLOCK~102 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=52b05a5b06c0a0cb64852f8f0617ca533add43c3;p=openldap more ber_*cmp optimizations --- diff --git a/include/lber_pvt.h b/include/lber_pvt.h index d3affbb3b0..454499d49e 100644 --- a/include/lber_pvt.h +++ b/include/lber_pvt.h @@ -78,7 +78,10 @@ ber_pvt_socket_set_nonblock LDAP_P(( ber_socket_t sd, int nb )); ? 1 : strncasecmp((v1)->bv_val, (v2)->bv_val, (v1)->bv_len) )) #define ber_bvccmp(v1,c) \ - ( (v1)->bv_len == 1 && (v1)->bv_val[0] == c ) + ( (v1)->bv_len == 1 && (v1)->bv_val[0] == (c) ) + +#define ber_strccmp(s,c) \ + ((s)[1] == '\0' && (s)[0] == (c) ) LDAP_END_DECL diff --git a/servers/slapd/acl.c b/servers/slapd/acl.c index 3df2dd0963..1c6ab94845 100644 --- a/servers/slapd/acl.c +++ b/servers/slapd/acl.c @@ -614,7 +614,7 @@ acl_mask( b->a_sockurl_pat, 0, 0 ); #endif - if ( strcmp( b->a_sockurl_pat, "*" ) != 0) { + if ( ber_strccmp( b->a_sockurl_pat, '*' ) != 0) { if ( b->a_sockurl_style == ACL_STYLE_REGEX) { if (!regex_matches( b->a_sockurl_pat, conn->c_listener_url, e->e_ndn, matches ) ) @@ -637,7 +637,7 @@ acl_mask( Debug( LDAP_DEBUG_ACL, "<= check a_domain_pat: %s\n", b->a_domain_pat, 0, 0 ); #endif - if ( strcmp( b->a_domain_pat, "*" ) != 0) { + if ( ber_strccmp( b->a_domain_pat, '*' ) != 0) { if ( b->a_domain_style == ACL_STYLE_REGEX) { if (!regex_matches( b->a_domain_pat, conn->c_peer_domain, e->e_ndn, matches ) ) @@ -660,7 +660,7 @@ acl_mask( Debug( LDAP_DEBUG_ACL, "<= check a_peername_path: %s\n", b->a_peername_pat, 0, 0 ); #endif - if ( strcmp( b->a_peername_pat, "*" ) != 0) { + if ( ber_strccmp( b->a_peername_pat, '*' ) != 0) { if ( b->a_peername_style == ACL_STYLE_REGEX) { if (!regex_matches( b->a_peername_pat, conn->c_peer_name, e->e_ndn, matches ) ) @@ -683,7 +683,7 @@ acl_mask( Debug( LDAP_DEBUG_ACL, "<= check a_sockname_path: %s\n", b->a_sockname_pat, 0, 0 ); #endif - if ( strcmp( b->a_sockname_pat, "*" ) != 0) { + if ( ber_strccmp( b->a_sockname_pat, '*' ) != 0) { if ( b->a_sockname_style == ACL_STYLE_REGEX) { if (!regex_matches( b->a_sockname_pat, conn->c_sock_name, e->e_ndn, matches ) )