* hash.c (ruby_setenv): also set CRT workarea. ref [ruby-core:25010]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25715 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
usa 2009-11-11 03:20:21 +00:00
Родитель 914b36e3f9
Коммит dc9112dd7a
2 изменённых файлов: 22 добавлений и 18 удалений

Просмотреть файл

@ -1,3 +1,7 @@
Wed Nov 11 12:19:27 2009 NAKAMURA Usaku <usa@ruby-lang.org>
* hash.c (ruby_setenv): also set CRT workarea. ref [ruby-core:25010]
Wed Nov 11 09:36:02 2009 Nobuyoshi Nakada <nobu@ruby-lang.org> Wed Nov 11 09:36:02 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
* marshal.c (w_object, r_object0): use RHASH_IFNONE but not ifnone * marshal.c (w_object, r_object0): use RHASH_IFNONE but not ifnone

36
hash.c
Просмотреть файл

@ -2032,24 +2032,24 @@ void
ruby_setenv(const char *name, const char *value) ruby_setenv(const char *name, const char *value)
{ {
#if defined(_WIN32) #if defined(_WIN32)
/* The sane way to deal with the environment. int len;
* Has these advantages over putenv() & co.: char *buf;
* * enables us to store a truly empty value in the if (value) {
* environment (like in UNIX). len = strlen(name) + 1 + strlen(value) + 1;
* * we don't have to deal with RTL globals, bugs and leaks. buf = ALLOCA_N(char, len);
* * Much faster. snprintf(buf, len, "%s=%s", name, value);
* Why you may want to enable USE_WIN32_RTL_ENV: putenv(buf);
* * environ[] and RTL functions will not reflect changes,
* which might be an issue if extensions want to access /* putenv() doesn't handle empty value */
* the env. via RTL. This cuts both ways, since RTL will if (*value)
* not see changes made by extensions that call the Win32 SetEnvironmentVariable(name,value);
* functions directly, either. }
* GSAR 97-06-07 else {
* len = strlen(name) + 1 + 1;
* REMARK: USE_WIN32_RTL_ENV is already obsoleted since we don't use buf = ALLOCA_N(char, len);
* RTL's environ global variable directly yet. snprintf(buf, len, "%s=", name);
*/ putenv(buf);
SetEnvironmentVariable(name,value); }
#elif defined(HAVE_SETENV) && defined(HAVE_UNSETENV) #elif defined(HAVE_SETENV) && defined(HAVE_UNSETENV)
#undef setenv #undef setenv
#undef unsetenv #undef unsetenv