]> mj.ucw.cz Git - libucw.git/commitdiff
Added xstrdup() and new logging functions.
authorMartin Mares <mj@ucw.cz>
Mon, 10 May 2004 14:11:34 +0000 (14:11 +0000)
committerMartin Mares <mj@ucw.cz>
Mon, 10 May 2004 14:11:34 +0000 (14:11 +0000)
lib/lib.h

index c06d8f5feabc127caf3268da1e13eb337959e8aa..8370a6050a21e8ebd4da6fdc565d44ccbb65eb73 100644 (file)
--- 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 */