diff options
author | kosaki <kosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-10-18 01:19:13 +0000 |
---|---|---|
committer | kosaki <kosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-10-18 01:19:13 +0000 |
commit | d3c7d8a74b0c09805f10de107ce45975237139d0 (patch) | |
tree | fefeade81e4c3a3ebbc0d6fc913d57e54ce22a9e | |
parent | dc37568be02b91e27c0d29099e6e7ecf1965ee04 (diff) | |
download | ruby-d3c7d8a74b0c09805f10de107ce45975237139d0.tar.gz |
* file.c (rb_file_identical_p): simplify ifdefs
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52163 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | file.c | 14 |
2 files changed, 5 insertions, 13 deletions
@@ -1,3 +1,7 @@ +Sun Oct 18 10:12:46 2015 KOSAKI Motohiro <kosaki.motohiro@gmail.com> + + * file.c (rb_file_identical_p): simplify ifdefs + Sun Oct 18 10:01:40 2015 KOSAKI Motohiro <kosaki.motohiro@gmail.com> * ChangeLog: Good-bye OS/2. @@ -1932,7 +1932,7 @@ rb_file_sticky_p(VALUE obj, VALUE fname) static VALUE rb_file_identical_p(VALUE obj, VALUE fname1, VALUE fname2) { -#ifndef DOSISH +#ifndef _WIN32 struct stat st1, st2; if (rb_stat(fname1, &st1) < 0) return Qfalse; @@ -1940,12 +1940,9 @@ rb_file_identical_p(VALUE obj, VALUE fname1, VALUE fname2) if (st1.st_dev != st2.st_dev) return Qfalse; if (st1.st_ino != st2.st_ino) return Qfalse; #else -# ifdef _WIN32 BY_HANDLE_FILE_INFORMATION st1, st2; HANDLE f1 = 0, f2 = 0; -# endif -# ifdef _WIN32 f1 = w32_io_info(&fname1, &st1); if (f1 == INVALID_HANDLE_VALUE) return Qfalse; if (f1) { @@ -1965,15 +1962,6 @@ rb_file_identical_p(VALUE obj, VALUE fname1, VALUE fname2) st1.nFileIndexLow == st2.nFileIndexLow) return Qtrue; if (!f1 || !f2) return Qfalse; -# else - FilePathValue(fname1); - fname1 = rb_str_new4(fname1); - fname1 = rb_str_encode_ospath(fname1); - FilePathValue(fname2); - fname2 = rb_str_encode_ospath(fname2); - if (access(RSTRING_PTR(fname1), 0)) return Qfalse; - if (access(RSTRING_PTR(fname2), 0)) return Qfalse; -# endif fname1 = rb_file_expand_path(fname1, Qnil); fname2 = rb_file_expand_path(fname2, Qnil); if (RSTRING_LEN(fname1) != RSTRING_LEN(fname2)) return Qfalse; |