From 3685aa630731f70b245cdf0eb8a759d0e7a35a12 Mon Sep 17 00:00:00 2001 From: matz Date: Tue, 26 Sep 2006 22:46:16 +0000 Subject: * array.c (rb_ary_shift): shift/unshift performance boost patch, based on the patch from Eric Mahurin . [ruby-core:05861] * array.c (rb_ary_unshift_m): ditto. * array.c (ary_make_shared): ditto. * array.c (RESIZE_CAPA): ditto. * array.c (rb_ary_free): new function to free memory. code moved from gc.c. * string.c (rb_str_free): ditto. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@11038 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- string.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'string.c') diff --git a/string.c b/string.c index 8cd93a69b..9a45d2f5c 100644 --- a/string.c +++ b/string.c @@ -299,6 +299,14 @@ rb_str_buf_new2(const char *ptr) return str; } +void +rb_str_free(VALUE str) +{ + if (!STR_EMBED_P(str) && !STR_SHARED_P(str)) { + xfree(RSTRING(str)->as.heap.ptr); + } +} + VALUE rb_str_to_str(VALUE str) { -- cgit