From 7a1c94acd3f07eba76666c81cb4ce778ccc1e4b1 Mon Sep 17 00:00:00 2001 From: Luke Howard Date: Wed, 8 Oct 2003 00:48:33 +0000 Subject: [PATCH] Add entry_dup(); make slapi_entry_dup() use it --- servers/slapd/entry.c | 16 ++++++++++++++++ servers/slapd/proto-slap.h | 1 + servers/slapd/slapi/slapi_utils.c | 12 +----------- 3 files changed, 18 insertions(+), 11 deletions(-) diff --git a/servers/slapd/entry.c b/servers/slapd/entry.c index 289251c9e7..b907cd0acd 100644 --- a/servers/slapd/entry.c +++ b/servers/slapd/entry.c @@ -745,3 +745,19 @@ int entry_decode(struct berval *bv, Entry **e) *e = x; return 0; } + +Entry *entry_dup( Entry *e ) +{ + Entry *ret; + + ret = (Entry *)ch_calloc( 1, sizeof(*ret) ); + + ret->e_id = e->e_id; + ber_dupbv( &ret->e_name, &e->e_name ); + ber_dupbv( &ret->e_nname, &e->e_nname ); + ret->e_attrs = attrs_dup( e->e_attrs ); + ret->e_ocflags = e->e_ocflags; + ber_dupbv( &ret->e_bv, &e->e_bv ); + ret->e_private = NULL; +} + diff --git a/servers/slapd/proto-slap.h b/servers/slapd/proto-slap.h index 42494eba50..9664030f91 100644 --- a/servers/slapd/proto-slap.h +++ b/servers/slapd/proto-slap.h @@ -465,6 +465,7 @@ LDAP_SLAPD_F (void) entry_free LDAP_P(( Entry *e )); LDAP_SLAPD_F (int) entry_cmp LDAP_P(( Entry *a, Entry *b )); LDAP_SLAPD_F (int) entry_dn_cmp LDAP_P(( const void *v_a, const void *v_b )); LDAP_SLAPD_F (int) entry_id_cmp LDAP_P(( const void *v_a, const void *v_b )); +LDAP_SLAPD_F (Entry *) entry_dup LDAP_P(( Entry *e )); /* * extended.c diff --git a/servers/slapd/slapi/slapi_utils.c b/servers/slapd/slapi/slapi_utils.c index 4ed0816fd4..dfb6ef3473 100644 --- a/servers/slapd/slapi/slapi_utils.c +++ b/servers/slapd/slapi/slapi_utils.c @@ -166,17 +166,7 @@ Slapi_Entry * slapi_entry_dup( Slapi_Entry *e ) { #ifdef LDAP_SLAPI - Slapi_Entry *ret; - - ret = (Slapi_Entry *)slapi_ch_calloc( 1, sizeof(*ret) ); - - ret->e_id = e->e_id; - ber_dupbv( &ret->e_name, &e->e_name ); - ber_dupbv( &ret->e_nname, &e->e_nname ); - ret->e_attrs = attrs_dup( e->e_attrs ); - ret->e_ocflags = e->e_ocflags; - ber_dupbv( &ret->e_bv, &e->e_bv ); - ret->e_private = NULL; + return entry_dup( e ); #else /* LDAP_SLAPI */ return NULL; #endif /* LDAP_SLAPI */ -- 2.39.5