summaryrefslogtreecommitdiff
path: root/hash.c
diff options
context:
space:
mode:
authortmm1 <tmm1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-12-08 01:52:28 +0000
committertmm1 <tmm1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-12-08 01:52:28 +0000
commit779ae78995977305aa5aec9cb5b562dcf54c22e7 (patch)
tree03cb95144e04846d686d4fc01a6a8a000b9d807d /hash.c
parent98a74d4dd5fa9cd45121e8ebfc2f787d316e924f (diff)
hash.c: revert r43870 and add alternative parser patch for literal keys
* hash.c (hash_aset_str): revert r43870 due to performance issue [Bug #9188] [ruby-core:58730] * parse.y (assoc): convert literal string hash keys to fstrings * test/ruby/test_hash.rb (class TestHash): expand test git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44058 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'hash.c')
-rw-r--r--hash.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/hash.c b/hash.c
index a52e02f..1321b83 100644
--- a/hash.c
+++ b/hash.c
@@ -1288,9 +1288,7 @@ static int
hash_aset_str(st_data_t *key, st_data_t *val, struct update_arg *arg, int existing)
{
if (!existing) {
- VALUE str = (VALUE)*key;
- if (!OBJ_FROZEN(str))
- *key = rb_fstring(str);
+ *key = rb_str_new_frozen(*key);
}
return hash_aset(key, val, arg, existing);
}