mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* string.c (rb_str_include): should not treat char as negative value.
[ruby-dev:24558] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7096 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
9ec1f6d27e
commit
0f3decb071
2 changed files with 7 additions and 9 deletions
|
@ -1,3 +1,8 @@
|
|||
Fri Oct 22 00:20:33 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* string.c (rb_str_include): should not treat char as negative value.
|
||||
[ruby-dev:24558]
|
||||
|
||||
Thu Oct 21 19:06:15 2004 GOTOU Yuuzou <gotoyuzo@notwork.org>
|
||||
|
||||
* lib/webrick/httpresponse.rb (WEBrick::HTTPResponse#send_body_io):
|
||||
|
|
11
string.c
11
string.c
|
@ -2422,15 +2422,8 @@ rb_str_include(str, arg)
|
|||
long i;
|
||||
|
||||
if (FIXNUM_P(arg)) {
|
||||
int c = FIX2INT(arg);
|
||||
long len = RSTRING(str)->len;
|
||||
char *p = RSTRING(str)->ptr;
|
||||
|
||||
for (i=0; i<len; i++) {
|
||||
if (p[i] == c) {
|
||||
return Qtrue;
|
||||
}
|
||||
}
|
||||
if (memchr(RSTRING(str)->ptr, FIX2INT(arg), RSTRING(str)->len))
|
||||
return Qtrue;
|
||||
return Qfalse;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue