(trunk libt) when generating json/benc strings, preallocate some space in the evbuffer to avoid excess realloc()s
This commit is contained in:
parent
c35d4696ee
commit
7e28c375c9
|
@ -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 )
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue