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

ruby-changes:42843

From: nobu <ko1@a...>
Date: Thu, 5 May 2016 15:21:36 +0900 (JST)
Subject: [ruby-changes:42843] nobu:r54917 (trunk): proc.c: no unnecessary temporary array

nobu	2016-05-05 16:18:14 +0900 (Thu, 05 May 2016)

  New Revision: 54917

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

  Log:
    proc.c: no unnecessary temporary array
    
    * proc.c (bmcall): get rid of making temporary single element
      array.

  Modified files:
    trunk/proc.c
Index: proc.c
===================================================================
--- proc.c	(revision 54916)
+++ proc.c	(revision 54917)
@@ -2533,12 +2533,9 @@ bmcall(VALUE args, VALUE method, int arg https://github.com/ruby/ruby/blob/trunk/proc.c#L2533
     VALUE ret;
 
     if (CLASS_OF(args) != rb_cArray) {
-	args = rb_ary_new3(1, args);
-	argc = 1;
-    }
-    else {
-	argc = check_argc(RARRAY_LEN(args));
+	return rb_method_call_with_block(1, &args, method, passed_proc);
     }
+    argc = check_argc(RARRAY_LEN(args));
     ret = rb_method_call_with_block(argc, RARRAY_PTR(args), method, passed_proc);
     RB_GC_GUARD(a) = args;
     return ret;

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

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