From 42de322f063b0141a45464aef4460a186b7f4efa Mon Sep 17 00:00:00 2001 From: Hallvard Furuseth Date: Fri, 6 Jun 2003 13:56:18 +0000 Subject: [PATCH] Make all debug output macros conditional on defined(LDAP_DEBUG). --- include/ldap_log.h | 8 +++++++- libraries/libldap/ldap-int.h | 10 ++++++++++ libraries/libldap/os-ip.c | 8 ++++++++ libraries/libldap/os-local.c | 8 ++++++++ 4 files changed, 33 insertions(+), 1 deletion(-) diff --git a/include/ldap_log.h b/include/ldap_log.h index 4e38b45ab5..51e19565d1 100644 --- a/include/ldap_log.h +++ b/include/ldap_log.h @@ -139,6 +139,9 @@ LDAP_BEGIN_DECL #ifdef NEW_LOGGING extern int ldap_loglevels[LDAP_SUBSYS_NUM]; + +#ifdef LDAP_DEBUG + #define LDAP_LOG(a, b, fmt, arg1, arg2, arg3) do {\ if (ldap_loglevels[LDAP_SUBSYS_##a] >= LDAP_LEVEL_##b || \ ldap_loglevels[LDAP_SUBSYS_GLOBAL] >= LDAP_LEVEL_##b)\ @@ -150,10 +153,13 @@ extern int ldap_loglevels[LDAP_SUBSYS_NUM]; (ldap_loglevels[LDAP_SUBSYS_##a] >= LDAP_LEVEL_##b || \ ldap_loglevels[LDAP_SUBSYS_GLOBAL] >= LDAP_LEVEL_##b) -#endif /* LDAP_LOG */ +#endif /* LDAP_DEBUG */ + +#endif /* NEW_LOGGING */ #ifndef LDAP_LOG #define LDAP_LOG(a, b, fmt, arg1, arg2, arg3) +#define LDAP_LOGS_TEST(a, b) 0 #endif LDAP_LUTIL_F(int) lutil_mnem2level LDAP_P(( const char *level )); diff --git a/libraries/libldap/ldap-int.h b/libraries/libldap/ldap-int.h index 790b727895..1ba930d1e5 100644 --- a/libraries/libldap/ldap-int.h +++ b/libraries/libldap/ldap-int.h @@ -58,6 +58,9 @@ #include "ldap_log.h" #undef Debug + +#ifdef LDAP_DEBUG + #define Debug( level, fmt, arg1, arg2, arg3 ) \ do { if ( ldap_debug & level ) \ ldap_log_printf( NULL, (level), (fmt), (arg1), (arg2), (arg3) ); \ @@ -66,6 +69,13 @@ #define LDAP_Debug( subsystem, level, fmt, arg1, arg2, arg3 )\ ldap_log_printf( NULL, (level), (fmt), (arg1), (arg2), (arg3) ) +#else + +#define Debug( level, fmt, arg1, arg2, arg3 ) ((void)0) +#define LDAP_Debug( subsystem, level, fmt, arg1, arg2, arg3 ) ((void)0) + +#endif /* LDAP_DEBUG */ + #include "ldap.h" #include "ldap_pvt.h" diff --git a/libraries/libldap/os-ip.c b/libraries/libldap/os-ip.c index 5d097e415f..57195918db 100644 --- a/libraries/libldap/os-ip.c +++ b/libraries/libldap/os-ip.c @@ -52,11 +52,19 @@ int ldap_int_inet4or6 = AF_INET; * ftp://koobera.math.uic.edu/www/docs/connect.html. */ +#ifdef LDAP_DEBUG + #define osip_debug(ld,fmt,arg1,arg2,arg3) \ do { \ ldap_log_printf(NULL, LDAP_DEBUG_TRACE, fmt, arg1, arg2, arg3); \ } while(0) +#else + +#define osip_debug(ld,fmt,arg1,arg2,arg3) ((void)0) + +#endif /* LDAP_DEBUG */ + static void ldap_pvt_set_errno(int err) { diff --git a/libraries/libldap/os-local.c b/libraries/libldap/os-local.c index 66386abe12..0210e44ae6 100644 --- a/libraries/libldap/os-local.c +++ b/libraries/libldap/os-local.c @@ -47,11 +47,19 @@ /* int ldap_int_tblsize = 0; */ +#ifdef LDAP_DEBUG + #define oslocal_debug(ld,fmt,arg1,arg2,arg3) \ do { \ ldap_log_printf(ld, LDAP_DEBUG_TRACE, fmt, arg1, arg2, arg3); \ } while(0) +#else + +#define oslocal_debug(ld,fmt,arg1,arg2,arg3) ((void)0) + +#endif /* LDAP_DEBUG */ + static void ldap_pvt_set_errno(int err) { -- 2.39.5