From bdac543b3bb58b2172fdb31d10211ecfd02609c3 Mon Sep 17 00:00:00 2001
From: Howard Chu <hyc@openldap.org>
Date: Thu, 18 Oct 2007 01:35:07 +0000
Subject: [PATCH] Cleanup debug calls

---
 libraries/liblber/decode.c | 8 +++++---
 libraries/liblber/io.c     | 6 ++++--
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/libraries/liblber/decode.c b/libraries/liblber/decode.c
index f2261e7bd5..0870f0b7b4 100644
--- a/libraries/liblber/decode.c
+++ b/libraries/liblber/decode.c
@@ -780,9 +780,11 @@ ber_scanf ( BerElement *ber,
 
 	fmt_reset = fmt;
 
-	ber_log_printf( LDAP_DEBUG_TRACE, ber->ber_debug,
-		"ber_scanf fmt (%s) ber:\n", fmt );
-	ber_log_dump( LDAP_DEBUG_BER, ber->ber_debug, ber, 1 );
+	if ( ber->ber_debug & (LDAP_DEBUG_TRACE|LDAP_DEBUG_BER)) {
+		ber_log_printf( LDAP_DEBUG_TRACE, ber->ber_debug,
+			"ber_scanf fmt (%s) ber:\n", fmt );
+		ber_log_dump( LDAP_DEBUG_BER, ber->ber_debug, ber, 1 );
+	}
 
 	for ( rc = 0; *fmt && rc != LBER_DEFAULT; fmt++ ) {
 		/* When this is modified, remember to update
diff --git a/libraries/liblber/io.c b/libraries/liblber/io.c
index 4f4afa390f..391996704b 100644
--- a/libraries/liblber/io.c
+++ b/libraries/liblber/io.c
@@ -488,8 +488,10 @@ ber_get_next(
 	assert( SOCKBUF_VALID( sb ) );
 	assert( LBER_VALID( ber ) );
 
-	ber_log_printf( LDAP_DEBUG_TRACE, ber->ber_debug,
-		"ber_get_next\n" );
+	if ( ber->ber_debug & LDAP_DEBUG_TRACE ) {
+		ber_log_printf( LDAP_DEBUG_TRACE, ber->ber_debug,
+			"ber_get_next\n" );
+	}
 
 	/*
 	 * Any ber element looks like this: tag length contents.
-- 
GitLab