summaryrefslogtreecommitdiff
path: root/win32/file.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-07-26 04:01:07 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-07-26 04:01:07 +0000
commit320a0dd218e2aecd8510b5a8f88ffb93643a5c48 (patch)
tree7889fa7b2c9b57d27fadc122bd38bb49ffde0dbe /win32/file.c
parent45fbfd0a8197d53678241023798733fb765f9e2a (diff)
win32/file.c: refine fix_string_encoding
* win32/file.c (fix_string_encoding): simplify with rb_str_conv_enc(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42180 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'win32/file.c')
-rw-r--r--win32/file.c11
1 files changed, 1 insertions, 10 deletions
diff --git a/win32/file.c b/win32/file.c
index a5aafa5e77..f7b419530f 100644
--- a/win32/file.c
+++ b/win32/file.c
@@ -235,16 +235,7 @@ code_page(rb_encoding *enc)
return INVALID_CODE_PAGE;
}
-static inline VALUE
-fix_string_encoding(VALUE str, rb_encoding *encoding)
-{
- VALUE result, tmp;
-
- tmp = rb_enc_str_new(RSTRING_PTR(str), RSTRING_LEN(str), encoding);
- result = rb_str_encode(tmp, rb_enc_from_encoding(rb_utf8_encoding()), 0, Qnil);
-
- return result;
-}
+#define fix_string_encoding(str, encoding) rb_str_conv_enc((str), NULL, (encoding))
/*
Replace the last part of the path to long name.