1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* string.c (rb_str_enumerate_chars): specify array capa.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42112 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
glass 2013-07-22 09:03:44 +00:00
parent efacdb43dc
commit fa20fb3728
2 changed files with 6 additions and 2 deletions

View file

@ -1,3 +1,7 @@
Mon Jul 22 18:01:33 2013 Masaki Matsushita <glass.saga@gmail.com>
* string.c (rb_str_enumerate_chars): specify array capa.
Mon Jul 22 17:24:14 2013 Masaki Matsushita <glass.saga@gmail.com>
* string.c (rb_str_each_char_size): performance improvement by

View file

@ -6518,7 +6518,7 @@ rb_str_enumerate_chars(VALUE str, int wantarray)
if (wantarray) {
#if STRING_ENUMERATORS_WANTARRAY
rb_warn("given block not used");
ary = rb_ary_new();
ary = rb_ary_new_capa(rb_str_strlen(str));
#else
rb_warning("passing a block to String#chars is deprecated");
wantarray = 0;
@ -6527,7 +6527,7 @@ rb_str_enumerate_chars(VALUE str, int wantarray)
}
else {
if (wantarray)
ary = rb_ary_new();
ary = rb_ary_new_capa(rb_str_strlen(str));
else
RETURN_SIZED_ENUMERATOR(str, 0, 0, rb_str_each_char_size);
}