summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorChristophe Fergeau <cfergeau@redhat.com>2012-12-21 09:33:41 +0100
committerChristophe Fergeau <cfergeau@redhat.com>2013-01-22 12:43:51 +0100
commit05af7a9786507cd729cb7505e5b103b47aa29852 (patch)
tree3fdadad9bae791055705db8733add3868da91de9 /common
parent1e543873ead9507cc62f615c6cf0cc283733a97b (diff)
Add OLDMSVCRT fallback for _ftime_s
Aliasing _ftime_s to _ftime when OLDMSVCRT is defined makes it possible to remove the timestamp-less implementation of LOG() while still getting a binary working on Windows XP. I've tested this with a MinGW build, hopefully this won't break VC++ builds...
Diffstat (limited to 'common')
-rw-r--r--common/vdcommon.h4
-rw-r--r--common/vdlog.h16
2 files changed, 6 insertions, 14 deletions
diff --git a/common/vdcommon.h b/common/vdcommon.h
index e50f2b0..cc3bd3d 100644
--- a/common/vdcommon.h
+++ b/common/vdcommon.h
@@ -46,5 +46,9 @@ typedef CRITICAL_SECTION mutex_t;
#define swprintf_s(buf, sz, format...) swprintf(buf, format)
#endif
+#ifdef OLDMSVCRT
+#define _ftime_s(timeb) _ftime(timeb)
+#endif
+
#endif
diff --git a/common/vdlog.h b/common/vdlog.h
index 2ca03f3..6d0413b 100644
--- a/common/vdlog.h
+++ b/common/vdlog.h
@@ -25,6 +25,8 @@
#include <time.h>
#include <sys/timeb.h>
+#include "vdcommon.h"
+
class VDLog {
public:
~VDLog();
@@ -57,19 +59,6 @@ static unsigned int log_level = LOG_INFO;
printf("%lu::%s::%s,%.3d::%s::" format "\n", GetCurrentThreadId(), type, datetime, ms, \
__FUNCTION__, ## __VA_ARGS__);
-#ifdef OLDMSVCRT
-#define LOG(type, format, ...) do { \
- if (type >= log_level && type <= LOG_FATAL) { \
- VDLog* log = VDLog::get(); \
- const char *type_as_char[] = { "DEBUG", "INFO", "WARN", "ERROR", "FATAL" }; \
- if (log) { \
- log->PRINT_LINE(type_as_char[type], format, "", 0, ## __VA_ARGS__); \
- } else { \
- PRINT_LINE(type_as_char[type], format, "", 0, ## __VA_ARGS__); \
- } \
- } \
-} while(0)
-#else
#define LOG(type, format, ...) do { \
if (type >= log_level && type <= LOG_FATAL) { \
VDLog* log = VDLog::get(); \
@@ -87,7 +76,6 @@ static unsigned int log_level = LOG_INFO;
} \
} \
} while(0)
-#endif
#define vd_printf(format, ...) LOG(LOG_INFO, format, ## __VA_ARGS__)