From 8ecfb077bf596079cdc17b23afa1a49e20f47554 Mon Sep 17 00:00:00 2001 From: Pierangelo Masarati Date: Fri, 14 Aug 2009 14:18:04 +0000 Subject: [PATCH] harmonize API: source to dest right to left --- servers/slapd/back-sql/entry-id.c | 6 +----- servers/slapd/entry.c | 21 ++++++++++++--------- servers/slapd/proto-slap.h | 2 +- 3 files changed, 14 insertions(+), 15 deletions(-) diff --git a/servers/slapd/back-sql/entry-id.c b/servers/slapd/back-sql/entry-id.c index 26f6ced56f..71e8270ce1 100644 --- a/servers/slapd/back-sql/entry-id.c +++ b/servers/slapd/back-sql/entry-id.c @@ -934,11 +934,7 @@ backsql_id2entry( backsql_srch_info *bsi, backsql_entryID *eid ) memset( bsi->bsi_e, 0, sizeof( Entry ) ); if ( bi->sql_baseObject && BACKSQL_IS_BASEOBJECT_ID( &eid->eid_id ) ) { - rc = entry_dup_to( bi->sql_baseObject, bsi->bsi_e ); - if ( rc != LDAP_SUCCESS ) { - return rc; - } - + (void)entry_dup2( bsi->bsi_e, bi->sql_baseObject ); goto done; } diff --git a/servers/slapd/entry.c b/servers/slapd/entry.c index fcf6cb02a4..65e34fba98 100644 --- a/servers/slapd/entry.c +++ b/servers/slapd/entry.c @@ -936,24 +936,27 @@ int entry_decode(EntryHeader *eh, Entry **e) return 0; } -int entry_dup_to( Entry *source, Entry *dest ) +Entry * +entry_dup2( Entry *dest, Entry *source ) { + assert( dest != NULL ); + assert( source != NULL ); + + assert( dest->e_private == NULL ); + dest->e_id = source->e_id; ber_dupbv( &dest->e_name, &source->e_name ); ber_dupbv( &dest->e_nname, &source->e_nname ); dest->e_attrs = attrs_dup( source->e_attrs ); dest->e_ocflags = source->e_ocflags; - return LDAP_SUCCESS; + + return dest; } -Entry *entry_dup( Entry *e ) +Entry * +entry_dup( Entry *e ) { - Entry *ret; - - ret = entry_alloc(); - entry_dup_to(e, ret); - - return ret; + return entry_dup2( entry_alloc(), e ); } #if 1 diff --git a/servers/slapd/proto-slap.h b/servers/slapd/proto-slap.h index f9cb9e9ac7..dc41cbd120 100644 --- a/servers/slapd/proto-slap.h +++ b/servers/slapd/proto-slap.h @@ -991,7 +991,7 @@ 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 )); -LDAP_SLAPD_F (int) entry_dup_to LDAP_P(( Entry *src, Entry *dest )); +LDAP_SLAPD_F (Entry *) entry_dup2 LDAP_P(( Entry *dest, Entry *src )); LDAP_SLAPD_F (Entry *) entry_dup_bv LDAP_P(( Entry *e )); LDAP_SLAPD_F (Entry *) entry_alloc LDAP_P((void)); LDAP_SLAPD_F (int) entry_prealloc LDAP_P((int num)); -- 2.39.5