diff options
Diffstat (limited to 'debug.c')
-rw-r--r-- | debug.c | 32 |
1 files changed, 22 insertions, 10 deletions
@@ -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; } - |