[前][次][番号順一覧][スレッド一覧]

ruby-changes:44164

From: nobu <ko1@a...>
Date: Sun, 25 Sep 2016 22:33:14 +0900 (JST)
Subject: [ruby-changes:44164] nobu:r56237 (trunk): proc.c: trivial optimization

nobu	2016-09-25 22:33:08 +0900 (Sun, 25 Sep 2016)

  New Revision: 56237

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=56237

  Log:
    proc.c: trivial optimization
    
    * proc.c (rb_proc_arity): reduce repeated GetProcPtr.

  Modified files:
    trunk/proc.c
Index: proc.c
===================================================================
--- proc.c	(revision 56236)
+++ proc.c	(revision 56237)
@@ -963,18 +963,17 @@ static int https://github.com/ruby/ruby/blob/trunk/proc.c#L963
 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;
 }
 

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]