ruby-changes:34358
From: nobu <ko1@a...>
Date: Mon, 16 Jun 2014 14:28:18 +0900 (JST)
Subject: [ruby-changes:34358] nobu:r46439 (trunk): process.c: variable as macro argument
nobu 2014-06-16 14:28:03 +0900 (Mon, 16 Jun 2014) New Revision: 46439 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=46439 Log: process.c: variable as macro argument * process.c (run_exec_open): use a local variable to get rid of RARRAY_AREF() is evaluated multiple times by RSTRING_PTR(). Modified files: trunk/process.c Index: process.c =================================================================== --- process.c (revision 46438) +++ process.c (revision 46439) @@ -2743,7 +2743,8 @@ run_exec_open(VALUE ary, struct rb_execa https://github.com/ruby/ruby/blob/trunk/process.c#L2743 VALUE elt = RARRAY_AREF(ary, i); int fd = FIX2INT(RARRAY_AREF(elt, 0)); VALUE param = RARRAY_AREF(elt, 1); - char *path = RSTRING_PTR(RARRAY_AREF(param, 0)); + const VALUE vpath = RARRAY_AREF(param, 0); + const char *path = RSTRING_PTR(vpath); int flags = NUM2INT(RARRAY_AREF(param, 1)); int perm = NUM2INT(RARRAY_AREF(param, 2)); int need_close = 1; -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/