[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Membuf "optimization" in r1532186

From: Branko Čibej <brane_at_wandisco.com>
Date: Mon, 09 Dec 2013 11:19:15 +0100

On 09.12.2013 11:01, Branko Čibej wrote:
> Hi Stefan,
>
> could you please shed some light on your "minor opimization" commit:
>
>> ------------------------------------------------------------------------
>> r1532186 | stefan2 | 2013-10-15 06:59:00 +0200 (Tue, 15 Oct 2013) | 5
>> lines Minor optimization in svn_membuf code. *
>> subversion/libsvn_subr/string.c (membuf_create): always allocate, even
>> 0 bytes (svn_membuf__resize): new allocated membuf->data can never be
>> NULL Index: subversion/libsvn_subr/string.c
>> ===================================================================
>> --- subversion/libsvn_subr/string.c (revision 1532185) +++
>> subversion/libsvn_subr/string.c (revision 1532186) @@ -53,9 +53,9 @@
>> /* apr_palloc will allocate multiples of 8. * Thus, we would waste
>> some of that memory if we stuck to the * smaller size. Note that this
>> is safe even if apr_palloc would - * use some other aligment or none
>> at all. */ + * use some other alignment or none at all. */
>> minimum_size = APR_ALIGN_DEFAULT(minimum_size); - *data =
>> (!minimum_size ? NULL : apr_palloc(pool, minimum_size)); + *data =
>> apr_palloc(pool, minimum_size); *size = minimum_size; } @@ -121,7
>> +121,10 @@ const apr_size_t old_size = membuf->size;
>> membuf_ensure(&membuf->data, &membuf->size, size, membuf->pool); - if
>> (membuf->data && old_data && old_data != membuf->data) + + /* If we
>> re-allocated MEMBUF->DATA, it cannot be NULL. + * Statically
>> initialized membuffers (OLD_DATA) may be NULL, though. */ + if
>> (old_data && old_data != membuf->data) memcpy(membuf->data, old_data,
>> old_size); }

Sorry about the messed-up diff; it's

    svn log --diff -c1532186

-- Brane

-- 
Branko Čibej | Director of Subversion
WANdisco // Non-Stop Data
e. brane_at_wandisco.com
Received on 2013-12-09 11:20:01 CET

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.