From b4893fc3d159204f567da5337494e224d65f6fbf Mon Sep 17 00:00:00 2001 From: nagachika Date: Fri, 22 Aug 2014 17:37:57 +0000 Subject: merge revision(s) r46896,r46897,r46898: [Backport #10078] * string.c (rb_str_count): fix wrong single-byte optimization. 7bit ascii can be a trailing byte in Shift_JIS. [ruby-dev:48442] [Bug #10078] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@47255 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 6 ++++++ string.c | 29 ++++++++++++++++++++--------- test/ruby/test_m17n.rb | 5 +++++ test/ruby/test_m17n_comb.rb | 12 +++++++++--- version.h | 6 +++--- 5 files changed, 43 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index edc1bae315..fb5f4a769d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Sat Aug 23 02:22:02 2014 Nobuyoshi Nakada + + * string.c (rb_str_count): fix wrong single-byte optimization. + 7bit ascii can be a trailing byte in Shift_JIS. + [ruby-dev:48442] [Bug #10078] + Thu Aug 21 01:44:46 2014 Tanaka Akira * gc.c (mark_current_machine_context): Call SET_STACK_END. diff --git a/string.c b/string.c index 36f6888778..e6f72bc5e7 100644 --- a/string.c +++ b/string.c @@ -6059,21 +6059,25 @@ rb_str_count(int argc, VALUE *argv, VALUE str) { char table[TR_TABLE_SIZE]; rb_encoding *enc = 0; - VALUE del = 0, nodel = 0; + VALUE del = 0, nodel = 0, tstr; char *s, *send; int i; int ascompat; rb_check_arity(argc, 1, UNLIMITED_ARGUMENTS); - for (i=0; i