Add optional len to ber_str2bv

This commit is contained in:
Howard Chu 2001-12-26 13:45:22 +00:00
parent a1460e74ce
commit 327f253183
2 changed files with 5 additions and 5 deletions

View File

@ -552,10 +552,10 @@ ber_dupbv LDAP_P((
LBER_F( struct berval * )
ber_str2bv LDAP_P((
LDAP_CONST char *, int dup, struct berval *bv ));
LDAP_CONST char *, ber_len_t len, int dup, struct berval *bv));
#define ber_bvstr(a) ber_str2bv(a, 0, NULL)
#define ber_bvstrdup(a) ber_str2bv(a, 1, NULL)
#define ber_bvstr(a) ber_str2bv(a, 0, 0, NULL)
#define ber_bvstrdup(a) ber_str2bv(a, 0, 1, NULL)
LBER_F( char * )
ber_strdup LDAP_P((

View File

@ -489,7 +489,7 @@ ber_dupbv(
struct berval *
ber_str2bv(
LDAP_CONST char *s, int dup, struct berval *bv )
LDAP_CONST char *s, ber_len_t len, int dup, struct berval *bv)
{
struct berval *new;
@ -509,7 +509,7 @@ ber_str2bv(
}
}
new->bv_len = strlen( s );
new->bv_len = len ? len : strlen( s );
if ( dup ) {
if ( (new->bv_val = LBER_MALLOC( new->bv_len+1 )) == NULL ) {
ber_errno = LBER_ERROR_MEMORY;