summaryrefslogtreecommitdiff
path: root/win32/win32.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-08-05 08:31:23 (GMT)
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-08-05 08:31:23 (GMT)
commit743c279d7007e8e0aa5d7d715950b83458400bf4 (patch)
tree05fc0d421f9b7dbaa615124f51135ba3b3404a36 /win32/win32.c
parent518af61ba6a687a0747d83f235cdb4d50d605824 (diff)
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.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/win32/win32.c b/win32/win32.c
index 1db8e0c..8204d72 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 {