From: Martin Mares Date: Mon, 10 May 2004 14:11:34 +0000 (+0000) Subject: Added xstrdup() and new logging functions. X-Git-Tag: holmes-import~1066 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=7f1288b27f2008215fcd08ee61612c1b52bfb727;p=libucw.git Added xstrdup() and new logging functions. --- diff --git a/lib/lib.h b/lib/lib.h index c06d8f5f..8370a605 100644 --- a/lib/lib.h +++ b/lib/lib.h @@ -55,6 +55,7 @@ #define L_FATAL '!' /* die() */ extern char *log_title; /* NULL - print no title, default is log_progname */ +extern int log_switch_nest; /* log_switch() nesting counter, increment to disable automatic switches */ void log_msg(unsigned int cat, const char *msg, ...) __attribute__((format(printf,2,3))); #define log log_msg @@ -63,6 +64,7 @@ void die(byte *, ...) NONRET; void log_init(byte *); void log_file(byte *); void log_fork(void); +void log_switch(void); #ifdef DEBUG void assert_failed(char *assertion, char *file, int line) NONRET; @@ -80,6 +82,9 @@ void assert_failed(void) NONRET; #define DBG(x,y...) do { } while(0) #endif +static inline void log_switch_enable(void) { log_switch_nest++; } +static inline void log_switch_disable(void) { ASSERT(log_switch_nest); log_switch_nest--; } + /* Memory allocation */ #ifdef DEBUG_DMALLOC @@ -106,7 +111,7 @@ void *xrealloc(void *, unsigned); #endif void *xmalloc_zero(unsigned); -byte *stralloc(byte *); +byte *xstrdup(byte *); /* Content-Type pattern matching and filters */