Changeset 13359


Ignore:
Timestamp:
Jul 1, 2012, 1:42:58 AM (9 years ago)
Author:
jordan
Message:

Fix the size for the peers and peersFrom dictionaries.

By setting the initial allocation size correctly, we can avoid unnecessary resizing when adding all the dictionary's fields.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/rpcimpl.c

    r12990 r13359  
    524524    for( i = 0; i < peerCount; ++i )
    525525    {
    526         tr_benc *            d = tr_bencListAddDict( list, 14 );
     526        tr_benc *            d = tr_bencListAddDict( list, 16 );
    527527        const tr_peer_stat * peer = peers + i;
    528528        tr_bencDictAddStr ( d, "address", peer->addr );
     
    638638    else if( tr_streq( key, keylen, "peersFrom" ) )
    639639    {
    640         tr_benc *   tmp = tr_bencDictAddDict( d, key, 6 );
     640        tr_benc *   tmp = tr_bencDictAddDict( d, key, 7 );
    641641        const int * f = st->peersFrom;
    642642        tr_bencDictAddInt( tmp, "fromCache",    f[TR_PEER_FROM_RESUME] );
Note: See TracChangeset for help on using the changeset viewer.