mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* string.c (rb_str_subseq): don't use rb_str_drop_bytes for short
string. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19628 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
0001260aaf
commit
eace50a9d7
2 changed files with 8 additions and 2 deletions
|
@ -1,3 +1,8 @@
|
|||
Mon Sep 29 23:32:25 2008 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* string.c (rb_str_subseq): don't use rb_str_drop_bytes for short
|
||||
string.
|
||||
|
||||
Mon Sep 29 22:54:29 2008 Tadayoshi Funaba <tadf@dotrb.org>
|
||||
|
||||
* lib/mathn.rb: added String#to_[rc]. moved def_canon.
|
||||
|
|
5
string.c
5
string.c
|
@ -1285,8 +1285,9 @@ rb_str_subseq(VALUE str, long beg, long len)
|
|||
{
|
||||
VALUE str2;
|
||||
|
||||
if (RSTRING_LEN(str) == beg + len) {
|
||||
str2 = rb_str_new_shared(str);
|
||||
if (RSTRING_LEN(str) == beg + len &&
|
||||
RSTRING_EMBED_LEN_MAX < len) {
|
||||
str2 = rb_str_new_shared(rb_str_new_frozen(str));
|
||||
rb_str_drop_bytes(str2, beg);
|
||||
}
|
||||
else {
|
||||
|
|
Loading…
Reference in a new issue