aboutsummaryrefslogtreecommitdiffstats
path: root/win32
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-08-05 08:22:35 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-08-05 08:22:35 +0000
commitc3a66dae9fd1e898417e2e8707b24afe2b609c96 (patch)
tree88a91e6a0e456eb92215cdfdaf9469376ae36490 /win32
parent6b4580fbe9ce0f9545396676d0ae7e65dc3459d0 (diff)
downloadruby-c3a66dae9fd1e898417e2e8707b24afe2b609c96.tar.gz
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')
-rw-r--r--win32/win32.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/win32/win32.c b/win32/win32.c
index 8fd00831a6..02ec9c9f74 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