[前][次][番号順一覧][スレッド一覧]

ruby-changes:40082

From: kosaki <ko1@a...>
Date: Sun, 18 Oct 2015 10:19:51 +0900 (JST)
Subject: [ruby-changes:40082] kosaki:r52163 (trunk): * file.c (rb_file_identical_p): simplify ifdefs

kosaki	2015-10-18 10:19:13 +0900 (Sun, 18 Oct 2015)

  New Revision: 52163

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=52163

  Log:
    * file.c (rb_file_identical_p): simplify ifdefs

  Modified files:
    trunk/ChangeLog
    trunk/file.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 52162)
+++ ChangeLog	(revision 52163)
@@ -1,3 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Sun Oct 18 10:12:46 2015  KOSAKI Motohiro  <kosaki.motohiro@g...>
+
+	* file.c (rb_file_identical_p): simplify ifdefs
+
 Sun Oct 18 10:01:40 2015  KOSAKI Motohiro  <kosaki.motohiro@g...>
 
 	* ChangeLog: Good-bye OS/2.
Index: file.c
===================================================================
--- file.c	(revision 52162)
+++ file.c	(revision 52163)
@@ -1932,7 +1932,7 @@ rb_file_sticky_p(VALUE obj, VALUE fname) https://github.com/ruby/ruby/blob/trunk/file.c#L1932
 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 fna https://github.com/ruby/ruby/blob/trunk/file.c#L1940
     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 fna https://github.com/ruby/ruby/blob/trunk/file.c#L1962
 	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;

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]