mirror of
https://git.openldap.org/openldap/openldap.git
synced 2024-12-27 03:20:22 +08:00
introduce ber_bvreplace()
This commit is contained in:
parent
637df0ba90
commit
2f877b48b1
@ -597,6 +597,10 @@ LBER_F( char * )
|
|||||||
ber_strdup LDAP_P((
|
ber_strdup LDAP_P((
|
||||||
LDAP_CONST char * ));
|
LDAP_CONST char * ));
|
||||||
|
|
||||||
|
LBER_F( struct berval * )
|
||||||
|
ber_bvreplace LDAP_P((
|
||||||
|
struct berval *dst, LDAP_CONST struct berval *src ));
|
||||||
|
|
||||||
LBER_F( void )
|
LBER_F( void )
|
||||||
ber_bvarray_free LDAP_P(( BerVarray p ));
|
ber_bvarray_free LDAP_P(( BerVarray p ));
|
||||||
|
|
||||||
|
@ -135,6 +135,10 @@ LBER_F( char * )
|
|||||||
ber_strdup_x LDAP_P((
|
ber_strdup_x LDAP_P((
|
||||||
LDAP_CONST char *, void *ctx ));
|
LDAP_CONST char *, void *ctx ));
|
||||||
|
|
||||||
|
LBER_F( struct berval * )
|
||||||
|
ber_bvreplace_x LDAP_P((
|
||||||
|
struct berval *dst, LDAP_CONST struct berval *src, void *ctx ));
|
||||||
|
|
||||||
LBER_F( void )
|
LBER_F( void )
|
||||||
ber_bvarray_free_x LDAP_P(( BerVarray p, void *ctx ));
|
ber_bvarray_free_x LDAP_P(( BerVarray p, void *ctx ));
|
||||||
|
|
||||||
|
@ -713,6 +713,31 @@ ber_strndup( LDAP_CONST char *s, ber_len_t l )
|
|||||||
return ber_strndup_x( s, l, NULL );
|
return ber_strndup_x( s, l, NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* dst is resized as required by src and the value of src is copied into dst
|
||||||
|
* dst->bv_val must be NULL (and dst->bv_len must be 0), or it must be
|
||||||
|
* alloc'ed with the context ctx
|
||||||
|
*/
|
||||||
|
struct berval *
|
||||||
|
ber_bvreplace_x( struct berval *dst, LDAP_CONST struct berval *src, void *ctx )
|
||||||
|
{
|
||||||
|
assert( dst != NULL );
|
||||||
|
|
||||||
|
if ( dst->bv_len < src->bv_len ) {
|
||||||
|
dst->bv_val = ber_memrealloc_x( dst->bv_val, src->bv_len + 1, ctx );
|
||||||
|
}
|
||||||
|
|
||||||
|
AC_MEMCPY( dst->bv_val, src->bv_val, src->bv_len + 1 );
|
||||||
|
|
||||||
|
return dst;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct berval *
|
||||||
|
ber_bvreplace( struct berval *dst, LDAP_CONST struct berval *src )
|
||||||
|
{
|
||||||
|
return ber_bvreplace_x( dst, src, NULL );
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ber_bvarray_free_x( BerVarray a, void *ctx )
|
ber_bvarray_free_x( BerVarray a, void *ctx )
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user