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

ruby-changes:24857

From: nobu <ko1@a...>
Date: Wed, 5 Sep 2012 14:29:59 +0900 (JST)
Subject: [ruby-changes:24857] nobu:r36908 (trunk): win32/file.c: simplify

nobu	2012-09-05 14:29:44 +0900 (Wed, 05 Sep 2012)

  New Revision: 36908

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

  Log:
    win32/file.c: simplify
    
    * win32/file.c (rb_file_expand_path_internal): simplify a condition.

  Modified files:
    trunk/win32/file.c

Index: win32/file.c
===================================================================
--- win32/file.c	(revision 36907)
+++ win32/file.c	(revision 36908)
@@ -354,8 +354,8 @@
 
     /* determine if we need the user's home directory */
     /* expand '~' only if NOT rb_file_absolute_path() where `abs_mode` is 1 */
-    if (abs_mode == 0 && ((wpath_len == 1 && wpath_pos[0] == L'~') ||
-	(wpath_len >= 2 && wpath_pos[0] == L'~' && IS_DIR_SEPARATOR_P(wpath_pos[1])))) {
+    if (abs_mode == 0 && wpath_len > 0 && wpath_pos[0] == L'~' &&
+	(wpath_len == 1 || IS_DIR_SEPARATOR_P(wpath_pos[1]))) {
 	/* tainted if expanding '~' */
 	tainted = 1;
 

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

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