mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* string.c (str_new4): should share shared instance if it already
exists. [ruby-dev:23665] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6429 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
dfb79bf51e
commit
4b33ed994b
2 changed files with 7 additions and 3 deletions
|
@ -1,3 +1,8 @@
|
|||
Wed Jun 2 20:16:03 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* string.c (str_new4): should share shared instance if it already
|
||||
exists. [ruby-dev:23665]
|
||||
|
||||
Wed Jun 2 12:41:53 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* io.c (rb_io_gets_m): set lastline ($_) even when read line is
|
||||
|
|
5
string.c
5
string.c
|
@ -143,9 +143,9 @@ str_new4(klass, str)
|
|||
|
||||
RSTRING(str2)->len = RSTRING(str)->len;
|
||||
RSTRING(str2)->ptr = RSTRING(str)->ptr;
|
||||
if (FL_TEST(str, ELTS_SHARED) && !RSTRING(str)->aux.shared) {
|
||||
/* ptr should be null_str */
|
||||
if (FL_TEST(str, ELTS_SHARED)) {
|
||||
FL_SET(str2, ELTS_SHARED);
|
||||
RSTRING(str2)->aux.shared = RSTRING(str)->aux.shared;
|
||||
}
|
||||
else {
|
||||
FL_SET(str, ELTS_SHARED);
|
||||
|
@ -165,7 +165,6 @@ rb_str_new4(orig)
|
|||
klass = rb_obj_class(orig);
|
||||
if (FL_TEST(orig, ELTS_SHARED) && (str = RSTRING(orig)->aux.shared) && klass == RBASIC(str)->klass) {
|
||||
long ofs;
|
||||
str = RSTRING(orig)->aux.shared;
|
||||
ofs = RSTRING(str)->len - RSTRING(orig)->len;
|
||||
if (ofs > 0) {
|
||||
str = str_new3(klass, str);
|
||||
|
|
Loading…
Reference in a new issue