From d327c8da66ec93052fad692c71e0253ba86e7b96 Mon Sep 17 00:00:00 2001 From: nobu Date: Mon, 16 Jun 2014 05:28:03 +0000 Subject: 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(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46439 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- process.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'process.c') diff --git a/process.c b/process.c index 5fc0bed6b1..42fbad0559 100644 --- a/process.c +++ b/process.c @@ -2743,7 +2743,8 @@ run_exec_open(VALUE ary, struct rb_execarg *sargp, char *errmsg, size_t errmsg_b 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; -- cgit v1.2.3