win32.c: call get_final_path pointer

* win32/win32.c (get_final_path): initialize this pointer without
  further comparisons.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55815 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2016-08-05 08:22:35 +00:00
parent ad9d8468e6
commit bd46ad2195

View File

@ -1819,21 +1819,27 @@ w32_cmdvector(const WCHAR *cmd, char ***vec, UINT cp, rb_encoding *enc)
// UNIX compatible directory access functions for NT
//
static DWORD
get_final_path(HANDLE f, WCHAR *buf, DWORD len, DWORD flag)
typedef DWORD (WINAPI *get_final_path_func)(HANDLE, WCHAR*, DWORD, DWORD);
static get_final_path_func get_final_path;
static DWORD WINAPI
get_final_path_fail(HANDLE f, WCHAR *buf, DWORD len, DWORD flag)
{
typedef DWORD (WINAPI *get_final_path_func)(HANDLE, WCHAR*, DWORD, DWORD);
static get_final_path_func func = (get_final_path_func)-1;
return 0;
}
if (func == (get_final_path_func)-1) {
func = (get_final_path_func)
get_proc_address("kernel32", "GetFinalPathNameByHandleW", NULL);
}
if (!func) return 0;
static DWORD WINAPI
get_final_path_unknown(HANDLE f, WCHAR *buf, DWORD len, DWORD flag)
{
get_final_path_func func = (get_final_path_func)
get_proc_address("kernel32", "GetFinalPathNameByHandleW", NULL);
if (!func) func = get_final_path_fail;
get_final_path = func;
return func(f, buf, len, flag);
}
static get_final_path_func get_final_path = get_final_path_unknown;
/* License: Ruby's */
/* TODO: better name */
static HANDLE