summaryrefslogtreecommitdiff
path: root/regex.c
diff options
context:
space:
mode:
authorshyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-06-08 09:33:00 +0000
committershyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-06-08 09:33:00 +0000
commit6a80859a161de8606d2eca289807c05d8f57dee1 (patch)
tree5e6c2a49bbdc5cc54f00aa2776dbad97d705f9be /regex.c
parent3de31e69edf7f509e4907842435add124893ecfc (diff)
merge revision(s) 28192:
* regexp.c (re_compile_pattern): allow zero times match for non-greedy range repeatation. [ruby-core:30613] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_7@28224 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'regex.c')
-rw-r--r--regex.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/regex.c b/regex.c
index f8c2c20c6d..f3749fb12f 100644
--- a/regex.c
+++ b/regex.c
@@ -2152,6 +2152,12 @@ re_compile_pattern(pattern, size, bufp)
more at the end of the loop. */
unsigned nbytes = upper_bound == 1 ? 10 : 20;
+ if (lower_bound == 0 && greedy == 0) {
+ GET_BUFFER_SPACE(3);
+ insert_jump(try_next, laststart, b + 3, b);
+ b += 3;
+ }
+
GET_BUFFER_SPACE(nbytes);
/* Initialize lower bound of the `succeed_n', even
though it will be set during matching by its