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. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51248 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
bb8abf62d3
commit
4592e15e35
4
string.c
4
string.c
@ -6878,7 +6878,7 @@ rb_str_enumerate_bytes(VALUE str, int wantarray)
|
||||
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, int wantarray)
|
||||
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) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user