How is it inconsistent?
The callers "should" have passed at least 1, but the simple fact is
that they DID NOT. Thus, we had failures. It is much simpler and safer
to handle that situation, than to audit all callers (which might even
be in third-party code!).
Cheers,
-g
On Thu, Feb 19, 2009 at 13:40, Chris Foote <cafoote_at_yahoo.com> wrote:
> Hi Bert,
>
> Now this API is inconsistent with svn_stringbuf_ensure.
>
> IMHO, the callers of svn_stringbuf_create_ensure need to always pass at least 1 for the minimum_size.
>
> Regards,
> Chris
>
>> Author: rhuijben
>> Date: Thu Feb 19 03:41:36 2009
>> New Revision: 35974
>>
>> Log:
>> Following up on r35968, fix the exact svn_stringbuf_create block size
>> behavior tested by lt-string-test 10: block initialization and growth.
>>
>> * subversion/include/svn_string.h
>> (svn_stringbuf_create_ensure): Update comment to document the +1 behavior.
>> * subversion/libsvn_subr/svn_string.c
>> (svn_stringbuf_ncreate): Stop incrementing the buffer size as
>> svn_stringbuf_create_ensure does this for us.
>>
>> Modified:
>> trunk/subversion/include/svn_string.h
>> trunk/subversion/libsvn_subr/svn_string.c
>>
>> Modified: trunk/subversion/include/svn_string.h
>> URL: http://svn.collab.net/viewvc/svn/trunk/subversion/include/svn_string.h?pathrev=35974&r1=35973&r2=35974
>> ==============================================================================
>> --- trunk/subversion/include/svn_string.h Thu Feb 19 02:17:08 2009 (r35973)
>> +++ trunk/subversion/include/svn_string.h Thu Feb 19 03:41:36 2009 (r35974)
>> @@ -192,7 +192,8 @@ svn_stringbuf_ncreate(const char *bytes,
>> /** Create a new empty bytestring with at least @a minimum_size bytes of
>> * space available in the memory block.
>> *
>> - * (@a minimum_size should include space for the terminating NULL character.)
>> + * The allocated string buffer will be one byte larger then @a size to account
>> + * for a final '\0'.
>> *
>> * @since New in 1.6.
>> */
>>
>
> ------------------------------------------------------
> http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=1191678
>
------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=1191787
Received on 2009-02-19 14:10:38 CET