From 77a23fba355e5303da1182255bef800ee6acc468 Mon Sep 17 00:00:00 2001 From: matz Date: Fri, 19 Nov 2004 16:59:11 +0000 Subject: * string.c (str_gsub): internal buffer should not be listed by ObjectSpace.each_object() by String#gsub. [ruby-dev:24931] * lib/cgi/session.rb (CGI::Session::FileStore::initialize): raise exception if data corresponding to session specified from the client does not exist. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7326 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- string.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'string.c') diff --git a/string.c b/string.c index efa817ea43..454959abc0 100644 --- a/string.c +++ b/string.c @@ -2075,10 +2075,7 @@ str_gsub(argc, argv, str, bang) } blen = RSTRING(str)->len + 30; /* len + margin */ - dest = rb_str_new5(str, 0, blen); - if (bang) { - RBASIC(dest)->klass = 0; - } + dest = str_new(0, 0, blen); buf = RSTRING(dest)->ptr; bp = buf; sp = cp = RSTRING(str)->ptr; @@ -2158,6 +2155,7 @@ str_gsub(argc, argv, str, bang) RSTRING(dest)->len = 0; } else { + RBASIC(dest)->klass = rb_obj_class(str); OBJ_INFECT(dest, str); str = dest; } -- cgit v1.2.3