mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
2000-02-23
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@624 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
6f82a67fd0
commit
bf70582cf3
19 changed files with 130 additions and 23 deletions
20
string.c
20
string.c
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue