(trunk libt) when generating json/benc strings, preallocate some space in the evbuffer to avoid excess realloc()s

This commit is contained in:
Charles Kerr 2010-02-11 00:53:50 +00:00
parent c35d4696ee
commit 7e28c375c9
1 changed files with 1 additions and 0 deletions

View File

@ -1580,6 +1580,7 @@ void
tr_bencToBuf( const tr_benc * top, tr_fmt_mode mode, struct evbuffer * buf )
{
evbuffer_drain( buf, EVBUFFER_LENGTH( buf ) );
evbuffer_expand( buf, 4096 ); /* alloc a little memory to start off with */
switch( mode )
{