summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Eisentraut2019-09-17 09:32:33 +0000
committerPeter Eisentraut2019-09-17 09:34:28 +0000
commita25221f53c7960e00484c801f10d2e989b75a7f2 (patch)
tree9ca5de112dcf1bffcfd60d5bf049e69339f26b17
parentb64b857f50fb51da1588c54a56f8fc1c0d491058 (diff)
Remove mingwcompat.c
We believe that the issues that this was working around have been fixed in MinGW more than 5 years ago, so this isn't necessary anymore. Discussion: https://www.postgresql.org/message-id/flat/20190719050830.GK1859%40paquier.xyz
-rw-r--r--src/backend/port/win32/Makefile2
-rw-r--r--src/backend/port/win32/mingwcompat.c84
2 files changed, 1 insertions, 85 deletions
diff --git a/src/backend/port/win32/Makefile b/src/backend/port/win32/Makefile
index a6ace93e261..833c9e06dc6 100644
--- a/src/backend/port/win32/Makefile
+++ b/src/backend/port/win32/Makefile
@@ -12,7 +12,7 @@ subdir = src/backend/port/win32
top_builddir = ../../../..
include $(top_builddir)/src/Makefile.global
-OBJS = timer.o socket.o signal.o mingwcompat.o
+OBJS = timer.o socket.o signal.o
ifeq ($(have_win32_dbghelp), yes)
OBJS += crashdump.o
endif
diff --git a/src/backend/port/win32/mingwcompat.c b/src/backend/port/win32/mingwcompat.c
deleted file mode 100644
index 2269fcc195e..00000000000
--- a/src/backend/port/win32/mingwcompat.c
+++ /dev/null
@@ -1,84 +0,0 @@
-/*-------------------------------------------------------------------------
- *
- * mingwcompat.c
- * MinGW compatibility functions
- *
- * Portions Copyright (c) 1996-2019, PostgreSQL Global Development Group
- *
- * IDENTIFICATION
- * src/backend/port/win32/mingwcompat.c
- *
- *-------------------------------------------------------------------------
- */
-
-#include "postgres.h"
-
-#ifndef _MSC_VER
-/*
- * MingW defines an extern to this struct, but the actual struct isn't present
- * in any library. It's trivial enough that we can safely define it
- * ourselves.
- */
-const struct in6_addr in6addr_any = {{{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}};
-
-
-/*
- * This file contains loaders for functions that are missing in the MinGW
- * import libraries. It's only for actual Win32 API functions, so they are
- * all present in proper Win32 compilers.
- */
-static HMODULE kernel32 = NULL;
-
-/*
- * Load DLL file just once regardless of how many functions
- * we load/call in it.
- */
-static void
-LoadKernel32()
-{
- if (kernel32 != NULL)
- return;
-
- kernel32 = LoadLibraryEx("kernel32.dll", NULL, 0);
- if (kernel32 == NULL)
- ereport(FATAL,
- (errmsg_internal("could not load kernel32.dll: error code %lu",
- GetLastError())));
-}
-
-
-/*
- * Replacement for RegisterWaitForSingleObject(), which lives in
- * kernel32.dll
- */
-typedef
-BOOL (WINAPI * __RegisterWaitForSingleObject)
- (PHANDLE, HANDLE, WAITORTIMERCALLBACK, PVOID, ULONG, ULONG);
-static __RegisterWaitForSingleObject _RegisterWaitForSingleObject = NULL;
-
-BOOL WINAPI
-RegisterWaitForSingleObject(PHANDLE phNewWaitObject,
- HANDLE hObject,
- WAITORTIMERCALLBACK Callback,
- PVOID Context,
- ULONG dwMilliseconds,
- ULONG dwFlags)
-{
- if (_RegisterWaitForSingleObject == NULL)
- {
- LoadKernel32();
-
- _RegisterWaitForSingleObject = (__RegisterWaitForSingleObject)
- GetProcAddress(kernel32, "RegisterWaitForSingleObject");
-
- if (_RegisterWaitForSingleObject == NULL)
- ereport(FATAL,
- (errmsg_internal("could not locate RegisterWaitForSingleObject in kernel32.dll: error code %lu",
- GetLastError())));
- }
-
- return (_RegisterWaitForSingleObject)
- (phNewWaitObject, hObject, Callback, Context, dwMilliseconds, dwFlags);
-}
-
-#endif