-void
-ber_bvfree( struct berval *bv )
-{
- assert(bv != NULL); /* bv damn better point to something */
-
- if ( bv->bv_val != NULL )
- LBER_FREE( bv->bv_val );
- LBER_FREE( (char *) bv );
-}
-
-void
-ber_bvecfree( struct berval **bv )
-{
- int i;
-
- assert(bv != NULL); /* bv damn better point to something */
-
- for ( i = 0; bv[i] != NULL; i++ )
- ber_bvfree( bv[i] );
- LBER_FREE( (char *) bv );
-}
-
-struct berval *
-ber_bvdup(
- LDAP_CONST struct berval *bv )
-{
- struct berval *new;
-
- assert( bv != NULL );
-
- if( bv == NULL ) {
- return NULL;
- }
-
- if ( (new = (struct berval *) LBER_MALLOC( sizeof(struct berval) ))
- == NULL ) {
- return( NULL );
- }
-
- if ( bv->bv_val == NULL ) {
- new->bv_val = NULL;
- new->bv_len = 0;
- return ( new );
- }
-
- if ( (new->bv_val = (char *) LBER_MALLOC( bv->bv_len + 1 )) == NULL ) {
- LBER_FREE( new );
- return( NULL );
- }
-
- SAFEMEMCPY( new->bv_val, bv->bv_val, (size_t) bv->bv_len );
- new->bv_val[bv->bv_len] = '\0';
- new->bv_len = bv->bv_len;
-
- return( new );
-}
-