mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* string.c (rb_str_hash): gets rid of collisions between different
encoding strings. [ruby-core:20526] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20804 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
446bcf9a23
commit
6bcd363ebf
2 changed files with 10 additions and 1 deletions
|
@ -1,3 +1,8 @@
|
|||
Wed Dec 17 11:01:35 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* string.c (rb_str_hash): gets rid of collisions between differen
|
||||
encoding strings. [ruby-core:20526]
|
||||
|
||||
Wed Dec 17 09:50:19 2008 Yuki Sonoda (Yugui) <yugui@yugui.jp>
|
||||
|
||||
* test/ruby/test_metaclass.rb: removed codes for my debugging.
|
||||
|
|
6
string.c
6
string.c
|
@ -2014,7 +2014,11 @@ rb_memhash(const void *ptr, long len)
|
|||
int
|
||||
rb_str_hash(VALUE str)
|
||||
{
|
||||
return rb_memhash((const void *)RSTRING_PTR(str), RSTRING_LEN(str));
|
||||
int e = ENCODING_GET(str);
|
||||
if (e) {
|
||||
if (rb_enc_str_asciionly_p(str)) e = 0;
|
||||
}
|
||||
return rb_memhash((const void *)RSTRING_PTR(str), RSTRING_LEN(str)) ^ e;
|
||||
}
|
||||
|
||||
int
|
||||
|
|
Loading…
Reference in a new issue