mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* string.c (rb_str_each_char_size): performance implement by
using rb_str_length(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42110 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
265de6677c
commit
f775a27bd3
2 changed files with 6 additions and 10 deletions
|
@ -1,3 +1,8 @@
|
|||
Mon Jul 22 17:24:14 2013 Masaki Matsushita <glass.saga@gmail.com>
|
||||
|
||||
* string.c (rb_str_each_char_size): performance implement by
|
||||
using rb_str_length().
|
||||
|
||||
Mon Jul 22 16:32:48 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* vm_eval.c (eval_string_with_cref): check by Check_TypedStruct
|
||||
|
|
11
string.c
11
string.c
|
@ -6501,16 +6501,7 @@ rb_str_bytes(VALUE str)
|
|||
static VALUE
|
||||
rb_str_each_char_size(VALUE str, VALUE args, VALUE eobj)
|
||||
{
|
||||
long len = RSTRING_LEN(str);
|
||||
if (!single_byte_optimizable(str)) {
|
||||
const char *ptr = RSTRING_PTR(str);
|
||||
rb_encoding *enc = rb_enc_get(str);
|
||||
const char *end_ptr = ptr + len;
|
||||
for (len = 0; ptr < end_ptr; ++len) {
|
||||
ptr += rb_enc_mbclen(ptr, end_ptr, enc);
|
||||
}
|
||||
}
|
||||
return LONG2FIX(len);
|
||||
return rb_str_length(str);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
|
|
Loading…
Add table
Reference in a new issue