From: Howard Chu Date: Fri, 7 Dec 2001 02:26:33 +0000 (+0000) Subject: Avoid unnecessary strcmp's X-Git-Tag: LDBM_PRE_GIANT_RWLOCK~732 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=257fd527c5f64b0fc787d3e37a463e0290d2a970;p=openldap Avoid unnecessary strcmp's --- diff --git a/libraries/libldif/line64.c b/libraries/libldif/line64.c index 626dc6f556..5fd0b4700a 100644 --- a/libraries/libldif/line64.c +++ b/libraries/libldif/line64.c @@ -313,6 +313,7 @@ ldif_sput( unsigned long bits; char *save; int pad; + int namelen = 0; ber_len_t savelen; ber_len_t len=0; @@ -339,10 +340,10 @@ ldif_sput( /* name (attribute type) */ if( name != NULL ) { /* put the name + ":" */ - for ( i=0 ; name[i]; i++ ) { - *(*out)++ = name[i]; - len++; - } + namelen = strlen(name); + strcpy(*out, name); + *out += namelen; + len += namelen; if( type != LDIF_PUT_COMMENT ) { *(*out)++ = ':'; @@ -416,8 +417,10 @@ ldif_sput( && strstr( name, ";binary" ) == NULL #endif #ifndef LDAP_PASSWD_DEBUG - && strcasecmp( name, "userPassword" ) != 0 /* encode userPassword */ - && strcasecmp( name, "2.5.4.35" ) != 0 /* encode userPassword */ + && (namelen != (sizeof("userPassword")-1) + || strcasecmp( name, "userPassword" ) != 0) /* encode userPassword */ + && (namelen != (sizeof("2.5.4.35")-1) + || strcasecmp( name, "2.5.4.35" ) != 0) /* encode userPassword */ #endif ) { int b64 = 0;