-void
-ber_bvfree( struct berval *bv )
-{
-#ifdef LBER_ASSERT
- assert(bv != NULL); /* bv damn better point to something */
-#endif
- if ( bv->bv_val != NULL )
- free( bv->bv_val );
- free( (char *) bv );
-}
-
-void
-ber_bvecfree( struct berval **bv )
-{
- int i;
-
-#ifdef LBER_ASSERT
- assert(bv != NULL); /* bv damn better point to something */
-#endif
- for ( i = 0; bv[i] != NULL; i++ )
- ber_bvfree( bv[i] );
- free( (char *) bv );
-}
-
-struct berval *
-ber_bvdup( struct berval *bv )
-{
- struct berval *new;
-
- if ( (new = (struct berval *) 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 *) malloc( bv->bv_len + 1 )) == NULL ) {
- 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 );
-}
-