ruby-changes:2689
From: ko1@a...
Date: 10 Dec 2007 19:17:05 +0900
Subject: [ruby-changes:2689] matz - Ruby:r14180 (trunk): * re.c (rb_reg_match): should calculate offset by converted
matz 2007-12-10 19:03:48 +0900 (Mon, 10 Dec 2007)
New Revision: 14180
Modified files:
trunk/ChangeLog
trunk/re.c
Log:
* re.c (rb_reg_match): should calculate offset by converted
operand. [ruby-cvs:21416]
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=14180&r2=14179
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/re.c?r1=14180&r2=14179
Index: re.c
===================================================================
--- re.c (revision 14179)
+++ re.c (revision 14180)
@@ -2124,13 +2124,15 @@
}
static long
-rb_reg_match_pos(VALUE re, VALUE str, long pos)
+reg_match_pos(VALUE re, VALUE *strp, long pos)
{
+ VALUE str = *strp;
+
if (NIL_P(str)) {
rb_backref_set(Qnil);
return -1;
}
- str = reg_operand(str, Qtrue);
+ *strp = str = reg_operand(str, Qtrue);
if (pos != 0) {
if (pos < 0) {
pos += RSTRING_LEN(str);
@@ -2156,7 +2158,7 @@
VALUE
rb_reg_match(VALUE re, VALUE str)
{
- long pos = rb_reg_match_pos(re, str, 0);
+ long pos = reg_match_pos(re, &str, 0);
if (pos < 0) return Qnil;
pos = rb_str_sublen(str, pos);
return LONG2FIX(pos);
@@ -2270,7 +2272,7 @@
pos = 0;
}
- pos = rb_reg_match_pos(re, str, pos);
+ pos = reg_match_pos(re, &str, pos);
if (pos < 0) {
rb_backref_set(Qnil);
return Qnil;
Index: ChangeLog
===================================================================
--- ChangeLog (revision 14179)
+++ ChangeLog (revision 14180)
@@ -1,3 +1,8 @@
+Mon Dec 10 19:02:52 2007 Yukihiro Matsumoto <matz@r...>
+
+ * re.c (rb_reg_match): should calculate offset by converted
+ operand. [ruby-cvs:21416]
+
Mon Dec 10 18:28:06 2007 Yukihiro Matsumoto <matz@r...>
* lib/uri/common.rb (URI::REGEXP::PATTERN): typo in REG_NAME
--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml