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

ruby-changes:52543

From: marcandre <ko1@a...>
Date: Sun, 16 Sep 2018 11:42:32 +0900 (JST)
Subject: [ruby-changes:52543] marcandRe: r64755 (trunk): array.c: Optimize rb_ary_and. Patch by Stefan Sch?\195?\188?\195?\159ler. [Fix GH-1938]

marcandre	2018-09-16 11:42:26 +0900 (Sun, 16 Sep 2018)

  New Revision: 64755

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

  Log:
    array.c: Optimize rb_ary_and. Patch by Stefan Sch?\195?\188?\195?\159ler. [Fix GH-1938]

  Modified files:
    trunk/array.c
Index: array.c
===================================================================
--- array.c	(revision 64754)
+++ array.c	(revision 64755)
@@ -4236,7 +4236,7 @@ rb_ary_and(VALUE ary1, VALUE ary2) https://github.com/ruby/ruby/blob/trunk/array.c#L4236
 
     ary2 = to_ary(ary2);
     ary3 = rb_ary_new();
-    if (RARRAY_LEN(ary2) == 0) return ary3;
+    if (RARRAY_LEN(ary1) == 0 || RARRAY_LEN(ary2) == 0) return ary3;
 
     if (RARRAY_LEN(ary1) <= SMALL_ARRAY_LEN && RARRAY_LEN(ary2) <= SMALL_ARRAY_LEN) {
 	for (i=0; i<RARRAY_LEN(ary1); i++) {

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

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