ruby-changes:23929
From: akr <ko1@a...>
Date: Sat, 9 Jun 2012 10:07:18 +0900 (JST)
Subject: [ruby-changes:23929] akr:r35980 (trunk): * process.c: simplified because close_others option is always
akr 2012-06-09 10:07:07 +0900 (Sat, 09 Jun 2012) New Revision: 35980 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=35980 Log: * process.c: simplified because close_others option is always enabled by default. (rb_f_exec): don't need to set the option. (rb_exec_arg_prepare): don't need to set the option. don't need default_close_others argument. (rb_spawn_internal): don't need to give default_close_others argument for rb_exec_arg_prepare. don't need default_close_others argument. (rb_spawn_err): don't need to give default_close_others argument for rb_spawn_internal. (rb_spawn): don't need to give default_close_others argument for rb_spawn_internal. (rb_f_system): don't need to give default_close_others argument for rb_spawn_internal. (rb_f_spawn): don't need to give default_close_others argument for rb_exec_arg_prepare. Modified files: trunk/ChangeLog trunk/process.c Index: ChangeLog =================================================================== --- ChangeLog (revision 35979) +++ ChangeLog (revision 35980) @@ -1,3 +1,22 @@ +Sat Jun 9 09:31:07 2012 Tanaka Akira <akr@f...> + + * process.c: simplified because close_others option is always + enabled by default. + (rb_f_exec): don't need to set the option. + (rb_exec_arg_prepare): don't need to set the option. don't need + default_close_others argument. + (rb_spawn_internal): don't need to give default_close_others + argument for rb_exec_arg_prepare. don't need default_close_others + argument. + (rb_spawn_err): don't need to give default_close_others + argument for rb_spawn_internal. + (rb_spawn): don't need to give default_close_others + argument for rb_spawn_internal. + (rb_f_system): don't need to give default_close_others argument for + rb_spawn_internal. + (rb_f_spawn): don't need to give default_close_others argument for + rb_exec_arg_prepare. + Sat Jun 9 09:00:58 2012 Tanaka Akira <akr@f...> * process.c (rb_proc_exec): call before_exec() here addition to Index: process.c =================================================================== --- process.c (revision 35979) +++ process.c (revision 35980) @@ -2000,8 +2000,6 @@ char errmsg[CHILD_ERRMSG_BUFLEN] = { '\0' }; rb_exec_arg_init(argc, argv, TRUE, &earg); - if (NIL_P(rb_ary_entry(earg.options, EXEC_OPTION_CLOSE_OTHERS))) - rb_exec_arg_addopt(&earg, ID2SYM(rb_intern("close_others")), Qtrue); rb_exec_arg_fixup(&earg); rb_exec_err(&earg, errmsg, sizeof(errmsg)); @@ -3130,13 +3128,9 @@ } static void -rb_exec_arg_prepare(struct rb_exec_arg *earg, int argc, VALUE *argv, int default_close_others) +rb_exec_arg_prepare(struct rb_exec_arg *earg, int argc, VALUE *argv) { rb_exec_arg_init(argc, argv, TRUE, earg); - if (NIL_P(rb_ary_entry(earg->options, EXEC_OPTION_CLOSE_OTHERS))) { - VALUE v = default_close_others ? Qtrue : Qfalse; - rb_exec_arg_addopt(earg, ID2SYM(rb_intern("close_others")), v); - } rb_exec_arg_fixup(earg); } @@ -3193,24 +3187,23 @@ } static rb_pid_t -rb_spawn_internal(int argc, VALUE *argv, int default_close_others, - char *errmsg, size_t errmsg_buflen) +rb_spawn_internal(int argc, VALUE *argv, char *errmsg, size_t errmsg_buflen) { struct rb_exec_arg earg; - rb_exec_arg_prepare(&earg, argc, argv, default_close_others); + rb_exec_arg_prepare(&earg, argc, argv); return rb_spawn_process(&earg, errmsg, errmsg_buflen); } rb_pid_t rb_spawn_err(int argc, VALUE *argv, char *errmsg, size_t errmsg_buflen) { - return rb_spawn_internal(argc, argv, TRUE, errmsg, errmsg_buflen); + return rb_spawn_internal(argc, argv, errmsg, errmsg_buflen); } rb_pid_t rb_spawn(int argc, VALUE *argv) { - return rb_spawn_internal(argc, argv, TRUE, NULL, 0); + return rb_spawn_internal(argc, argv, NULL, 0); } /* @@ -3261,7 +3254,7 @@ chfunc = signal(SIGCHLD, SIG_DFL); #endif - pid = rb_spawn_internal(argc, argv, TRUE, NULL, 0); + pid = rb_spawn_internal(argc, argv, NULL, 0); #if defined(HAVE_FORK) || defined(HAVE_SPAWNV) if (pid > 0) { rb_syswait(pid); @@ -3531,7 +3524,7 @@ char errmsg[CHILD_ERRMSG_BUFLEN] = { '\0' }; struct rb_exec_arg earg; - rb_exec_arg_prepare(&earg, argc, argv, TRUE); + rb_exec_arg_prepare(&earg, argc, argv); pid = rb_spawn_process(&earg, errmsg, sizeof(errmsg)); if (pid == -1) { const char *prog = errmsg; -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/