summaryrefslogtreecommitdiff
path: root/re.c
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-09-29 08:30:33 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-09-29 08:30:33 +0000
commitd69ae6f985c5d94652fefc379b04bf352ee6200f (patch)
treefa189e29041cc268bc23a643f9f1eb49946c47e6 /re.c
parent431b9dbd009f47458cd502784fad01983e656ce0 (diff)
merge revision(s) 51685: [Backport #11488]
* re.c (rb_memsearch_wchar, rb_memsearch_qchar): test matching till the end of string. [ruby-core:70592] [Bug #11488] * test/ruby/test_m17n.rb (test_include?, tet_index): add tests by Tom Stuart. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@51976 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 're.c')
-rw-r--r--re.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/re.c b/re.c
index ceb72b9377..c78d57858a 100644
--- a/re.c
+++ b/re.c
@@ -229,7 +229,7 @@ rb_memsearch_wchar(const unsigned char *xs, long m, const unsigned char *ys, lon
const unsigned char *x = xs, x0 = *xs, *y = ys;
enum {char_size = 2};
- for (n -= m; n > 0; n -= char_size, y += char_size) {
+ for (n -= m; n >= 0; n -= char_size, y += char_size) {
if (x0 == *y && memcmp(x+1, y+1, m-1) == 0)
return y - ys;
}
@@ -242,7 +242,7 @@ rb_memsearch_qchar(const unsigned char *xs, long m, const unsigned char *ys, lon
const unsigned char *x = xs, x0 = *xs, *y = ys;
enum {char_size = 4};
- for (n -= m; n > 0; n -= char_size, y += char_size) {
+ for (n -= m; n >= 0; n -= char_size, y += char_size) {
if (x0 == *y && memcmp(x+1, y+1, m-1) == 0)
return y - ys;
}