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

ruby-changes:31871

From: usa <ko1@a...>
Date: Mon, 2 Dec 2013 00:56:03 +0900 (JST)
Subject: [ruby-changes:31871] usa:r43950 (trunk): * hash.c (getenv): use ANSI codepage version of getenv() for miniruby

usa	2013-12-02 00:55:56 +0900 (Mon, 02 Dec 2013)

  New Revision: 43950

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

  Log:
    * hash.c (getenv): use ANSI codepage version of getenv() for miniruby
      on Windows.
      [ruby-core:58732] [Bug #9189] reported by phasis68 (Heesob Park).

  Modified files:
    trunk/ChangeLog
    trunk/hash.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 43949)
+++ ChangeLog	(revision 43950)
@@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Mon Dec  2 00:53:01 2013  NAKAMURA Usaku  <usa@r...>
+
+	* hash.c (getenv): use ANSI codepage version of getenv() for miniruby
+	  on Windows.
+	  [ruby-core:58732] [Bug #9189] reported by phasis68 (Heesob Park).
+
 Sun Dec  1 22:14:27 2013  Zachary Scott  <e@z...>
 
 	* doc/contributors.rdoc: [DOC] Import contributors from redmine wiki
Index: hash.c
===================================================================
--- hash.c	(revision 43949)
+++ hash.c	(revision 43950)
@@ -2423,7 +2423,17 @@ static char **my_environ; https://github.com/ruby/ruby/blob/trunk/hash.c#L2423
 #undef environ
 #define environ my_environ
 #undef getenv
-#define getenv(n) rb_w32_ugetenv(n)
+inline char *
+getenv(const char *name)
+{
+    static int binary = -1;
+    static int locale = -1;
+    if (binary < 0) {
+	binary = rb_ascii8bit_encindex();
+	locale = rb_locale_encindex();
+    }
+    return locale == binary ? rb_w32_getenv(name) : rb_w32_ugetenv(name);
+}
 #elif defined(__APPLE__)
 #undef environ
 #define environ (*_NSGetEnviron())

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

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