mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
process.c: constify
* process.c (rb_execarg_new, rb_execarg_init): constify argv. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45357 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
d90075cb10
commit
d64ba37ad0
3 changed files with 9 additions and 7 deletions
|
@ -963,9 +963,9 @@ VALUE rb_int_positive_pow(long x, unsigned long y);
|
|||
/* process.c */
|
||||
int rb_exec_async_signal_safe(const struct rb_execarg *e, char *errmsg, size_t errmsg_buflen);
|
||||
rb_pid_t rb_fork_async_signal_safe(int *status, int (*chfunc)(void*, char *, size_t), void *charg, VALUE fds, char *errmsg, size_t errmsg_buflen);
|
||||
VALUE rb_execarg_new(int argc, VALUE *argv, int accept_shell);
|
||||
VALUE rb_execarg_new(int argc, const VALUE *argv, int accept_shell);
|
||||
struct rb_execarg *rb_execarg_get(VALUE execarg_obj); /* dangerous. needs GC guard. */
|
||||
VALUE rb_execarg_init(int argc, VALUE *argv, int accept_shell, VALUE execarg_obj);
|
||||
VALUE rb_execarg_init(int argc, const VALUE *argv, int accept_shell, VALUE execarg_obj);
|
||||
int rb_execarg_addopt(VALUE execarg_obj, VALUE key, VALUE val);
|
||||
void rb_execarg_fixup(VALUE execarg_obj);
|
||||
int rb_execarg_run_options(const struct rb_execarg *e, struct rb_execarg *s, char* errmsg, size_t errmsg_buflen);
|
||||
|
|
4
io.c
4
io.c
|
@ -6225,10 +6225,8 @@ rb_io_s_popen(int argc, VALUE *argv, VALUE klass)
|
|||
rb_raise(rb_eArgError, "too many arguments");
|
||||
}
|
||||
#endif
|
||||
tmp = rb_ary_dup(tmp);
|
||||
RBASIC_CLEAR_CLASS(tmp);
|
||||
execarg_obj = rb_execarg_new((int)len, RARRAY_CONST_PTR(tmp), FALSE);
|
||||
rb_ary_clear(tmp);
|
||||
RB_GC_GUARD(tmp);
|
||||
}
|
||||
else {
|
||||
SafeStringValue(pname);
|
||||
|
|
|
@ -2198,7 +2198,7 @@ rb_exec_fillarg(VALUE prog, int argc, VALUE *argv, VALUE env, VALUE opthash, VAL
|
|||
}
|
||||
|
||||
VALUE
|
||||
rb_execarg_new(int argc, VALUE *argv, int accept_shell)
|
||||
rb_execarg_new(int argc, const VALUE *argv, int accept_shell)
|
||||
{
|
||||
VALUE execarg_obj;
|
||||
struct rb_execarg *eargp;
|
||||
|
@ -2217,13 +2217,17 @@ rb_execarg_get(VALUE execarg_obj)
|
|||
}
|
||||
|
||||
VALUE
|
||||
rb_execarg_init(int argc, VALUE *argv, int accept_shell, VALUE execarg_obj)
|
||||
rb_execarg_init(int argc, const VALUE *orig_argv, int accept_shell, VALUE execarg_obj)
|
||||
{
|
||||
struct rb_execarg *eargp = rb_execarg_get(execarg_obj);
|
||||
VALUE prog, ret;
|
||||
VALUE env = Qnil, opthash = Qnil;
|
||||
VALUE argv_buf;
|
||||
VALUE *argv = ALLOCV_N(VALUE, argv_buf, argc);
|
||||
MEMCPY(argv, orig_argv, VALUE, argc);
|
||||
prog = rb_exec_getargs(&argc, &argv, accept_shell, &env, &opthash);
|
||||
rb_exec_fillarg(prog, argc, argv, env, opthash, execarg_obj);
|
||||
ALLOCV_END(argv_buf);
|
||||
ret = eargp->use_shell ? eargp->invoke.sh.shell_script : eargp->invoke.cmd.command_name;
|
||||
RB_GC_GUARD(execarg_obj);
|
||||
return ret;
|
||||
|
|
Loading…
Reference in a new issue