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

ruby-changes:2108

From: ko1@a...
Date: 2 Oct 2007 20:17:58 +0900
Subject: [ruby-changes:2108] usa - Ruby:r13599 (trunk): * win32/win32.c (init_env): refactoring. remove unused code.

usa	2007-10-02 20:17:23 +0900 (Tue, 02 Oct 2007)

  New Revision: 13599

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

  Log:
    * win32/win32.c (init_env): refactoring. remove unused code.


  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/win32/win32.c?r1=13599&r2=13598
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=13599&r2=13598

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 13598)
+++ ChangeLog	(revision 13599)
@@ -1,3 +1,7 @@
+Tue Oct  2 20:16:55 2007  NAKAMURA Usaku  <usa@r...>
+
+	* win32/win32.c (init_env): refactoring. remove unused code.
+
 Tue Oct  2 12:30:40 2007  Yukihiro Matsumoto  <matz@r...>
 
 	* array.c (rb_ary_product): generalized product, now takes
Index: win32/win32.c
===================================================================
--- win32/win32.c	(revision 13598)
+++ win32/win32.c	(revision 13599)
@@ -372,20 +372,17 @@
 	    SetEnvironmentVariable("HOME", env);
 	}
     }
-    if (GetEnvironmentVariable("USER", env, sizeof env)) {
-	len = strlen(env);
+
+    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;
+	}
     }
-    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;
-    }
     NTLoginName = strdup(env);
 }
 

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

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