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

ruby-changes:16087

From: naruse <ko1@a...>
Date: Thu, 27 May 2010 23:47:35 +0900 (JST)
Subject: [ruby-changes:16087] Ruby:r28038 (trunk): * file.c (file_expand_path): use rb_enc_associate_index and

naruse	2010-05-27 23:47:20 +0900 (Thu, 27 May 2010)

  New Revision: 28038

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

  Log:
    * file.c (file_expand_path): use rb_enc_associate_index and
      rb_filesystem_encindex. Strings related FileSystem should
      have filesystem_encoding.
    
    * file.c (SET_EXTERNAL_ENCODING): removed.

  Modified files:
    trunk/ChangeLog
    trunk/file.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 28037)
+++ ChangeLog	(revision 28038)
@@ -1,3 +1,11 @@
+Thu May 27 23:07:45 2010  NARUSE, Yui  <naruse@r...>
+
+	* file.c (file_expand_path): use rb_enc_associate_index and
+	  rb_filesystem_encindex. Strings related FileSystem should
+	  have filesystem_encoding.
+
+	* file.c (SET_EXTERNAL_ENCODING): removed.
+
 Thu May 27 23:03:19 2010  NARUSE, Yui  <naruse@r...>
 
 	* include/ruby/encoding.h (rb_filesystem_encindex): defined.
Index: file.c
===================================================================
--- file.c	(revision 28037)
+++ file.c	(revision 28038)
@@ -2788,10 +2788,6 @@
     buflen = RSTRING_LEN(result),\
     pend = p + buflen)
 
-#define SET_EXTERNAL_ENCODING() (\
-    (void)(extenc || (extenc = rb_default_external_encoding())),\
-    rb_enc_associate(result, extenc))
-
 VALUE
 rb_home_dir(const char *user, VALUE result)
 {
@@ -2842,7 +2838,6 @@
     char *buf, *p, *pend, *root;
     size_t buflen, dirlen, bdiff;
     int tainted;
-    rb_encoding *extenc = 0;
 
     s = StringValuePtr(fname);
     BUFINIT();
@@ -2898,7 +2893,7 @@
 		BUFCHECK(dirlen > buflen);
 		strcpy(buf, dir);
 		xfree(dir);
-		SET_EXTERNAL_ENCODING();
+		rb_enc_associate_index(result, rb_filesystem_encindex());
 	    }
 	    p = chompdirsep(skiproot(buf));
 	    s += 2;
@@ -2918,7 +2913,7 @@
 	    BUFCHECK(dirlen > buflen);
 	    strcpy(buf, dir);
 	    xfree(dir);
-	    SET_EXTERNAL_ENCODING();
+	    rb_enc_associate_index(result, rb_filesystem_encindex());
 	}
 #if defined DOSISH || defined __CYGWIN__
 	if (isdirsep(*s)) {

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

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