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

ruby-changes:24146

From: akr <ko1@a...>
Date: Sat, 23 Jun 2012 17:18:51 +0900 (JST)
Subject: [ruby-changes:24146] akr:r36197 (trunk): * internal.h (rb_execarg): add env_modification field.

akr	2012-06-23 17:18:34 +0900 (Sat, 23 Jun 2012)

  New Revision: 36197

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

  Log:
    * internal.h (rb_execarg): add env_modification field.
    
    * process.c (EXEC_OPTION_ENV): removed.
      (mark_exec_arg): mark env_modification field.
      (rb_exec_fillarg): update the new field, instead of options array.
      (rb_execarg_fixup): use the new field.
      (save_env): ditto.
      (rb_execarg_run_options): ditto.

  Modified files:
    trunk/ChangeLog
    trunk/internal.h
    trunk/process.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 36196)
+++ ChangeLog	(revision 36197)
@@ -1,3 +1,14 @@
+Sat Jun 23 17:04:08 2012  Tanaka Akira  <akr@f...>
+
+	* internal.h (rb_execarg): add env_modification field.
+
+	* process.c (EXEC_OPTION_ENV): removed.
+	  (mark_exec_arg): mark env_modification field.
+	  (rb_exec_fillarg): update the new field, instead of options array.
+	  (rb_execarg_fixup): use the new field.
+	  (save_env): ditto.
+	  (rb_execarg_run_options): ditto.
+
 Sat Jun 23 16:27:01 2012  Tanaka Akira  <akr@f...>
 
 	* internal.h (rb_execarg): add rlimit_limits field.
Index: process.c
===================================================================
--- process.c	(revision 36196)
+++ process.c	(revision 36197)
@@ -1254,7 +1254,6 @@
 }
 
 enum {
-    EXEC_OPTION_ENV,
     EXEC_OPTION_DUP2,
     EXEC_OPTION_CLOSE,
     EXEC_OPTION_OPEN,
@@ -1280,6 +1279,7 @@
     rb_gc_mark(eargp->envp_buf);
     rb_gc_mark(eargp->dup2_tmpbuf);
     rb_gc_mark(eargp->rlimit_limits);
+    rb_gc_mark(eargp->env_modification);
     rb_gc_mark(eargp->chdir_dir);
 }
 
@@ -1896,7 +1896,7 @@
     }
     if (!NIL_P(env)) {
         env = rb_check_exec_env(env);
-        rb_ary_store(options, EXEC_OPTION_ENV, env);
+        eargp->env_modification = env;
     }
 
     eargp->use_shell = argc == 0;
@@ -2128,8 +2128,8 @@
     }
 
     unsetenv_others = eargp->unsetenv_others_given && eargp->unsetenv_others_do;
-    envopts = rb_ary_entry(eargp->options, EXEC_OPTION_ENV);
-    if (unsetenv_others || !NIL_P(envopts)) {
+    envopts = eargp->env_modification;
+    if (unsetenv_others || envopts != Qfalse) {
         VALUE envtbl, envp_str, envp_buf;
         char *p, *ep;
         if (unsetenv_others) {
@@ -2705,13 +2705,13 @@
     if (!sargp)
         return;
     soptions = sargp->options;
-    if (NIL_P(rb_ary_entry(soptions, EXEC_OPTION_ENV))) {
+    if (sargp->env_modification == Qfalse) {
         VALUE env = rb_const_get(rb_cObject, rb_intern("ENV"));
         if (RTEST(env)) {
             VALUE ary = hide_obj(rb_ary_new());
             rb_block_call(env, rb_intern("each"), 0, 0, save_env_i,
                           (VALUE)ary);
-            rb_ary_store(soptions, EXEC_OPTION_ENV, ary);
+            sargp->env_modification = ary;
         }
         rb_ary_store(soptions, EXEC_OPTION_UNSETENV_OTHERS, Qtrue);
     }
@@ -2757,8 +2757,8 @@
         rb_env_clear();
     }
 
-    obj = rb_ary_entry(options, EXEC_OPTION_ENV);
-    if (!NIL_P(obj)) {
+    obj = eargp->env_modification;
+    if (obj != Qfalse) {
         long i;
         save_env(sargp);
         for (i = 0; i < RARRAY_LEN(obj); i++) {
Index: internal.h
===================================================================
--- internal.h	(revision 36196)
+++ internal.h	(revision 36197)
@@ -187,6 +187,7 @@
     VALUE rlimit_limits; /* Qfalse or [[rtype, softlim, hardlim], ...] */
     mode_t umask_mask;
     int close_others_maxhint;
+    VALUE env_modification; /* Qfalse or [[k1,v1], ...] */
     VALUE chdir_dir;
 };
 

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

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