From: Eric Wong Date: 2011-06-11T03:15:47+09:00 Subject: [ruby-core:36948] Re: rb_str_modify() now required before rb_str_resize()? SASADA Koichi wrote: > (2011/05/01 11:48), Eric Wong wrote: > > In 1.9.2 and earlier, rb_str_resize() always calls rb_str_modify() > > internally. Some C extensions I maintain relied on this behavior. > > > > In trunk, rb_str_resize() no longer calls rb_str_modify() nor unshares > > the string for copy-on-write if the string is already the desired size. > > > > I believe this is inconsistent since a C extension would normally expect > > to write to a string (and thus need to trigger copy-on-write) if it's > > calling rb_str_resize() on it. > > It seems that there are no discussion about this topic. Who change it? I think this is from r28827, so nobu. > In my opinion, I can't imagine that rb_str_resize() always call > rb_str_modify(). OK. I've modified all my C extensions to call rb_str_modify() already. MRI sources itself calls rb_str_modify() before rb_str_resize(), too. Maybe there are other C extensions affected? -- Eric Wong