From: Kurt Zeilenga Date: Thu, 11 Feb 1999 17:52:28 +0000 (+0000) Subject: Complete entry_cmp() migration (remove rename macros). X-Git-Tag: OPENLDAP_SLAPD_BACK_LDAP~596 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=c2c0d9687f9e288eae147fcbdd6c85fdd861a56d;p=openldap Complete entry_cmp() migration (remove rename macros). --- diff --git a/servers/slapd/back-bdb2/cache.c b/servers/slapd/back-bdb2/cache.c index 8c95392d28..2917f52e56 100644 --- a/servers/slapd/back-bdb2/cache.c +++ b/servers/slapd/back-bdb2/cache.c @@ -17,20 +17,6 @@ static int cache_delete_entry_internal(struct cache *cache, Entry *e); static void lru_print(struct cache *cache); #endif -/* - * the cache has three entry points (ways to find things): - * - * by entry e.g., if you already have an entry from the cache - * and want to delete it. (really by entry ptr) - * by dn e.g., when looking for the base object of a search - * by id e.g., for search candidates - * - * these correspond to three different avl trees that are maintained. - */ -#define cache_entry_cmp entry_cmp -#define cache_entrydn_cmp entry_dn_cmp -#define cache_entryid_cmp entry_id_cmp - void bdb2i_cache_set_state( struct cache *cache, Entry *e, int state ) { @@ -136,7 +122,7 @@ bdb2i_cache_add_entry_lock( ldap_pvt_thread_mutex_lock( &cache->c_mutex ); if ( avl_insert( &cache->c_dntree, (caddr_t) e, - cache_entrydn_cmp, avl_dup_error ) != 0 ) + entry_dn_cmp, avl_dup_error ) != 0 ) { Debug( LDAP_DEBUG_TRACE, "====> cache_add_entry lock: entry %20s id %lu already in dn cache\n", @@ -149,7 +135,7 @@ bdb2i_cache_add_entry_lock( /* id tree */ if ( avl_insert( &cache->c_idtree, (caddr_t) e, - cache_entryid_cmp, avl_dup_error ) != 0 ) + entry_id_cmp, avl_dup_error ) != 0 ) { Debug( LDAP_DEBUG_ANY, "====> entry %20s id %lu already in id cache\n", @@ -157,7 +143,7 @@ bdb2i_cache_add_entry_lock( /* delete from dn tree inserted above */ if ( avl_delete( &cache->c_dntree, (caddr_t) e, - cache_entrydn_cmp ) == NULL ) + entry_dn_cmp ) == NULL ) { Debug( LDAP_DEBUG_ANY, "====> can't delete from dn cache\n", 0, 0, 0 ); @@ -236,7 +222,7 @@ bdb2i_cache_find_entry_dn2id( e.e_ndn = dn_normalize_case( ch_strdup( dn ) ); if ( (ep = (Entry *) avl_find( cache->c_dntree, (caddr_t) &e, - cache_entrydn_cmp )) != NULL ) + entry_dn_cmp )) != NULL ) { /* * ep now points to an unlocked entry @@ -301,7 +287,7 @@ try_again: ldap_pvt_thread_mutex_lock( &cache->c_mutex ); if ( (ep = (Entry *) avl_find( cache->c_idtree, (caddr_t) &e, - cache_entryid_cmp )) != NULL ) + entry_id_cmp )) != NULL ) { Debug(LDAP_DEBUG_TRACE, "====> cache_find_entry_dn2id: found id: %ld rw: %d\n", @@ -394,14 +380,14 @@ cache_delete_entry_internal( int rc = 0; /* return code */ /* dn tree */ - if ( avl_delete( &cache->c_dntree, (caddr_t) e, cache_entrydn_cmp ) + if ( avl_delete( &cache->c_dntree, (caddr_t) e, entry_dn_cmp ) == NULL ) { rc = -1; } /* id tree */ - if ( avl_delete( &cache->c_idtree, (caddr_t) e, cache_entryid_cmp ) + if ( avl_delete( &cache->c_idtree, (caddr_t) e, entry_id_cmp ) == NULL ) { rc = -1; diff --git a/servers/slapd/back-ldbm/cache.c b/servers/slapd/back-ldbm/cache.c index a1877e0738..b37f1c6de5 100644 --- a/servers/slapd/back-ldbm/cache.c +++ b/servers/slapd/back-ldbm/cache.c @@ -38,20 +38,6 @@ static int cache_delete_entry_internal(struct cache *cache, Entry *e); static void lru_print(struct cache *cache); #endif -/* - * the cache has three entry points (ways to find things): - * - * by entry e.g., if you already have an entry from the cache - * and want to delete it. (really by entry ptr) - * by dn e.g., when looking for the base object of a search - * by id e.g., for search candidates - * - * these correspond to three different avl trees that are maintained. - */ -#define cache_entry_cmp entry_cmp -#define cache_entrydn_cmp entry_dn_cmp -#define cache_entryid_cmp entry_id_cmp - static int cache_entry_rdwr_lock(Entry *e, int rw) { @@ -244,7 +230,7 @@ cache_add_entry_rw( } if ( avl_insert( &cache->c_dntree, (caddr_t) e, - cache_entrydn_cmp, avl_dup_error ) != 0 ) + entry_dn_cmp, avl_dup_error ) != 0 ) { Debug( LDAP_DEBUG_TRACE, "====> cache_add_entry( %lu ): \"%s\": already in dn cache\n", @@ -259,7 +245,7 @@ cache_add_entry_rw( /* id tree */ if ( avl_insert( &cache->c_idtree, (caddr_t) e, - cache_entryid_cmp, avl_dup_error ) != 0 ) + entry_id_cmp, avl_dup_error ) != 0 ) { Debug( LDAP_DEBUG_ANY, "====> cache_add_entry( %lu ): \"%s\": already in id cache\n", @@ -268,7 +254,7 @@ cache_add_entry_rw( /* delete from dn tree inserted above */ if ( avl_delete( &cache->c_dntree, (caddr_t) e, - cache_entrydn_cmp ) == NULL ) + entry_dn_cmp ) == NULL ) { Debug( LDAP_DEBUG_ANY, "====> can't delete from dn cache\n", 0, 0, 0 ); @@ -353,7 +339,7 @@ cache_update_entry( #endif if ( avl_insert( &cache->c_dntree, (caddr_t) e, - cache_entrydn_cmp, avl_dup_error ) != 0 ) + entry_dn_cmp, avl_dup_error ) != 0 ) { Debug( LDAP_DEBUG_TRACE, "====> cache_update_entry( %lu ): \"%s\": already in dn cache\n", @@ -366,7 +352,7 @@ cache_update_entry( /* id tree */ if ( avl_insert( &cache->c_idtree, (caddr_t) e, - cache_entryid_cmp, avl_dup_error ) != 0 ) + entry_id_cmp, avl_dup_error ) != 0 ) { Debug( LDAP_DEBUG_ANY, "====> cache_update_entry( %lu ): \"%s\": already in id cache\n", @@ -374,7 +360,7 @@ cache_update_entry( /* delete from dn tree inserted above */ if ( avl_delete( &cache->c_dntree, (caddr_t) e, - cache_entrydn_cmp ) == NULL ) + entry_dn_cmp ) == NULL ) { Debug( LDAP_DEBUG_ANY, "====> can't delete from dn cache\n", 0, 0, 0 ); @@ -454,7 +440,7 @@ cache_find_entry_dn2id( e.e_ndn = dn_normalize_case( ch_strdup( dn ) ); if ( (ep = (Entry *) avl_find( cache->c_dntree, (caddr_t) &e, - cache_entrydn_cmp )) != NULL ) + entry_dn_cmp )) != NULL ) { /* * ep now points to an unlocked entry @@ -528,7 +514,7 @@ try_again: ldap_pvt_thread_mutex_lock( &cache->c_mutex ); if ( (ep = (Entry *) avl_find( cache->c_idtree, (caddr_t) &e, - cache_entryid_cmp )) != NULL ) + entry_id_cmp )) != NULL ) { #ifdef LDAP_DEBUG assert( ep->e_private ); @@ -629,14 +615,14 @@ cache_delete_entry_internal( int rc = 0; /* return code */ /* dn tree */ - if ( avl_delete( &cache->c_dntree, (caddr_t) e, cache_entrydn_cmp ) + if ( avl_delete( &cache->c_dntree, (caddr_t) e, entry_dn_cmp ) == NULL ) { rc = -1; } /* id tree */ - if ( avl_delete( &cache->c_idtree, (caddr_t) e, cache_entryid_cmp ) + if ( avl_delete( &cache->c_idtree, (caddr_t) e, entry_id_cmp ) == NULL ) { rc = -1;