Minor cleanup. bvarray_add should return success/fail, like

ber_bvecadd does.
This commit is contained in:
Howard Chu 2002-01-02 13:03:46 +00:00
parent 17a36b757c
commit b15eebf50b
3 changed files with 12 additions and 6 deletions

View file

@ -218,7 +218,7 @@ do_add( Connection *conn, Operation *op )
send_ldap_result( conn, op, rc = LDAP_REFERRAL,
NULL, NULL, ref ? ref : default_referral, NULL );
bvarray_free( ref );
if ( ref ) bvarray_free( ref );
goto done;
}
@ -309,7 +309,7 @@ do_add( Connection *conn, Operation *op )
send_ldap_result( conn, op, rc = LDAP_REFERRAL, NULL, NULL,
ref ? ref : defref, NULL );
bvarray_free( ref );
if ( ref ) bvarray_free( ref );
#endif
}
} else {

View file

@ -229,7 +229,11 @@ slap_strcopy(
return a-1;
}
void
/* Unlike charray_add, bvarray_add does not make a new copy of the
* source string. Typically it is used where ber_bvecadd was before,
* and ber_bvecadd didn't duplicate its source either.
*/
int
bvarray_add(
struct berval **a,
struct berval *bv
@ -248,10 +252,12 @@ bvarray_add(
*a = (struct berval *) ch_realloc( (char *) *a,
(n + 2) * sizeof(struct berval) );
}
if ( *a == NULL ) return -1;
ber_dupbv( (*a)+n, bv );
n++;
(*a)[n++] = *bv;
(*a)[n].bv_val = NULL;
return 0;
}
void

View file

@ -278,7 +278,7 @@ LDAP_SLAPD_F (char **) str2charray LDAP_P(( const char *str, const char *brkstr
LDAP_SLAPD_F (int) charray_strcmp LDAP_P(( const char **a1, const char **a2 ));
LDAP_SLAPD_F (int) charray_strcasecmp LDAP_P(( const char **a1, const char **a2 ));
LDAP_SLAPD_F (void) bvarray_add LDAP_P(( BVarray *a, struct berval *bv ));
LDAP_SLAPD_F (int) bvarray_add LDAP_P(( BVarray *a, struct berval *bv ));
LDAP_SLAPD_F (void) bvarray_free LDAP_P(( struct berval *a ));
LDAP_SLAPD_F (char *) slap_strcopy LDAP_P((