From 83ec12246ed6074a19971a9620d27c9cd60cf5c3 Mon Sep 17 00:00:00 2001 From: Hallvard Furuseth Date: Thu, 5 Nov 1998 05:03:12 +0000 Subject: [PATCH] Enclose debug variables in #ifdef LDAP_DEBUG --- include/lber.h | 2 ++ include/ldap.h | 2 ++ servers/slapd/aclparse.c | 5 +++-- servers/slapd/back-ldbm/cache.c | 4 ++++ servers/slapd/back-ldbm/id2entry.c | 2 ++ servers/slapd/entry.c | 2 ++ 6 files changed, 15 insertions(+), 2 deletions(-) diff --git a/include/lber.h b/include/lber.h index e2745a1679..a2e006fab3 100644 --- a/include/lber.h +++ b/include/lber.h @@ -92,7 +92,9 @@ struct berval { char *bv_val; }; +#ifdef LDAP_DEBUG extern int lber_debug; +#endif /* * in bprint.c: diff --git a/include/ldap.h b/include/ldap.h index a0b0edc161..c2501db475 100644 --- a/include/ldap.h +++ b/include/ldap.h @@ -67,7 +67,9 @@ LDAP_BEGIN_DECL #define LDAP_OPT_SUCCESS 0 #define LDAP_OPT_ERROR (-1) +#ifdef LDAP_DEBUG extern int ldap_debug; +#endif #define LDAP_API_INFO_VERSION 1 typedef struct ldapapiinfo { diff --git a/servers/slapd/aclparse.c b/servers/slapd/aclparse.c index cc208217bb..e47a00380a 100644 --- a/servers/slapd/aclparse.c +++ b/servers/slapd/aclparse.c @@ -293,9 +293,10 @@ parse_acl( } else { - if (ldap_debug&LDAP_DEBUG_ACL) +#ifdef LDAP_DEBUG + if (ldap_debug & LDAP_DEBUG_ACL) print_acl(a); - +#endif if ( a->acl_access == NULL ) { fprintf( stderr, diff --git a/servers/slapd/back-ldbm/cache.c b/servers/slapd/back-ldbm/cache.c index 940a226b84..4f2fa10107 100644 --- a/servers/slapd/back-ldbm/cache.c +++ b/servers/slapd/back-ldbm/cache.c @@ -198,7 +198,9 @@ cache_add_entry_lock( e = cache->c_lrutail; /* XXX check for writer lock - should also check no readers pending */ +#ifdef LDAP_DEBUG assert(pthread_rdwr_wchk_np(&e->e_rdwr)); +#endif /* delete from cache and lru q */ rc = cache_delete_entry_internal( cache, e ); @@ -394,7 +396,9 @@ cache_delete_entry( Debug( LDAP_DEBUG_TRACE, "====> cache_delete_entry:\n", 0, 0, 0 ); /* XXX check for writer lock - should also check no readers pending */ +#ifdef LDAP_DEBUG assert(pthread_rdwr_wchk_np(&e->e_rdwr)); +#endif /* set cache mutex */ pthread_mutex_lock( &cache->c_mutex ); diff --git a/servers/slapd/back-ldbm/id2entry.c b/servers/slapd/back-ldbm/id2entry.c index b2f0aebf8d..c458ca503f 100644 --- a/servers/slapd/back-ldbm/id2entry.c +++ b/servers/slapd/back-ldbm/id2entry.c @@ -74,7 +74,9 @@ id2entry_delete( Backend *be, Entry *e ) e->e_dn, 0 ); /* XXX - check for writer lock - should also check no reader pending */ +#ifdef LDAP_DEBUG assert(pthread_rdwr_wchk_np(&e->e_rdwr)); +#endif #ifdef HAVE_BERKELEY_DB2 memset( &key, 0, sizeof( key ) ); diff --git a/servers/slapd/entry.c b/servers/slapd/entry.c index c0474e2023..80617959e0 100644 --- a/servers/slapd/entry.c +++ b/servers/slapd/entry.c @@ -195,8 +195,10 @@ entry_free( Entry *e ) Attribute *a, *next; /* XXX check that no reader/writer locks exist */ +#ifdef LDAP_DEBUG assert( !pthread_rdwr_wchk_np(&e->e_rdwr) && !pthread_rdwr_rchk_np(&e->e_rdwr) ); +#endif if ( e->e_dn != NULL ) { free( e->e_dn ); -- 2.39.5