diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2000-02-23 05:23:12 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2000-02-23 05:23:12 +0000 |
commit | bf70582cf30ae6f715769c519f451411f5d2a577 (patch) | |
tree | b3eb8e2975df384946ad70572e1e3387a6c3127c /string.c | |
parent | 6f82a67fd0035fcd2802f1564165d5211bc98ea2 (diff) |
2000-02-23
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@624 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'string.c')
-rw-r--r-- | string.c | 20 |
1 files changed, 19 insertions, 1 deletions
@@ -421,6 +421,7 @@ rb_str_hash(str) register char *p = RSTRING(str)->ptr; register int key = 0; +#if 0 if (ruby_ignorecase) { while (len--) { key = key*65599 + toupper(*p); @@ -433,6 +434,20 @@ rb_str_hash(str) p++; } } +#else + if (ruby_ignorecase) { + while (len--) { + key = key*33 + toupper(*p); + p++; + } + } + else { + while (len--) { + key = key*33 + *p++; + } + } + key = key + (key>>5); +#endif return key; } @@ -1354,6 +1369,7 @@ rb_str_inspect(str) char buf[STRMAX]; char *p, *pend; char *b; + VALUE inspect; p = RSTRING(str)->ptr; pend = p + RSTRING(str)->len; b = buf; @@ -1430,7 +1446,9 @@ rb_str_inspect(str) } } *b++ = '"'; - return rb_str_new(buf, b - buf); + inspect = rb_str_new(buf, b - buf); + OBJ_INFECT(inspect, str); + return inspect; } static VALUE |