ruby-changes:39167
From: nobu <ko1@a...>
Date: Wed, 15 Jul 2015 10:30:02 +0900 (JST)
Subject: [ruby-changes:39167] nobu:r51248 (trunk): string.c: remove redundant calls
nobu 2015-07-15 10:29:37 +0900 (Wed, 15 Jul 2015) New Revision: 51248 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=51248 Log: string.c: remove redundant calls * string.c (rb_str_enumerate_bytes, rb_str_enumerate_codepoints): do not check if a block is given twice. RETURN_SIZED_ENUMERATOR includes rb_block_given_p() check which is redundant here. Modified files: trunk/string.c Index: string.c =================================================================== --- string.c (revision 51247) +++ string.c (revision 51248) @@ -6878,7 +6878,7 @@ rb_str_enumerate_bytes(VALUE str, int wa https://github.com/ruby/ruby/blob/trunk/string.c#L6878 if (wantarray) ary = rb_ary_new2(RSTRING_LEN(str)); else - RETURN_SIZED_ENUMERATOR(str, 0, 0, rb_str_each_byte_size); + return SIZED_ENUMERATOR(str, 0, 0, rb_str_each_byte_size); } for (i=0; i<RSTRING_LEN(str); i++) { @@ -7071,7 +7071,7 @@ rb_str_enumerate_codepoints(VALUE str, i https://github.com/ruby/ruby/blob/trunk/string.c#L7071 if (wantarray) ary = rb_ary_new_capa(str_strlen(str, enc)); /* str's enc*/ else - RETURN_SIZED_ENUMERATOR(str, 0, 0, rb_str_each_char_size); + return SIZED_ENUMERATOR(str, 0, 0, rb_str_each_char_size); } while (ptr < end) { -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/