aboutsummaryrefslogtreecommitdiffstats
path: root/proc.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-09-25 13:33:08 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-09-25 13:33:08 +0000
commit37982d920dc818e7840f620d26d5bcbce7074c1b (patch)
tree77f8756e84fd61920bc5dcd8d2ee4de5056ef585 /proc.c
parentd535ff65e15219136adb28841fe8219903d1556d (diff)
downloadruby-37982d920dc818e7840f620d26d5bcbce7074c1b.tar.gz
proc.c: trivial optimization
* proc.c (rb_proc_arity): reduce repeated GetProcPtr. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56237 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'proc.c')
-rw-r--r--proc.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/proc.c b/proc.c
index f2002eb355..e39fd0528d 100644
--- a/proc.c
+++ b/proc.c
@@ -963,18 +963,17 @@ static int
rb_proc_min_max_arity(VALUE self, int *max)
{
rb_proc_t *proc;
- const struct rb_block *block;
GetProcPtr(self, proc);
- block = &proc->block;
- return rb_block_min_max_arity(block, max);
+ return rb_block_min_max_arity(&proc->block, max);
}
int
rb_proc_arity(VALUE self)
{
rb_proc_t *proc;
- int max, min = rb_proc_min_max_arity(self, &max);
+ int max, min;
GetProcPtr(self, proc);
+ min = rb_block_min_max_arity(&proc->block, &max);
return (proc->is_lambda ? min == max : max != UNLIMITED_ARGUMENTS) ? min : -min-1;
}