From c0a0deec86c79d276bc4443fd0f6aef7b6b12f9f Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Thu, 13 Dec 2012 11:20:20 +0100 Subject: Add clean target. Fix broken c++ compilation, add c++ compilation test to Makefile --- debug.c | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) (limited to 'debug.c') diff --git a/debug.c b/debug.c index 8b48204..5c04b61 100644 --- a/debug.c +++ b/debug.c @@ -51,18 +51,35 @@ struct dbg_config_t { unsigned int flags; -#ifdef WITH_DBG_MUTEX - pthread_mutex_t mutex; -#endif int fd; int file_fd; int stdout_no_date; +#ifdef WITH_DBG_MUTEX + pthread_mutex_t mutex; +#endif #ifdef WITH_DBG_SYSLOG const char* syslog_host; int syslog_port; #endif -};// dbg_config;// = { .flags = DBG_FLAG_DEFAULT, .fd = -1, .file_fd = -1 }; -static struct dbg_config_t dbg_config; +} dbg_config = { + DBG_FLAG_DEFAULT, // flags + -1, // fd + -1, // file_fd + 0, //stdout_no_date +#ifdef WITH_DBG_MUTEX + {}, // mutex; +#endif +#ifdef WITH_DBG_SYSLOG + "", // syslog_host; + -1, // syslog_port; +#endif + /* // This doesn't work in C++ + .flags = DBG_FLAG_DEFAULT, + .fd = -1, + .file_fd = -1, + .stdout_no_date = 0 + */ +}; static void dbg_mutex_init() { @@ -109,10 +126,6 @@ dbg_status_t dbg_init(unsigned int flags, ...) dbg_config.flags = flags; - dbg_config.fd = -1; - dbg_config.file_fd = -1; - dbg_config.stdout_no_date = 0; - int end = 0; va_list vl; @@ -289,4 +302,3 @@ done: return result; } - -- cgit v1.2.3