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

ruby-changes:30128

From: nobu <ko1@a...>
Date: Fri, 26 Jul 2013 13:01:18 +0900 (JST)
Subject: [ruby-changes:30128] nobu:r42180 (trunk): win32/file.c: refine fix_string_encoding

nobu	2013-07-26 13:01:07 +0900 (Fri, 26 Jul 2013)

  New Revision: 42180

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

  Log:
    win32/file.c: refine fix_string_encoding
    
    * win32/file.c (fix_string_encoding): simplify with rb_str_conv_enc().

  Modified files:
    trunk/ChangeLog
    trunk/win32/file.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 42179)
+++ ChangeLog	(revision 42180)
@@ -1,4 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
-Fri Jul 26 13:00:24 2013  Nobuyoshi Nakada  <nobu@r...>
+Fri Jul 26 13:01:04 2013  Nobuyoshi Nakada  <nobu@r...>
+
+	* win32/file.c (fix_string_encoding): simplify with rb_str_conv_enc().
 
 	* win32/file.c (convert_mb_to_wchar): use bare pointer instead of
 	  VALUE, and remove useless argument.
Index: win32/file.c
===================================================================
--- win32/file.c	(revision 42179)
+++ win32/file.c	(revision 42180)
@@ -235,16 +235,7 @@ code_page(rb_encoding *enc) https://github.com/ruby/ruby/blob/trunk/win32/file.c#L235
     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.

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

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