summaryrefslogtreecommitdiff
path: root/array.c
diff options
context:
space:
mode:
authorPeter Zhu <peter@peterzhu.ca>2022-07-25 10:29:10 -0400
committerPeter Zhu <peter@peterzhu.ca>2022-07-26 09:12:09 -0400
commit3f70aa6504d4c63a3cc928c52d6cf88dafffb40d (patch)
tree968228482e0829899f0e46d29cdbbfa40ad57f5e /array.c
parent456e1d1eaa9bb11adaed1acde488d7da3c88704b (diff)
downloadruby-3f70aa6504d4c63a3cc928c52d6cf88dafffb40d.tar.gz
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.
Diffstat (limited to 'array.c')
-rw-r--r--array.c11
1 files changed, 1 insertions, 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)
}
}
-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)
}
#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)
counters[m]++;
}
}
+
done:
- tmpary_discard(t0);
ALLOCV_END(t1);
return NIL_P(result) ? ary : result;