From 613f7c56f789762d3fabfd92ca7c16e00bae8415 Mon Sep 17 00:00:00 2001 From: matz Date: Tue, 17 Aug 2004 09:02:40 +0000 Subject: * io.c (rb_io_reopen): should clear allocated OpenFile. pointed out by Guy Decoux. [ruby-core:03288] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@6781 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- string.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'string.c') diff --git a/string.c b/string.c index e68dfcc20..0b32ddeb4 100644 --- a/string.c +++ b/string.c @@ -1079,10 +1079,10 @@ rb_str_index_m(argc, argv, str) { int c = FIX2INT(sub); long len = RSTRING(str)->len; - unsigned char *p = RSTRING(str)->ptr; + char *p = RSTRING(str)->ptr; for (;posptr + pos; - unsigned char *pbeg = RSTRING(str)->ptr; + char *p = RSTRING(str)->ptr + pos; + char *pbeg = RSTRING(str)->ptr; if (pos == RSTRING(str)->len) { if (pos == 0) return Qnil; --p; } while (pbeg <= p) { - if (*p == c) return LONG2NUM((char*)p - RSTRING(str)->ptr); + if ((unsigned char)*p == c) + return LONG2NUM((char*)p - RSTRING(str)->ptr); p--; } return Qnil; -- cgit