From e5a7c2db988db967140da2e11bdf8bb8e85d7769 Mon Sep 17 00:00:00 2001 From: nobu Date: Wed, 30 Jul 2014 13:46:41 +0000 Subject: get rid of function calls in RSTRING_PTR * process.c (rlimit_resource_type, rlimit_resource_value): get rid of function calls in RSTRING_PTR(), as it evaluates the argument twice. * re.c (match_backref_number): ditto. * signal.c (esignal_init, rb_f_kill, trap_signm): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47006 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- process.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'process.c') diff --git a/process.c b/process.c index e9d1b0638f..bcccddcdcd 100644 --- a/process.c +++ b/process.c @@ -4529,7 +4529,8 @@ rlimit_resource_type(VALUE rtype) switch (TYPE(rtype)) { case T_SYMBOL: - name = RSTRING_PTR(rb_sym2str(rtype)); + v = rb_sym2str(rtype); + name = RSTRING_PTR(v); break; default: @@ -4564,7 +4565,8 @@ rlimit_resource_value(VALUE rval) switch (TYPE(rval)) { case T_SYMBOL: - name = RSTRING_PTR(rb_sym2str(rval)); + v = rb_sym2str(rval); + name = RSTRING_PTR(v); break; default: -- cgit v1.2.3