mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
nil as the default of optional parameters
This commit is contained in:
parent
d8e23a67c3
commit
d45d448d71
1 changed files with 7 additions and 9 deletions
16
process.c
16
process.c
|
@ -1992,6 +1992,7 @@ rb_execarg_addopt_rlimit(struct rb_execarg *eargp, int rtype, VALUE val)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define TO_BOOL(val, name) NIL_P(val) ? 0 : rb_bool_expected((val), name)
|
||||||
int
|
int
|
||||||
rb_execarg_addopt(VALUE execarg_obj, VALUE key, VALUE val)
|
rb_execarg_addopt(VALUE execarg_obj, VALUE key, VALUE val)
|
||||||
{
|
{
|
||||||
|
@ -2039,7 +2040,7 @@ rb_execarg_addopt(VALUE execarg_obj, VALUE key, VALUE val)
|
||||||
rb_raise(rb_eArgError, "new_pgroup option specified twice");
|
rb_raise(rb_eArgError, "new_pgroup option specified twice");
|
||||||
}
|
}
|
||||||
eargp->new_pgroup_given = 1;
|
eargp->new_pgroup_given = 1;
|
||||||
eargp->new_pgroup_flag = rb_bool_expected(val, "new_pgroup");
|
eargp->new_pgroup_flag = TO_BOOL(val, "new_pgroup");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
|
@ -2048,7 +2049,7 @@ rb_execarg_addopt(VALUE execarg_obj, VALUE key, VALUE val)
|
||||||
rb_raise(rb_eArgError, "unsetenv_others option specified twice");
|
rb_raise(rb_eArgError, "unsetenv_others option specified twice");
|
||||||
}
|
}
|
||||||
eargp->unsetenv_others_given = 1;
|
eargp->unsetenv_others_given = 1;
|
||||||
eargp->unsetenv_others_do = rb_bool_expected(val, "unsetenv_others");
|
eargp->unsetenv_others_do = TO_BOOL(val, "unsetenv_others");
|
||||||
}
|
}
|
||||||
else if (id == id_chdir) {
|
else if (id == id_chdir) {
|
||||||
if (eargp->chdir_given) {
|
if (eargp->chdir_given) {
|
||||||
|
@ -2072,7 +2073,7 @@ rb_execarg_addopt(VALUE execarg_obj, VALUE key, VALUE val)
|
||||||
rb_raise(rb_eArgError, "close_others option specified twice");
|
rb_raise(rb_eArgError, "close_others option specified twice");
|
||||||
}
|
}
|
||||||
eargp->close_others_given = 1;
|
eargp->close_others_given = 1;
|
||||||
eargp->close_others_do = rb_bool_expected(val, "close_others");
|
eargp->close_others_do = TO_BOOL(val, "close_others");
|
||||||
}
|
}
|
||||||
else if (id == id_in) {
|
else if (id == id_in) {
|
||||||
key = INT2FIX(0);
|
key = INT2FIX(0);
|
||||||
|
@ -2121,7 +2122,7 @@ rb_execarg_addopt(VALUE execarg_obj, VALUE key, VALUE val)
|
||||||
rb_raise(rb_eArgError, "exception option specified twice");
|
rb_raise(rb_eArgError, "exception option specified twice");
|
||||||
}
|
}
|
||||||
eargp->exception_given = 1;
|
eargp->exception_given = 1;
|
||||||
eargp->exception = rb_bool_expected(val, "exception");
|
eargp->exception = TO_BOOL(val, "exception");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return ST_STOP;
|
return ST_STOP;
|
||||||
|
@ -6483,11 +6484,8 @@ proc_daemon(int argc, VALUE *argv)
|
||||||
int n, nochdir = FALSE, noclose = FALSE;
|
int n, nochdir = FALSE, noclose = FALSE;
|
||||||
|
|
||||||
switch (rb_check_arity(argc, 0, 2)) {
|
switch (rb_check_arity(argc, 0, 2)) {
|
||||||
case 2:
|
case 2: noclose = TO_BOOL(argv[1], "noclose");
|
||||||
if (!NIL_P(argv[1])) noclose = rb_bool_expected(argv[1], "noclose");
|
case 1: nochdir = TO_BOOL(argv[0], "nochdir");
|
||||||
/* fallthrough */
|
|
||||||
case 1:
|
|
||||||
if (!NIL_P(argv[0])) nochdir = rb_bool_expected(argv[0], "nochdir");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
prefork();
|
prefork();
|
||||||
|
|
Loading…
Reference in a new issue