summaryrefslogtreecommitdiff
path: root/string.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-10-21 15:21:08 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-10-21 15:21:08 +0000
commit5c60b0036613804737dbeb16f8f91dc75ce66482 (patch)
tree62b8697d16a957856bfd1f8c9bf8b09dac0e8676 /string.c
parentf3501cd8aee61d962f8ca2ba800602cd0376038c (diff)
* 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/branches/ruby_1_8@7096 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'string.c')
-rw-r--r--string.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/string.c b/string.c
index 9f00917..39069c9 100644
--- a/string.c
+++ b/string.c
@@ -2386,15 +2386,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;
}