process.c: separate check_exec_fds_1

* process.c (check_exec_fds): separate check_exec_fds_1() since
  nonstatic initializer of an aggregate type is not allowed by C89.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36208 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2012-06-24 13:53:44 +00:00
Родитель 5cc2112ed1
Коммит 5be0ab591c
2 изменённых файлов: 23 добавлений и 16 удалений

Просмотреть файл

@ -1,3 +1,8 @@
Sun Jun 24 22:53:42 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
* process.c (check_exec_fds): separate check_exec_fds_1() since
nonstatic initializer of an aggregate type is not allowed by C89.
Sun Jun 24 07:47:17 2012 Tanaka Akira <akr@fsij.org>
* internal.h (rb_execarg): options field removed.

Просмотреть файл

@ -1689,25 +1689,12 @@ check_exec_options_i(st_data_t st_key, st_data_t st_val, st_data_t arg)
return rb_execarg_addopt(execarg_obj, key, val);
}
static VALUE
check_exec_fds(struct rb_execarg *eargp)
static int
check_exec_fds_1(struct rb_execarg *eargp, VALUE h, int maxhint, VALUE ary)
{
VALUE h = rb_hash_new();
VALUE ary;
int maxhint = -1;
long i;
int j;
VALUE fd_opts[] = {
eargp->fd_dup2,
eargp->fd_close,
eargp->fd_open,
eargp->fd_dup2_child
};
for (j = 0; j < (int)(sizeof(fd_opts)/sizeof(*fd_opts)); j++) {
ary = fd_opts[j];
if (ary == Qfalse)
continue;
if (ary != Qfalse) {
for (i = 0; i < RARRAY_LEN(ary); i++) {
VALUE elt = RARRAY_PTR(ary)[i];
int fd = FIX2INT(RARRAY_PTR(elt)[0]);
@ -1729,6 +1716,21 @@ check_exec_fds(struct rb_execarg *eargp)
}
}
}
return maxhint;
}
static VALUE
check_exec_fds(struct rb_execarg *eargp)
{
VALUE h = rb_hash_new();
VALUE ary;
int maxhint = -1;
long i;
maxhint = check_exec_fds_1(eargp, h, maxhint, eargp->fd_dup2);
maxhint = check_exec_fds_1(eargp, h, maxhint, eargp->fd_close);
maxhint = check_exec_fds_1(eargp, h, maxhint, eargp->fd_open);
maxhint = check_exec_fds_1(eargp, h, maxhint, eargp->fd_dup2_child);
if (eargp->fd_dup2_child) {
ary = eargp->fd_dup2_child;