From: Howard Chu Date: Tue, 22 Apr 2003 18:59:37 +0000 (+0000) Subject: Omit bei_rdn field from EntryInfo X-Git-Tag: OPENLDAP_REL_ENG_2_2_0ALPHA~287 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=c7d3d42304890863c2c2ca36d001cd4df57ce014;p=openldap Omit bei_rdn field from EntryInfo --- diff --git a/servers/slapd/back-bdb/back-bdb.h b/servers/slapd/back-bdb/back-bdb.h index c6743eb315..d1028051dd 100644 --- a/servers/slapd/back-bdb/back-bdb.h +++ b/servers/slapd/back-bdb/back-bdb.h @@ -90,7 +90,9 @@ typedef struct bdb_entry_info { * remaining fields require backend cache lock to access */ struct berval bei_nrdn; +#ifdef BDB_HIER struct berval bei_rdn; +#endif Entry *bei_e; Avlnode *bei_kids; ldap_pvt_thread_mutex_t bei_kids_mutex; @@ -149,8 +151,6 @@ struct bdb_info { int bi_lock_detect; long bi_shm_key; - int bi_is_hier; - ID bi_lastid; ldap_pvt_thread_mutex_t bi_lastid_mutex; #if defined(LDAP_CLIENT_UPDATE) || defined(LDAP_SYNC) diff --git a/servers/slapd/back-bdb/cache.c b/servers/slapd/back-bdb/cache.c index 3437ef3c75..b3dbd63eaa 100644 --- a/servers/slapd/back-bdb/cache.c +++ b/servers/slapd/back-bdb/cache.c @@ -269,7 +269,9 @@ bdb_entryinfo_add_internal( } ei2->bei_id = ei->bei_id; ei2->bei_parent = ei->bei_parent; +#ifdef BDB_HIER ei2->bei_rdn = ei->bei_rdn; +#endif /* Add to cache ID tree */ if (avl_insert( &cache->c_idtree, ei2, bdb_id_cmp, avl_dup_error )) { @@ -279,8 +281,10 @@ bdb_entryinfo_add_internal( ei2 = eix; addkid = 0; cache->c_cursize -= incr; +#ifdef BDB_HIER if ( ei->bei_rdn.bv_val ) ber_memfree_x( ei->bei_rdn.bv_val, NULL ); +#endif } else { LRU_ADD( cache, ei2 ); ber_dupbv( &ei2->bei_nrdn, &ei->bei_nrdn ); @@ -421,9 +425,11 @@ bdb_cache_find_parent( /* Create a new node for the current ID */ ein = bdb_cache_entryinfo_new(); ein->bei_id = ei.bei_id; + ein->bei_kids = ei.bei_kids; ein->bei_nrdn = ei.bei_nrdn; +#ifdef BDB_HIER ein->bei_rdn = ei.bei_rdn; - ein->bei_kids = ei.bei_kids; +#endif /* This node is not fully connected yet */ ein->bei_state = CACHE_ENTRY_NOT_LINKED; @@ -618,11 +624,13 @@ bdb_cache_add( ei.bei_id = e->e_id; ei.bei_parent = eip; ei.bei_nrdn = *nrdn; +#ifdef BDB_HIER if ( nrdn->bv_len != e->e_nname.bv_len ) { char *ptr = strchr( rdn.bv_val, ',' ); rdn.bv_len = ptr - rdn.bv_val; } ber_dupbv( &ei.bei_rdn, &rdn ); +#endif rc = bdb_entryinfo_add_internal( bdb, &ei, &new, locker ); new->bei_e = e; e->e_private = new; @@ -703,14 +711,17 @@ bdb_cache_modrdn( bdb_cache_entryinfo_lock( pei ); avl_delete( &pei->bei_kids, (caddr_t) ei, bdb_rdn_cmp ); free( ei->bei_nrdn.bv_val ); - free( ei->bei_rdn.bv_val ); ber_dupbv( &ei->bei_nrdn, nrdn ); +#ifdef BDB_HIER + free( ei->bei_rdn.bv_val ); + rdn = e->e_name; if ( nrdn->bv_len != e->e_nname.bv_len ) { char *ptr = strchr(rdn.bv_val, ','); rdn.bv_len = ptr - rdn.bv_val; } ber_dupbv( &ei->bei_rdn, &rdn ); +#endif if (!ein) { ein = ei->bei_parent; diff --git a/servers/slapd/back-bdb/dn2id.c b/servers/slapd/back-bdb/dn2id.c index 4dea214cd4..810eee1842 100644 --- a/servers/slapd/back-bdb/dn2id.c +++ b/servers/slapd/back-bdb/dn2id.c @@ -313,7 +313,6 @@ bdb_dn2id( #else Debug( LDAP_DEBUG_TRACE, "=> bdb_dn2id( \"%s\" )\n", dn->bv_val, 0, 0 ); #endif - DBTzero( &key ); key.size = dn->bv_len + 2; key.data = sl_malloc( key.size, ctx );