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

ruby-changes:22982

From: usa <ko1@a...>
Date: Thu, 15 Mar 2012 13:49:31 +0900 (JST)
Subject: [ruby-changes:22982] usa:r35031 (trunk): * hash.c (env_str_new, rb_f_getenv, env_fetch): use rb_str_conv_enc()

usa	2012-03-15 13:49:20 +0900 (Thu, 15 Mar 2012)

  New Revision: 35031

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

  Log:
    * hash.c (env_str_new, rb_f_getenv, env_fetch): use rb_str_conv_enc()
      instead of rb_str_encode() to simplify the code.

  Modified files:
    trunk/ChangeLog
    trunk/hash.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 35030)
+++ ChangeLog	(revision 35031)
@@ -1,3 +1,8 @@
+Thu Mar 15 13:47:17 2012  NAKAMURA Usaku  <usa@r...>
+
+	* hash.c (env_str_new, rb_f_getenv, env_fetch): use rb_str_conv_enc()
+	  instead of rb_str_encode() to simplify the code.
+
 Thu Mar 15 12:44:50 2012  NAKAMURA Usaku  <usa@r...>
 
 	* win32/win32.c, include/ruby/win32.h (rb_w32_ugetenv): new API to
@@ -108,8 +113,8 @@
 
 Wed Mar 14 17:55:29 2012  NAKAMURA Usaku  <usa@r...>
 
-	* numeric.c (flodivmod): must through the same pass if HAVE_FMOD or not.
-	  this is a bugfix of r35013.
+	* numeric.c (flodivmod): must go through the same pass if HAVE_FMOD or
+	  not.  this is a bugfix of r35013.
 
 Wed Mar 14 16:41:55 2012  NAKAMURA Usaku  <usa@r...>
 
Index: hash.c
===================================================================
--- hash.c	(revision 35030)
+++ hash.c	(revision 35031)
@@ -2032,7 +2032,7 @@
 env_str_new(const char *ptr, long len)
 {
 #ifdef _WIN32
-    VALUE str = rb_str_encode(rb_enc_str_new(ptr, len, rb_utf8_encoding()), rb_enc_from_encoding(rb_locale_encoding()), 0, Qnil);
+    VALUE str = rb_str_conv_enc(rb_str_new(ptr, len), rb_utf8_encoding(), rb_locale_encoding());
 #else
     VALUE str = rb_locale_str_new(ptr, len);
 #endif
@@ -2115,7 +2115,7 @@
     if (env) {
 	if (ENVMATCH(nam, PATH_ENV) && !env_path_tainted(env)) {
 #ifdef _WIN32
-	    VALUE str = rb_str_encode(rb_enc_str_new(env, strlen(env), rb_utf8_encoding()), rb_enc_from_encoding(rb_filesystem_encoding()), 0, Qnil);
+	    VALUE str = rb_str_conv_enc(rb_str_new(env, strlen(env)), rb_utf8_encoding(), rb_filesystem_encoding());
 #else
 	    VALUE str = rb_filesystem_str_new_cstr(env);
 #endif
@@ -2170,7 +2170,7 @@
     }
     if (ENVMATCH(nam, PATH_ENV) && !env_path_tainted(env))
 #ifdef _WIN32
-	return rb_str_encode(rb_enc_str_new(env, strlen(env), rb_utf8_encoding()), rb_enc_from_encoding(rb_filesystem_encoding()), 0, Qnil);
+	return rb_str_conv_enc(rb_str_new(env, strlen(env)), rb_utf8_encoding(), rb_filesystem_encoding());
 #else
 	return rb_filesystem_str_new_cstr(env);
 #endif

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

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