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

ruby-changes:24148

From: akr <ko1@a...>
Date: Sat, 23 Jun 2012 18:44:54 +0900 (JST)
Subject: [ruby-changes:24148] akr:r36199 (trunk): * process.c (check_exec_redirect1): extracted from

akr	2012-06-23 18:44:43 +0900 (Sat, 23 Jun 2012)

  New Revision: 36199

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

  Log:
    * process.c (check_exec_redirect1): extracted from
      check_exec_redirect.

  Modified files:
    trunk/ChangeLog
    trunk/process.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 36198)
+++ ChangeLog	(revision 36199)
@@ -1,3 +1,8 @@
+Sat Jun 23 18:44:13 2012  Tanaka Akira  <akr@f...>
+
+	* process.c (check_exec_redirect1): extracted from
+	  check_exec_redirect.
+
 Sat Jun 23 17:22:02 2012  Tanaka Akira  <akr@f...>
 
 	* process.c (save_env): don't use EXEC_OPTION_UNSETENV_OTHERS.
Index: process.c
===================================================================
--- process.c	(revision 36198)
+++ process.c	(revision 36199)
@@ -1430,6 +1430,28 @@
     return INT2FIX(fd);
 }
 
+static VALUE
+check_exec_redirect1(VALUE ary, VALUE key, VALUE param)
+{
+    if (NIL_P(ary)) {
+        ary = hide_obj(rb_ary_new());
+    }
+    if (!RB_TYPE_P(key, T_ARRAY)) {
+        VALUE fd = check_exec_redirect_fd(key, !NIL_P(param));
+        rb_ary_push(ary, hide_obj(rb_assoc_new(fd, param)));
+    }
+    else {
+        int i, n=0;
+        for (i = 0 ; i < RARRAY_LEN(key); i++) {
+            VALUE v = RARRAY_PTR(key)[i];
+            VALUE fd = check_exec_redirect_fd(v, !NIL_P(param));
+            rb_ary_push(ary, hide_obj(rb_assoc_new(fd, param)));
+            n++;
+        }
+    }
+    return ary;
+}
+
 static void
 check_exec_redirect(VALUE key, VALUE val, VALUE options)
 {
@@ -1515,23 +1537,8 @@
     }
 
     ary = rb_ary_entry(options, index);
-    if (NIL_P(ary)) {
-        ary = hide_obj(rb_ary_new());
-        rb_ary_store(options, index, ary);
-    }
-    if (!RB_TYPE_P(key, T_ARRAY)) {
-        VALUE fd = check_exec_redirect_fd(key, !NIL_P(param));
-        rb_ary_push(ary, hide_obj(rb_assoc_new(fd, param)));
-    }
-    else {
-        int i, n=0;
-        for (i = 0 ; i < RARRAY_LEN(key); i++) {
-            VALUE v = RARRAY_PTR(key)[i];
-            VALUE fd = check_exec_redirect_fd(v, !NIL_P(param));
-            rb_ary_push(ary, hide_obj(rb_assoc_new(fd, param)));
-            n++;
-        }
-    }
+    ary = check_exec_redirect1(ary, key, param);
+    rb_ary_store(options, index, ary);
 }
 
 #if defined(HAVE_SETRLIMIT) && defined(NUM2RLIM)

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

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