summaryrefslogtreecommitdiff
path: root/win32/win32.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-08-05 08:22:35 (GMT)
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-08-05 08:22:35 (GMT)
commitbd46ad21958ec0fd071b216deb774ac45f86835b (patch)
tree88a91e6a0e456eb92215cdfdaf9469376ae36490 /win32/win32.c
parentad9d8468e6da76994fdf0dcada500c9395b011d1 (diff)
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
Diffstat (limited to 'win32/win32.c')
-rw-r--r--win32/win32.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/win32/win32.c b/win32/win32.c
index 8fd0083..02ec9c9 100644
--- a/win32/win32.c
+++ b/win32/win32.c
@@ -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 func = (get_final_path_func)-1;
+typedef DWORD (WINAPI *get_final_path_func)(HANDLE, WCHAR*, DWORD, DWORD);
+static get_final_path_func get_final_path;
- if (func == (get_final_path_func)-1) {
- func = (get_final_path_func)
- get_proc_address("kernel32", "GetFinalPathNameByHandleW", NULL);
- }
+static DWORD WINAPI
+get_final_path_fail(HANDLE f, WCHAR *buf, DWORD len, DWORD flag)
+{
+ return 0;
+}
- 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