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
This commit is contained in:
nobu 2016-08-05 08:31:23 +00:00
Родитель 518af61ba6
Коммит 743c279d70
1 изменённых файлов: 6 добавлений и 6 удалений

Просмотреть файл

@ -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 {