1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

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.
(This used to be commit f34cac3b31)
This commit is contained in:
Andrew Tridgell 2001-12-06 07:17:25 +00:00
parent d412f66cd8
commit 94dd5cded7
2 changed files with 21 additions and 6 deletions

View File

@ -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) )

View File

@ -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 */