diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-02-04 05:07:21 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-02-04 05:07:21 +0000 |
commit | 4b146b25333c52ca4503dfc3c4215b583e8e9963 (patch) | |
tree | 49a58a57b9bb34ed0d35af273ad9ed46bc95403b /string.c | |
parent | bebc52a4a721a1c1d5a98760d58df296ff0d2497 (diff) | |
download | ruby-4b146b25333c52ca4503dfc3c4215b583e8e9963.tar.gz |
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
Diffstat (limited to 'string.c')
-rw-r--r-- | string.c | 41 |
1 files changed, 0 insertions, 41 deletions
@@ -1536,47 +1536,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) { rb_encoding *enc = rb_enc_get(str); |