summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
Diffstat (limited to 'source3')
-rw-r--r--source3/include/debug.h12
-rw-r--r--source3/include/proto.h3
-rw-r--r--source3/lib/debug.c12
3 files changed, 18 insertions, 9 deletions
diff --git a/source3/include/debug.h b/source3/include/debug.h
index d1716320b3..56d0237c3f 100644
--- a/source3/include/debug.h
+++ b/source3/include/debug.h
@@ -40,11 +40,13 @@
int Debug1( const char *, ... ) PRINTF_ATTRIBUTE(1,2);
/* PRINTFLIKE1 */
bool dbgtext( const char *, ... ) PRINTF_ATTRIBUTE(1,2);
-bool dbghdr( int level, int cls, const char *file, const char *func, int line );
+bool dbghdrclass( int level, int cls, const char *location, const char *func);
+bool dbghdr( int level, const char *location, const char *func);
#if defined(sgi) && (_COMPILER_VERSION >= 730)
#pragma mips_frequency_hint NEVER Debug1
#pragma mips_frequency_hint NEVER dbgtext
+#pragma mips_frequency_hint NEVER dbghdrclass
#pragma mips_frequency_hint NEVER dbghdr
#endif
@@ -192,7 +194,7 @@ extern bool *DEBUGLEVEL_CLASS_ISSET;
#define DEBUGLVL( level ) \
( CHECK_DEBUGLVL(level) \
- && dbghdr( level, DBGC_CLASS, __FILE__, FUNCTION_MACRO, (__LINE__) ) )
+ && dbghdrclass( level, DBGC_CLASS, __location__, FUNCTION_MACRO ) )
#define DEBUGLVLC( dbgc_class, level ) \
@@ -200,7 +202,7 @@ extern bool *DEBUGLEVEL_CLASS_ISSET;
unlikely((DEBUGLEVEL_CLASS[ dbgc_class ] >= (level))|| \
(!DEBUGLEVEL_CLASS_ISSET[ dbgc_class ] && \
DEBUGLEVEL_CLASS[ DBGC_ALL ] >= (level)) ) \
- && dbghdr( level, DBGC_CLASS, __FILE__, FUNCTION_MACRO, (__LINE__) ) )
+ && dbghdrclass( level, DBGC_CLASS, __location__, FUNCTION_MACRO) )
#define DEBUG( level, body ) \
@@ -208,7 +210,7 @@ extern bool *DEBUGLEVEL_CLASS_ISSET;
unlikely((DEBUGLEVEL_CLASS[ DBGC_CLASS ] >= (level))|| \
(!DEBUGLEVEL_CLASS_ISSET[ DBGC_CLASS ] && \
DEBUGLEVEL_CLASS[ DBGC_ALL ] >= (level)) ) \
- && (dbghdr( level, DBGC_CLASS, __FILE__, FUNCTION_MACRO, (__LINE__) )) \
+ && (dbghdrclass( level, DBGC_CLASS, __location__, FUNCTION_MACRO )) \
&& (dbgtext body) )
#define DEBUGC( dbgc_class, level, body ) \
@@ -216,7 +218,7 @@ extern bool *DEBUGLEVEL_CLASS_ISSET;
unlikely((DEBUGLEVEL_CLASS[ dbgc_class ] >= (level))|| \
(!DEBUGLEVEL_CLASS_ISSET[ dbgc_class ] && \
DEBUGLEVEL_CLASS[ DBGC_ALL ] >= (level)) ) \
- && (dbghdr( level, DBGC_CLASS, __FILE__, FUNCTION_MACRO, (__LINE__) )) \
+ && (dbghdrclass( level, DBGC_CLASS, __location__, FUNCTION_MACRO)) \
&& (dbgtext body) )
#define DEBUGADD( level, body ) \
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 3df87a6c34..bf66908fd1 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -486,7 +486,8 @@ void force_check_log_size( void );
bool need_to_check_log_size( void );
void check_log_size( void );
void dbgflush( void );
-bool dbghdr(int level, int cls, const char *file, const char *func, int line);
+bool dbghdrclass(int level, int cls, const char *location, const char *func);
+bool dbghdr(int level, const char *location, const char *func);
TALLOC_CTX *debug_ctx(void);
/* The following definitions come from lib/display_sec.c */
diff --git a/source3/lib/debug.c b/source3/lib/debug.c
index d91b55dd23..be2707b595 100644
--- a/source3/lib/debug.c
+++ b/source3/lib/debug.c
@@ -984,7 +984,7 @@ void dbgflush( void )
****************************************************************************/
-bool dbghdr(int level, int cls, const char *file, const char *func, int line)
+bool dbghdrclass(int level, int cls, const char *location, const char *func)
{
/* Ensure we don't lose any real errno value. */
int old_errno = errno;
@@ -1046,10 +1046,10 @@ bool dbghdr(int level, int cls, const char *file, const char *func, int line)
lp_debug_hires_timestamp()),
level, header_str);
} else {
- (void)Debug1( "[%s, %2d%s] %s:%s(%d)\n",
+ (void)Debug1( "[%s, %2d%s] %s(%s)\n",
current_timestring(debug_ctx(),
lp_debug_hires_timestamp()),
- level, header_str, file, func, line );
+ level, header_str, location, func );
}
}
@@ -1057,6 +1057,12 @@ bool dbghdr(int level, int cls, const char *file, const char *func, int line)
return( True );
}
+bool dbghdr(int level, const char *location, const char *func)
+{
+ /* For compatibility with Samba 4, which doesn't have debug classes */
+ return dbghdrclass(level, 0, location, func);
+}
+
/***************************************************************************
Add text to the body of the "current" debug message via the format buffer.