diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-08-05 08:31:23 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-08-05 08:31:23 +0000 |
commit | 6e0421819cbf1e9cef772ae071549c96545f4e0c (patch) | |
tree | 05fc0d421f9b7dbaa615124f51135ba3b3404a36 /win32/win32.c | |
parent | 1122daf2bfe9671a8cda6a1181f9484eec62aece (diff) | |
download | ruby-6e0421819cbf1e9cef772ae071549c96545f4e0c.tar.gz |
win32.c: initialize with an impossible value
* win32/win32.c (getifaddrs, rb_w32_getppid): initialize the API
pointers with an impossible value not to try everytime on old
platforms.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55817 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'win32/win32.c')
-rw-r--r-- | win32/win32.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/win32/win32.c b/win32/win32.c index 1db8e0c078..8204d72e60 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -4034,8 +4034,8 @@ str2guid(const char *str, GUID *guid) #endif typedef DWORD (WINAPI *cigl_t)(const GUID *, NET_LUID *); typedef DWORD (WINAPI *cilnA_t)(const NET_LUID *, char *, size_t); -static cigl_t pConvertInterfaceGuidToLuid = NULL; -static cilnA_t pConvertInterfaceLuidToNameA = NULL; +static cigl_t pConvertInterfaceGuidToLuid = (cigl_t)-1; +static cilnA_t pConvertInterfaceLuidToNameA = (cilnA_t)-1; int getifaddrs(struct ifaddrs **ifap) @@ -4058,11 +4058,11 @@ getifaddrs(struct ifaddrs **ifap) return -1; } - if (!pConvertInterfaceGuidToLuid) + if (pConvertInterfaceGuidToLuid == (cigl_t)-1) pConvertInterfaceGuidToLuid = (cigl_t)get_proc_address("iphlpapi.dll", "ConvertInterfaceGuidToLuid", NULL); - if (!pConvertInterfaceLuidToNameA) + if (pConvertInterfaceLuidToNameA == (cilnA_t)-1) pConvertInterfaceLuidToNameA = (cilnA_t)get_proc_address("iphlpapi.dll", "ConvertInterfaceLuidToNameA", NULL); @@ -5995,10 +5995,10 @@ rb_pid_t rb_w32_getppid(void) { typedef long (WINAPI query_func)(HANDLE, int, void *, ULONG, ULONG *); - static query_func *pNtQueryInformationProcess = NULL; + static query_func *pNtQueryInformationProcess = (query_func *)-1; rb_pid_t ppid = 0; - if (!pNtQueryInformationProcess) + if (pNtQueryInformationProcess == (query_func *)-1) pNtQueryInformationProcess = (query_func *)get_proc_address("ntdll.dll", "NtQueryInformationProcess", NULL); if (pNtQueryInformationProcess) { struct { |