summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-03-15 04:49:20 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-03-15 04:49:20 +0000
commitf59caa2950d454f651438cccff6298c4e13dc354 (patch)
treea824d7af059a691eccf8f0df3c8de1396bea42e3
parentfcaee4bd64eb06ec4d0afd4e7e32ccf57acb5dc8 (diff)
* 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
-rw-r--r--ChangeLog9
-rw-r--r--hash.c6
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 <usa@ruby-lang.org>
+
+ * 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@ruby-lang.org>
* 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 <shugo@ruby-lang.org>
Wed Mar 14 17:55:29 2012 NAKAMURA Usaku <usa@ruby-lang.org>
- * 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@ruby-lang.org>
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