aboutsummaryrefslogtreecommitdiffstats
path: root/re.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-08-26 01:52:04 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-08-26 01:52:04 +0000
commitfa2334f9f1635bdd7d1c308e3c6b7970b166bc88 (patch)
tree7f666b1d36a8ee565687b97a169f7fdc8cb468cd /re.c
parentb8870bc0451b55561d92af43f17761b086a64709 (diff)
downloadruby-fa2334f9f1635bdd7d1c308e3c6b7970b166bc88.tar.gz
re.c: fix wchar match at EOS
* 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/trunk@51685 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 7b52a6da03..efcc9dbdda 100644
--- a/re.c
+++ b/re.c
@@ -227,7 +227,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;
}
@@ -240,7 +240,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;
}