From b909d11eaf46d1d285999d726076742b8d34e4f1 Mon Sep 17 00:00:00 2001 From: gombasg Date: Mon, 19 Jun 2006 10:24:21 +0000 Subject: [PATCH] Visual C++ is not standard-compliant git-svn-id: svn+ssh://cvs.lpds.sztaki.hu/var/lib/svn/szdg/dcapi/trunk@703 a7169a2c-3604-0410-bc95-c702d8d87f7a --- dcapi/common/logger.c | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/dcapi/common/logger.c b/dcapi/common/logger.c index 265968808f..46e561f4d8 100644 --- a/dcapi/common/logger.c +++ b/dcapi/common/logger.c @@ -1,4 +1,7 @@ -#include +#ifdef HAVE_CONFIG_H +#include +#endif + #include #include #include @@ -6,6 +9,10 @@ #include #include +#ifndef _WIN32 +#include +#endif + #include #include @@ -17,13 +24,21 @@ static int loglevel = -1; static FILE *logfile; +/* Stupid Visual C compiler */ +#ifdef _MSC_VER +#define INIT(x, y) y +#else +#define INIT(x, y) [x] = y +#endif + static const char *levels[] = { - [LOG_DEBUG] = "Debug", - [LOG_INFO] = "Info", - [LOG_NOTICE] = "Notice", - [LOG_WARNING] = "Warning", - [LOG_ERR] = "Error" + INIT(LOG_DEBUG, "Debug"), + INIT(LOG_INFO, "Info"), + INIT(LOG_NOTICE, "Notice"), + INIT(LOG_WARNING, "Warning"), + INIT(LOG_ERR, "Error"), + INIT(LOG_CRIT, "Critical") }; static void init_log(void)