From 65a0050268aadcfb4edd936ec3bac21e6944e95e Mon Sep 17 00:00:00 2001 From: matz Date: Sun, 23 Dec 2007 18:58:09 +0000 Subject: [PATCH] * string.c (str_new_shared): was setting embedding flag of wrong string object. [ruby-dev:32685] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14548 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 3 +++ string.c | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index ed832fe647..d69bbff03e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -11,6 +11,9 @@ Mon Dec 24 02:59:32 2007 Yukihiro Matsumoto * io.c (prepare_getline_args): convert RS to external encoding. + * string.c (str_new_shared): was setting embedding flag of wrong + string object. [ruby-dev:32685] + Mon Dec 24 02:06:35 2007 Yukihiro Matsumoto * io.c (rb_f_open): documentation update. diff --git a/string.c b/string.c index 728790f6fd..271960d730 100644 --- a/string.c +++ b/string.c @@ -245,7 +245,7 @@ str_new_shared(VALUE klass, VALUE str) VALUE str2 = str_alloc(klass); if (RSTRING_LEN(str) <= RSTRING_EMBED_LEN_MAX) { - STR_SET_EMBED(str); + STR_SET_EMBED(str2); memcpy(RSTRING_PTR(str2), RSTRING_PTR(str), RSTRING_LEN(str)+1); STR_SET_EMBED_LEN(str2, RSTRING_LEN(str)); }