summaryrefslogtreecommitdiff
path: root/process.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-06-16 05:28:03 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-06-16 05:28:03 +0000
commitd327c8da66ec93052fad692c71e0253ba86e7b96 (patch)
tree7a64f212c3de348628d91d89c99b2c66d279ee34 /process.c
parent800c7af73ccae7ef862674f682d1d82ba2149379 (diff)
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
Diffstat (limited to 'process.c')
-rw-r--r--process.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/process.c b/process.c
index 5fc0bed..42fbad0 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;