summaryrefslogtreecommitdiff
path: root/source/include
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2001-12-06 07:17:25 +0000
committerAndrew Tridgell <tridge@samba.org>2001-12-06 07:17:25 +0000
commitf34cac3b312f273a2363919655ddd1e25cb91305 (patch)
treecb8e319f1f0813d6a7b0a6b38c52186467073837 /source/include
parent3ace8f1fcc27492d26f5ad0c3cdfc63235ca0609 (diff)
downloadsamba-f34cac3b312f273a2363919655ddd1e25cb91305.tar.gz
allow a MAX_DEBUG_LEVEL setting in local.h (or the Makefile)
This allows embedded systems to compile out the higher debug levels. It should gain speed as well as reducing the code size. Setting it to 1 saves about 300k of code on my system.
Diffstat (limited to 'source/include')
-rw-r--r--source/include/debug.h18
-rw-r--r--source/include/local.h9
2 files changed, 21 insertions, 6 deletions
diff --git a/source/include/debug.h b/source/include/debug.h
index cad802d8ca3..37eaed2b124 100644
--- a/source/include/debug.h
+++ b/source/include/debug.h
@@ -150,41 +150,47 @@ struct debuglevel_message {
*/
#define DEBUGLVL( level ) \
- ( ((DEBUGLEVEL_CLASS[ DBGC_CLASS ] >= (level))|| \
+ ( ((level) <= MAX_DEBUG_LEVEL) && \
+ ((DEBUGLEVEL_CLASS[ DBGC_CLASS ] >= (level))|| \
(!DEBUGLEVEL_CLASS[ DBGC_CLASS ] && \
DEBUGLEVEL_CLASS[ DBGC_ALL ] >= (level)) ) \
&& dbghdr( level, FILE_MACRO, FUNCTION_MACRO, (__LINE__) ) )
#define DEBUGLVLC( dbgc_class, level ) \
- ( ((DEBUGLEVEL_CLASS[ dbgc_class ] >= (level))|| \
+ ( ((level) <= MAX_DEBUG_LEVEL) && \
+ ((DEBUGLEVEL_CLASS[ dbgc_class ] >= (level))|| \
(!DEBUGLEVEL_CLASS_ISSET[ dbgc_class ] && \
DEBUGLEVEL_CLASS[ DBGC_ALL ] >= (level)) ) \
&& dbghdr( level, FILE_MACRO, FUNCTION_MACRO, (__LINE__) ) )
#define DEBUG( level, body ) \
- (void)( ((DEBUGLEVEL_CLASS[ DBGC_CLASS ] >= (level))|| \
+ (void)( ((level) <= MAX_DEBUG_LEVEL) && \
+ ((DEBUGLEVEL_CLASS[ DBGC_CLASS ] >= (level))|| \
(!DEBUGLEVEL_CLASS_ISSET[ DBGC_CLASS ] && \
DEBUGLEVEL_CLASS[ DBGC_ALL ] >= (level)) ) \
&& (dbghdr( level, FILE_MACRO, FUNCTION_MACRO, (__LINE__) )) \
&& (dbgtext body) )
#define DEBUGC( dbgc_class, level, body ) \
- (void)( ((DEBUGLEVEL_CLASS[ dbgc_class ] >= (level))|| \
+ (void)( ((level) <= MAX_DEBUG_LEVEL) && \
+ ((DEBUGLEVEL_CLASS[ dbgc_class ] >= (level))|| \
(!DEBUGLEVEL_CLASS_ISSET[ dbgc_class ] && \
DEBUGLEVEL_CLASS[ DBGC_ALL ] >= (level)) ) \
&& (dbghdr( level, FILE_MACRO, FUNCTION_MACRO, (__LINE__) )) \
&& (dbgtext body) )
#define DEBUGADD( level, body ) \
- (void)( ((DEBUGLEVEL_CLASS[ DBGC_CLASS ] >= (level))|| \
+ (void)( ((level) <= MAX_DEBUG_LEVEL) && \
+ ((DEBUGLEVEL_CLASS[ DBGC_CLASS ] >= (level))|| \
(!DEBUGLEVEL_CLASS_ISSET[ DBGC_CLASS ] && \
DEBUGLEVEL_CLASS[ DBGC_ALL ] >= (level)) ) \
&& (dbgtext body) )
#define DEBUGADDC( dbgc_class, level, body ) \
- (void)( ((DEBUGLEVEL_CLASS[ dbgc_class ] >= (level))|| \
+ (void)( ((level) <= MAX_DEBUG_LEVEL) && \
+ ((DEBUGLEVEL_CLASS[ dbgc_class ] >= (level))|| \
(!DEBUGLEVEL_CLASS_ISSET[ dbgc_class ] && \
DEBUGLEVEL_CLASS[ DBGC_ALL ] >= (level)) ) \
&& (dbgtext body) )
diff --git a/source/include/local.h b/source/include/local.h
index cec48850a9c..da9fee05642 100644
--- a/source/include/local.h
+++ b/source/include/local.h
@@ -10,6 +10,15 @@
#define WORKGROUP "WORKGROUP"
#endif
+/* the maximum debug level to compile into the code. This assumes a good
+ optimising compiler that can remove unused code
+ for embedded or low-memory systems set this to a value like 2 to get
+ only important messages. This gives *much* smaller binaries
+*/
+#ifndef MAX_DEBUG_LEVEL
+#define MAX_DEBUG_LEVEL 1000
+#endif
+
/* This defines the section name in the configuration file that will contain */
/* global parameters - that is, parameters relating to the whole server, not */
/* just services. This name is then reserved, and may not be used as a */