diff options
author | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-10-02 11:17:23 +0000 |
---|---|---|
committer | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-10-02 11:17:23 +0000 |
commit | 36fa7c489eee8e2d6ff41dc2c79ccddb3577945c (patch) | |
tree | 3a34aaf930071134945c07cdc7cabcc920588fe8 | |
parent | 3089f1411ae7fbe2c1e38afacae0c2df32dcc8b8 (diff) | |
download | ruby-36fa7c489eee8e2d6ff41dc2c79ccddb3577945c.tar.gz ruby-36fa7c489eee8e2d6ff41dc2c79ccddb3577945c.tar.xz ruby-36fa7c489eee8e2d6ff41dc2c79ccddb3577945c.zip |
* win32/win32.c (init_env): refactoring. remove unused code.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@13599 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | win32/win32.c | 23 |
2 files changed, 14 insertions, 13 deletions
@@ -1,3 +1,7 @@ +Tue Oct 2 20:16:55 2007 NAKAMURA Usaku <usa@ruby-lang.org> + + * win32/win32.c (init_env): refactoring. remove unused code. + Tue Oct 2 12:30:40 2007 Yukihiro Matsumoto <matz@ruby-lang.org> * array.c (rb_ary_product): generalized product, now takes diff --git a/win32/win32.c b/win32/win32.c index ce13650cf..99199c95a 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -372,19 +372,16 @@ init_env(void) SetEnvironmentVariable("HOME", env); } } - if (GetEnvironmentVariable("USER", env, sizeof env)) { - len = strlen(env); - } - if (GetEnvironmentVariable("USERNAME", env, sizeof env)) { - len = strlen(env); - SetEnvironmentVariable("USER", env); - } - else if (GetUserName(env, (len = sizeof env, &len))) { - SetEnvironmentVariable("USER", env); - } - else { - NTLoginName = "<Unknown>"; - return; + + if (!GetEnvironmentVariable("USER", env, sizeof env)) { + if (GetEnvironmentVariable("USERNAME", env, sizeof env) || + GetUserName(env, (len = sizeof env, &len))) { + SetEnvironmentVariable("USER", env); + } + else { + NTLoginName = "<Unknown>"; + return; + } } NTLoginName = strdup(env); } |