ruby-changes:34330
From: nobu <ko1@a...>
Date: Thu, 12 Jun 2014 13:28:22 +0900 (JST)
Subject: [ruby-changes:34330] nobu:r46411 (trunk): string.c: shrink before freezing
nobu 2014-06-12 13:28:16 +0900 (Thu, 12 Jun 2014) New Revision: 46411 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=46411 Log: string.c: shrink before freezing * string.c (rb_str_freeze): shrink the buffer before freezing, as pointed out by Eric Wong at [ruby-core:63119]. Modified files: trunk/ChangeLog trunk/string.c Index: ChangeLog =================================================================== --- ChangeLog (revision 46410) +++ ChangeLog (revision 46411) @@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Thu Jun 12 13:27:38 2014 Nobuyoshi Nakada <nobu@r...> + + * string.c (rb_str_freeze): shrink the buffer before freezing, as + pointed out by Eric Wong at [ruby-core:63119]. + Thu Jun 12 13:09:03 2014 Nobuyoshi Nakada <nobu@r...> * file.c (expand_path): shrink expanded path which no longer needs Index: string.c =================================================================== --- string.c (revision 46410) +++ string.c (revision 46411) @@ -1905,6 +1905,8 @@ rb_str_substr(VALUE str, long beg, long https://github.com/ruby/ruby/blob/trunk/string.c#L1905 VALUE rb_str_freeze(VALUE str) { + if (OBJ_FROZEN(str)) return str; + rb_str_resize(str, RSTRING_LEN(str)); return rb_obj_freeze(str); } -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/