Correct use of Windows APIs
authorNeale Ferguson <neale@sinenomine.net>
Thu, 2 Jun 2016 17:40:15 +0000 (13:40 -0400)
committerNeale Ferguson <neale@sinenomine.net>
Thu, 2 Jun 2016 17:40:15 +0000 (13:40 -0400)
mono/utils/mono-log-common.c
mono/utils/mono-log-windows.c

index 90118efbc2525f6dc4ef29f8af85579ae650c144..23b22f34005908b056825fa44d20a0df74ba71d5 100644 (file)
@@ -20,7 +20,9 @@
 #include <glib.h>
 #include <errno.h>
 #include <time.h>
+#ifndef HOST_WIN32
 #include <sys/time.h>
+#endif
 #include "mono-logger.h"
 
 static FILE *logFile = NULL;
@@ -32,7 +34,7 @@ static void *logUserData = NULL;
  *     @level - GLogLevelFlags value
  *     @returns The equivalent character identifier
  */
-static __inline__ char 
+static inline char 
 mapLogFileLevel(GLogLevelFlags level) 
 {
        if (level & G_LOG_LEVEL_ERROR)
@@ -100,8 +102,13 @@ mono_log_write_logfile(const char *domain, GLogLevelFlags level, mono_bool hdr,
 
        if (hdr) {
                time(&t);
+#ifndef HOST_WIN32
                localtime_r(&t, &tod);
                pid = getpid();
+#else
+               localtime(&t, &tod);
+               pid = _getpid();
+#endif
                strftime(logTime, sizeof(logTime), "%F %T", &tod);
                iLog = snprintf(logMessage, sizeof(logMessage), "%s level[%c] mono[%d]: ",
                                logTime,mapLogFileLevel(level),pid);
index 4d8d66d8628ac59759aa38145fcbd6501fe3b29c..d89e134b7894b6d5b5fb030b1c51a8229367dff6 100644 (file)
@@ -34,7 +34,7 @@ static char *logFileName = L".//mono.log";
  *     @level - GLogLevelFlags value
  *     @returns The equivalent character identifier
  */
-static __inline__ char 
+static inline char 
 mapLogFileLevel(GLogLevelFlags level) 
 {
        if (level & G_LOG_LEVEL_ERROR)