From e69dd73c3dd020c72d9d10ab76d6153c2a5c4b2b Mon Sep 17 00:00:00 2001 From: Stefan Sayer Date: Tue, 18 Mar 2008 00:13:44 +0000 Subject: [PATCH] const correct char* git-svn-id: http://svn.berlios.de/svnroot/repos/sems/trunk@800 8eb893ce-cfd4-0310-b710-fb5ebe64c474 --- core/log.cpp | 6 +++--- core/log.h | 54 ++++++++++++++++++++++++++-------------------------- 2 files changed, 30 insertions(+), 30 deletions(-) diff --git a/core/log.cpp b/core/log.cpp index 02f978a4..e9f3af78 100644 --- a/core/log.cpp +++ b/core/log.cpp @@ -93,7 +93,7 @@ void set_log_facility(const char* facility) { } } -void dprint(int level, const char* fct, char* file, int line, char* fmt, ...) +void dprint(int level, const char* fct, const char* file, int line, const char* fmt, ...) { va_list ap; @@ -104,7 +104,7 @@ void dprint(int level, const char* fct, char* file, int line, char* fmt, ...) va_end(ap); } -void log_print (int level, char* fmt, ...) +void log_print (int level, const char* fmt, ...) { va_list ap; @@ -115,7 +115,7 @@ void log_print (int level, char* fmt, ...) va_end(ap); } -void log_fac_print(int level, const char* fct, char* file, int line, char* fmt, ...) +void log_fac_print(int level, const char* fct, const char* file, int line, const char* fmt, ...) { va_list ap; char logline[512]; diff --git a/core/log.h b/core/log.h index c02e0176..3d0e0e68 100644 --- a/core/log.h +++ b/core/log.h @@ -52,10 +52,10 @@ extern "C" { void init_log(); void set_log_facility(const char* facility); - void dprint (int level, const char* fct, char* file, int line, char* fmt, ...); - void log_print (int level, char* fmt, ...); + void dprint (int level, const char* fct, const char* file, int line, const char* fmt, ...); + void log_print (int level, const char* fmt, ...); void register_logging_fac(void*); - void log_fac_print(int level, const char* fct, char* file, int line, char* fmt, ...); + void log_fac_print(int level, const char* fct, const char* file, int line, const char* fmt, ...); #ifdef _DEBUG #define LOG_PRINT(level, args... ) dprint( level, __FUNCTION__, __FILE__, __LINE__, ##args ) @@ -67,30 +67,30 @@ extern "C" { #if __GNUC__ < 3 #define _LOG(level,fmt...) LOG_PRINT(level,##fmt) #else -#define _LOG(level, fmt, args...) \ - do{\ - if((level)<=log_level) {\ - if(log_stderr)\ - LOG_PRINT( level, fmt, ##args );\ - else {\ - switch(level){\ - case L_ERR:\ - syslog(LOG_ERR, "Error: (%s)(%s)(%i): " fmt, __FILE__, __FUNCTION__, __LINE__, ##args);\ - break;\ - case L_WARN:\ - syslog(LOG_WARNING, "Warning: (%s)(%s)(%i): " fmt, __FILE__, __FUNCTION__, __LINE__, ##args);\ - break;\ - case L_INFO:\ - syslog(LOG_INFO, "Info: (%s)(%s)(%i): " fmt, __FILE__, __FUNCTION__, __LINE__, ##args);\ - break;\ - case L_DBG:\ - syslog(LOG_DEBUG, "Debug: (%s)(%s)(%i): " fmt, __FILE__, __FUNCTION__, __LINE__, ##args);\ - break;\ - }\ - }\ - }\ - LOG_FAC_PRINT( level, fmt, ##args );\ - }while(0) +#define _LOG(level, fmt, args...) \ + do{ \ + if((level)<=log_level) { \ + if(log_stderr) \ + LOG_PRINT( level, fmt, ##args ); \ + else { \ + switch(level){ \ + case L_ERR: \ + syslog(LOG_ERR, (char*)("Error: (%s)(%s)(%i): " fmt), __FILE__, __FUNCTION__, __LINE__, ##args); \ + break; \ + case L_WARN: \ + syslog(LOG_WARNING, (char*)("Warning: (%s)(%s)(%i): " fmt), __FILE__, __FUNCTION__, __LINE__, ##args); \ + break; \ + case L_INFO: \ + syslog(LOG_INFO, (char*)("Info: (%s)(%s)(%i): " fmt), __FILE__, __FUNCTION__, __LINE__, ##args); \ + break; \ + case L_DBG: \ + syslog(LOG_DEBUG, (char*)("Debug: (%s)(%s)(%i): " fmt), __FILE__, __FUNCTION__, __LINE__, ##args); \ + break; \ + } \ + } \ + } \ + LOG_FAC_PRINT( level, fmt, ##args ); \ + }while(0) #endif