summaryrefslogtreecommitdiffstats
path: root/hash.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-12-18 08:05:17 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-12-18 08:05:17 +0000
commit43e52695185f8215a14a664d6a84894c132eb937 (patch)
tree2f50bda0dd607136eb9c2c8d3347dfd7ac2752b7 /hash.c
parent17842166c989d0047146db507fa25e6e8e88ec9e (diff)
downloadruby-43e52695185f8215a14a664d6a84894c132eb937.tar.gz
ruby-43e52695185f8215a14a664d6a84894c132eb937.tar.xz
ruby-43e52695185f8215a14a664d6a84894c132eb937.zip
* hash.c (rb_hash_aset): string key copying only happen if key is
an exact instance of String, not a subclass. based on a patch from Mike Gold <mike.gold.4433 at gmail.com> in [ruby-talk:322667]. [incompatible] [ruby-talk:322417] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@20860 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'hash.c')
-rw-r--r--hash.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/hash.c b/hash.c
index 044964c80..f3bd0b66b 100644
--- a/hash.c
+++ b/hash.c
@@ -984,7 +984,7 @@ rb_hash_aset(VALUE hash, VALUE key, VALUE val)
{
rb_hash_modify(hash);
if (RHASH(hash)->ntbl->type == &identhash ||
- TYPE(key) != T_STRING || st_lookup(RHASH(hash)->ntbl, key, 0)) {
+ rb_obj_class(key) != rb_cString || st_lookup(RHASH(hash)->ntbl, key, 0)) {
st_insert(RHASH(hash)->ntbl, key, val);
}
else {