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

ruby-changes:15165

From: mame <ko1@a...>
Date: Thu, 25 Mar 2010 23:22:58 +0900 (JST)
Subject: [ruby-changes:15165] Ruby:r27045 (trunk): * file.c (rb_get_path_check): prefer #to_path over #to_str. a patch

mame	2010-03-25 23:22:41 +0900 (Thu, 25 Mar 2010)

  New Revision: 27045

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

  Log:
    * file.c (rb_get_path_check): prefer #to_path over #to_str.  a patch
      originally written by me, and modified by Nobuyoshi Nakada.
      [ruby-core:24257]

  Modified files:
    trunk/ChangeLog
    trunk/file.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 27044)
+++ ChangeLog	(revision 27045)
@@ -1,3 +1,9 @@
+Thu Mar 25 23:17:16 2010  Yusuke Endoh  <mame@t...>
+
+	* file.c (rb_get_path_check): prefer #to_path over #to_str.  a patch
+	  originally written by me, and modified by Nobuyoshi Nakada.
+	  [ruby-core:24257]
+
 Thu Mar 25 18:10:08 2010  Kazuhiro NISHIYAMA  <zn@m...>
 
 	* NEWS: Array#{uniq,uniq!} can take a block. see [ruby-dev:37998]
Index: file.c
===================================================================
--- file.c	(revision 27044)
+++ file.c	(revision 27045)
@@ -129,18 +129,14 @@
     if (insecure_obj_p(obj, level)) {
 	rb_insecure_operation();
     }
-    tmp = rb_check_string_type(obj);
-    if (!NIL_P(tmp)) goto exit;
 
     CONST_ID(to_path, "to_path");
-    if (rb_respond_to(obj, to_path)) {
-	tmp = rb_funcall(obj, to_path, 0, 0);
-    }
-    else {
+    tmp = rb_check_funcall(obj, to_path, 0, 0);
+    if (tmp == Qundef) {
 	tmp = obj;
     }
     StringValue(tmp);
-  exit:
+
     tmp = file_path_convert(tmp);
     StringValueCStr(tmp);
     if (obj != tmp && insecure_obj_p(tmp, level)) {

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

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