summaryrefslogtreecommitdiffstats
path: root/unix
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2017-05-04 12:26:49 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2017-05-04 12:26:49 (GMT)
commit2d302090fb3a5abcff4a3346629a4cadb465adc4 (patch)
tree34061363a0436e4ee74a0e9203fdfa648ff4fb51 /unix
parent668eda40dc503d733250ac0fe982c063856acb38 (diff)
parentd489f8278641d1b55d50c3800e86e567d7951153 (diff)
downloadtcl-2d302090fb3a5abcff4a3346629a4cadb465adc4.zip
tcl-2d302090fb3a5abcff4a3346629a4cadb465adc4.tar.gz
tcl-2d302090fb3a5abcff4a3346629a4cadb465adc4.tar.bz2
Use GetModuleHandle() in stead of LoadLibrary() for ntdll, which is already loaded by Cygwin.
Diffstat (limited to 'unix')
-rw-r--r--unix/tclUnixInit.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/unix/tclUnixInit.c b/unix/tclUnixInit.c
index 67e0b65..4fd41a7 100644
--- a/unix/tclUnixInit.c
+++ b/unix/tclUnixInit.c
@@ -14,11 +14,11 @@
#ifdef HAVE_LANGINFO
# include <langinfo.h>
# ifdef __APPLE__
-# if defined(HAVE_WEAK_IMPORT) && MAC_OS_X_VERSION_MIN_REQUIRED < 1030
+# if defined(HAVE_WEAK_IMPORT) && MAC_OS_X_VERSION_MIN_REQUIRED < 1030
/* Support for weakly importing nl_langinfo on Darwin. */
# define WEAK_IMPORT_NL_LANGINFO
extern char *nl_langinfo(nl_item) WEAK_IMPORT_ATTRIBUTE;
-# endif
+# endif
# endif
#endif
#include <sys/resource.h>
@@ -34,7 +34,7 @@
#ifdef __CYGWIN__
DLLIMPORT extern __stdcall unsigned char GetVersionExW(void *);
-DLLIMPORT extern __stdcall void *LoadLibraryW(const void *);
+DLLIMPORT extern __stdcall void *GetModuleHandleW(const void *);
DLLIMPORT extern __stdcall void FreeLibrary(void *);
DLLIMPORT extern __stdcall void *GetProcAddress(void *, const char *);
DLLIMPORT extern __stdcall void GetSystemInfo(void *);
@@ -45,12 +45,12 @@ static const char *const platforms[NUMPLATFORMS] = {
};
#define NUMPROCESSORS 11
-static const char *const processors[NUMPROCESSORS] = {
+static const char *const processors[NUMPROCESSORS] = {
"intel", "mips", "alpha", "ppc", "shx", "arm", "ia64", "alpha64", "msil",
"amd64", "ia32_on_win64"
};
-typedef struct _SYSTEM_INFO {
+typedef struct {
union {
DWORD dwOemId;
struct {
@@ -69,7 +69,7 @@ typedef struct _SYSTEM_INFO {
int wProcessorRevision;
} SYSTEM_INFO;
-typedef struct _OSVERSIONINFOW {
+typedef struct {
DWORD dwOSVersionInfoSize;
DWORD dwMajorVersion;
DWORD dwMinorVersion;
@@ -885,16 +885,13 @@ TclpSetVariables(
#ifdef __CYGWIN__
unameOK = 1;
if (!osInfoInitialized) {
- HANDLE handle = LoadLibraryW(L"NTDLL");
+ HANDLE handle = GetModuleHandleW(L"NTDLL");
int(__stdcall *getversion)(void *) =
(int(__stdcall *)(void *))GetProcAddress(handle, "RtlGetVersion");
osInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFOW);
if (!getversion || getversion(&osInfo)) {
GetVersionExW(&osInfo);
}
- if (handle) {
- FreeLibrary(handle);
- }
osInfoInitialized = 1;
}
@@ -1052,7 +1049,6 @@ TclpFindVariable(
return result;
}
-
/*
*----------------------------------------------------------------------
*