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

ruby-changes:72691

From: Peter <ko1@a...>
Date: Tue, 26 Jul 2022 22:12:28 +0900 (JST)
Subject: [ruby-changes:72691] 3f70aa6504 (master): Remove ary_discard

https://git.ruby-lang.org/ruby.git/commit/?id=3f70aa6504

From 3f70aa6504d4c63a3cc928c52d6cf88dafffb40d Mon Sep 17 00:00:00 2001
From: Peter Zhu <peter@p...>
Date: Mon, 25 Jul 2022 10:29:10 -0400
Subject: Remove ary_discard

ary_discard should not be used as it should be handled by the GC. The
only user of ary_discard is rb_ary_product, which doesn't neeed to use
ary_discard.
---
 array.c | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/array.c b/array.c
index b0c4cee0bf..16c35f7934 100644
--- a/array.c
+++ b/array.c
@@ -1025,14 +1025,6 @@ rb_ary_memsize(VALUE ary) https://github.com/ruby/ruby/blob/trunk/array.c#L1025
     }
 }
 
-static inline void
-ary_discard(VALUE ary)
-{
-    rb_ary_free(ary);
-    RBASIC(ary)->flags |= RARRAY_EMBED_FLAG;
-    RBASIC(ary)->flags &= ~(RARRAY_EMBED_LEN_MASK | RARRAY_TRANSIENT_FLAG);
-}
-
 static VALUE
 ary_make_shared(VALUE ary)
 {
@@ -6938,7 +6930,6 @@ rb_ary_cycle(int argc, VALUE *argv, VALUE ary) https://github.com/ruby/ruby/blob/trunk/array.c#L6930
 }
 
 #define tmpary(n) rb_ary_tmp_new(n)
-#define tmpary_discard(a) (ary_discard(a), RBASIC_SET_CLASS_RAW(a, rb_cArray))
 
 /*
  * Build a ruby array of the corresponding values and yield it to the
@@ -7711,8 +7702,8 @@ rb_ary_product(int argc, VALUE *argv, VALUE ary) https://github.com/ruby/ruby/blob/trunk/array.c#L7702
             counters[m]++;
         }
     }
+
 done:
-    tmpary_discard(t0);
     ALLOCV_END(t1);
 
     return NIL_P(result) ? ary : result;
-- 
cgit v1.2.1


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

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