]> git.sur5r.net Git - openldap/commitdiff
more ber_*cmp optimizations
authorPierangelo Masarati <ando@openldap.org>
Wed, 16 Jan 2002 19:18:41 +0000 (19:18 +0000)
committerPierangelo Masarati <ando@openldap.org>
Wed, 16 Jan 2002 19:18:41 +0000 (19:18 +0000)
include/lber_pvt.h
servers/slapd/acl.c

index d3affbb3b0e6fe92849d5e1281398ed9ca113f5a..454499d49ed1e7fd86084e08df79b76397d9da44 100644 (file)
@@ -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
 
index 3df2dd09635499ce97bb3ff31e6c6165c4b3c9ba..1c6ab948457c1c6c7c8f4d3725d7eceacd84f635 100644 (file)
@@ -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 ) )