]> jfr.im git - irc/atheme/libmowgli-2.git/commitdiff
Fix compilation on modern mingw32; includes dropping gettimeofday() which is in moder...
authorNathan Phillip Brink <redacted>
Tue, 5 Mar 2013 01:01:55 +0000 (20:01 -0500)
committerNathan Phillip Brink <redacted>
Tue, 5 Mar 2013 01:01:55 +0000 (20:01 -0500)
Also fixes missing s/SLPI/SYSTEM_LOGICAL_PROCESSOR_INFORMATION/ and a
missing variable rename in Windows-specific cacheline code. Fixes
mistaken use of MOWGLI_OS_WINDOWS instead of MOWGLI_OS_WIN.

Dropping gettimeofday() fixes type collision of “struct timezone” with
the compat type provided by mingw32.

src/libmowgli/dns/evloop_reslist_win32.c
src/libmowgli/platform/cacheline.c
src/libmowgli/platform/win32/Makefile
src/libmowgli/platform/win32/gettimeofday.c [deleted file]
src/libmowgli/platform/win32/win32_stdinc.h

index 77920f9c030cee501ba8976ebe8cfd17a7b7b353..d2c7f6cff5d08e77b8a921855c596c9b0d4cb054 100644 (file)
@@ -19,7 +19,7 @@
 
 #include "mowgli.h"
 
-#ifdef MOWGLI_OS_WINDOWS
+#ifdef MOWGLI_OS_WIN
 #include <windows.h>
 #include <iphlpapi.h>
 
index b44a9d5517c934f45efa8fa5e1692d497794ed03..7442540adeeafc120e4dfa90101839e033e3ab47 100644 (file)
@@ -33,7 +33,7 @@ void mowgli_cacheline_bootstrap(void) {
 #elif defined(MOWGLI_OS_WIN)
        DWORD buf_size = 0;
        DWORD i = 0;
-       SLPI *buf = 0;
+       SYSTEM_LOGICAL_PROCESSOR_INFORMATION *buf = 0;
 
        GetLogicalProcessorInformation(0, &buf_size);
        buf = (SYSTEM_LOGICAL_PROCESSOR_INFORMATION *)mowgli_alloc(buf_size);
@@ -46,7 +46,7 @@ void mowgli_cacheline_bootstrap(void) {
                }
        }
 
-  mowgli_free(buffer);
+  mowgli_free(buf);
 #else
        // This is often true
 #ifdef MOWGLI_CPU_BITS_32
index 653bf2d2050183418725eca3dabe22396847e5c1..73e7c74824e25297f0172cc1618892d4c0b21c3d 100644 (file)
@@ -3,7 +3,7 @@ include ../../../../extra.mk
 STATIC_PIC_LIB_NOINST = ${LIBMOWGLI_SHARED_PLATFORM_WIN32}
 STATIC_LIB_NOINST = ${LIBMOWGLI_STATIC_PLATFORM_WIN32}
 
-SRCS = fork.c gettimeofday.c inet.c pipe.c socketpair.c setenv.c
+SRCS = fork.c inet.c pipe.c socketpair.c setenv.c
 
 INCLUDES = win32_stdinc.h
 
diff --git a/src/libmowgli/platform/win32/gettimeofday.c b/src/libmowgli/platform/win32/gettimeofday.c
deleted file mode 100644 (file)
index 1e96797..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * libmowgli: A collection of useful routines for programming.
- * win32_support.c: Support functions and values for Win32 platform.
- *
- * Copyright (c) 2009 SystemInPlace, Inc.
- *
- * Permission to use, copy, modify, and/or distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice is present in all copies.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "mowgli.h"
-
-#ifdef _MSC_VER
-# define EPOCH_TIME_IN_MICROSECS       11644473600000000Ui64
-#else
-# define EPOCH_TIME_IN_MICROSECS       11644473600000000ULL
-#endif
-
-#ifdef _WIN32
-int gettimeofday(struct timeval *tv, struct timezone *tz)
-{
-       FILETIME ft;
-       ULARGE_INTEGER tmpres;
-       static mowgli_boolean_t tz_init_done = FALSE;
-
-       if (tv != NULL)
-       {
-               GetSystemTimeAsFileTime(&ft);
-
-               tmpres.u.HighPart = ft.dwHighDateTime;
-               tmpres.u.LowPart  = ft.dwLowDateTime;
-
-               tmpres.QuadPart /= 10;
-               tmpres.QuadPart -= EPOCH_TIME_IN_MICROSECS;
-               tv->tv_sec = (long) (tmpres.QuadPart / 1000000UL);
-               tv->tv_usec = (long) (tmpres.QuadPart % 1000000UL);
-       }
-
-       if (tz != NULL)
-       {
-               if (!tz_init_done)
-               {
-                       _tzset();
-                       tz_init_done = TRUE;
-               }
-
-               tz->tz_minuteswest = _timezone / 60;
-               tz->tz_dsttime = _daylight;
-       }
-
-       return 0;
-}
-#endif
index 1360a4acd96e98a014b932b0573b6bb372864bd6..491f712b772776b20d61208c047acaba4c15cf77 100644 (file)
 # define snprintf                      _snprintf
 #endif
 
-struct timezone {
-       int tz_minuteswest;
-       int tz_dsttime;
-};
-
-extern int gettimeofday(struct timeval *tv, struct timezone *tz);
 extern int setenv(const char *name, const char *value, int overwrite);
 extern int pipe(int pipefd[2]);
 extern int socketpair(int domain, int type, int protocol, int pipefd[2]);