ruby-changes:24157
From: nobu <ko1@a...>
Date: Sun, 24 Jun 2012 22:53:54 +0900 (JST)
Subject: [ruby-changes:24157] nobu:r36208 (trunk): process.c: separate check_exec_fds_1
nobu 2012-06-24 22:53:44 +0900 (Sun, 24 Jun 2012) New Revision: 36208 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=36208 Log: 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. Modified files: trunk/ChangeLog trunk/process.c Index: ChangeLog =================================================================== --- ChangeLog (revision 36207) +++ ChangeLog (revision 36208) @@ -1,3 +1,8 @@ +Sun Jun 24 22:53:42 2012 Nobuyoshi Nakada <nobu@r...> + + * 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@f...> * internal.h (rb_execarg): options field removed. Index: process.c =================================================================== --- process.c (revision 36207) +++ process.c (revision 36208) @@ -1689,25 +1689,12 @@ 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,7 +1716,22 @@ } } } + 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; for (i = 0; i < RARRAY_LEN(ary); i++) { -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/