summaryrefslogtreecommitdiff
path: root/re.c
diff options
context:
space:
mode:
authorshyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-06-15 13:32:07 +0000
committershyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-06-15 13:32:07 +0000
commit9484ce5f5a49a37deb339ab6699b1800defab550 (patch)
tree49346dd04d66894d35d57c4561daff89e21705eb /re.c
parenta7e925dd7db2f2293698fe1f71db6d669fda3569 (diff)
merge revision(s) 16239:
* re.c (rb_reg_search): use local variable. a patch from wanabe <s.wanabe AT gmail.com> in [ruby-dev:34537]. [ruby-dev:34492] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_6@17266 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 're.c')
-rw-r--r--re.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/re.c b/re.c
index 0a9f8f7c8e..6cada9a714 100644
--- a/re.c
+++ b/re.c
@@ -78,7 +78,7 @@ rb_memcicmp(x, y, len)
int tmp;
while (len--) {
- if (tmp = casetable[(unsigned)*p1++] - casetable[(unsigned)*p2++])
+ if ((tmp = casetable[(unsigned)*p1++] - casetable[(unsigned)*p2++]) != 0)
return tmp;
}
return 0;
@@ -892,7 +892,7 @@ rb_reg_search(re, str, pos, reverse)
{
long result;
VALUE match;
- static struct re_registers regs;
+ struct re_registers regs;
long range;
if (pos > RSTRING(str)->len || pos < 0) {
@@ -914,6 +914,7 @@ rb_reg_search(re, str, pos, reverse)
else {
range = RSTRING(str)->len - pos;
}
+ MEMZERO(&regs, struct re_registers, 1);
result = re_search(RREGEXP(re)->ptr,RSTRING(str)->ptr,RSTRING(str)->len,
pos, range, &regs);