From 98b2401077925daee44f4b7311f114c01c5f25ea Mon Sep 17 00:00:00 2001 From: nobu Date: Tue, 22 Jul 2014 05:22:32 +0000 Subject: [PATCH] string.c: simplify * string.c (rb_str_count): move code for the first argument outside loop for the rest, as it is executed only once. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46898 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- string.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/string.c b/string.c index f0ce9b1109..9f06837789 100644 --- a/string.c +++ b/string.c @@ -6067,19 +6067,19 @@ 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