From f59caa2950d454f651438cccff6298c4e13dc354 Mon Sep 17 00:00:00 2001 From: usa Date: Thu, 15 Mar 2012 04:49:20 +0000 Subject: * hash.c (env_str_new, rb_f_getenv, env_fetch): use rb_str_conv_enc() instead of rb_str_encode() to simplify the code. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35031 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 9 +++++++-- hash.c | 6 +++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4247852ec6..e411a66a2e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Thu Mar 15 13:47:17 2012 NAKAMURA Usaku + + * 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 * win32/win32.c, include/ruby/win32.h (rb_w32_ugetenv): new API to @@ -108,8 +113,8 @@ Wed Mar 14 18:25:18 2012 Shugo Maeda Wed Mar 14 17:55:29 2012 NAKAMURA Usaku - * 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 diff --git a/hash.c b/hash.c index ee703f59d4..e9937ffe71 100644 --- a/hash.c +++ b/hash.c @@ -2032,7 +2032,7 @@ static VALUE 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 @@ rb_f_getenv(VALUE obj, VALUE name) 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 @@ env_fetch(int argc, VALUE *argv) } 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 -- cgit v1.2.3