Re: [Patch] String and (repost) MemLeak
From:
Michal Rokos <michal@...>
Date:
2003-03-04 20:39:55 UTC
List:
ruby-core #915
Hi, Mathieu Bouchard wrote: > the point of str_new(0,n) is to be able to create a string of a known > length but for which the contents are not "known" in advance, or at least, > not in a buffer. Once you fill the n chars of the string object you just > allocated, then the creation process is finished and you don't have to set > the len again! A len is not a capa and a capa is not a len. Actually I think you (and Matz) are right. Setting len to 0 could cause more problems and as matz said - it could confuse programmers. So: I'm sorry guys. The truth is on your side. Michal PS: Maybe checking whether ptr is not NULL in rb_str_buf_cat wasn't such a bad point (unlike the rest thing about setting len)...