From 4b146b25333c52ca4503dfc3c4215b583e8e9963 Mon Sep 17 00:00:00 2001 From: nobu Date: Tue, 4 Feb 2014 05:07:21 +0000 Subject: pack.c: use ivar for associated objects * pack.c (str_associate, str_associated): keep associated objects in an instance variables, instead of in the internal structure. * string.c (rb_str_associate, rb_str_associated): deprecate. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44804 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- string.c | 41 ----------------------------------------- 1 file changed, 41 deletions(-) (limited to 'string.c') diff --git a/string.c b/string.c index 983c2a1166..224710869f 100644 --- a/string.c +++ b/string.c @@ -1535,47 +1535,6 @@ str_discard(VALUE str) } } -void -rb_str_associate(VALUE str, VALUE add) -{ - /* sanity check */ - rb_check_frozen(str); - if (STR_ASSOC_P(str)) { - /* already associated */ - rb_ary_concat(RSTRING(str)->as.heap.aux.shared, add); - } - else { - if (STR_SHARED_P(str)) { - VALUE assoc = RSTRING(str)->as.heap.aux.shared; - str_make_independent(str); - if (STR_ASSOC_P(assoc)) { - assoc = RSTRING(assoc)->as.heap.aux.shared; - rb_ary_concat(assoc, add); - add = assoc; - } - } - else if (STR_EMBED_P(str)) { - str_make_independent(str); - } - else if (RSTRING(str)->as.heap.aux.capa != RSTRING_LEN(str)) { - RESIZE_CAPA(str, RSTRING_LEN(str)); - } - FL_SET(str, STR_ASSOC); - RBASIC_CLEAR_CLASS(add); - RB_OBJ_WRITE(str, &RSTRING(str)->as.heap.aux.shared, add); - } -} - -VALUE -rb_str_associated(VALUE str) -{ - if (STR_SHARED_P(str)) str = RSTRING(str)->as.heap.aux.shared; - if (STR_ASSOC_P(str)) { - return RSTRING(str)->as.heap.aux.shared; - } - return Qfalse; -} - void rb_must_asciicompat(VALUE str) { -- cgit v1.2.3