Changeset 12014


Ignore:
Timestamp:
Feb 23, 2011, 6:14:06 AM (11 years ago)
Author:
jordan
Message:

(trunk libT) minor cleanup: improve the function names peerConstructor() and peerDestructor().

These functions actually allocate/free the memory where these peer objects reside, so it's clearer to name them peerNew() and peerDelete().

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/peer-mgr.c

    r12013 r12014  
    380380
    381381static tr_peer*
    382 peerConstructor( struct peer_atom * atom )
     382peerNew( struct peer_atom * atom )
    383383{
    384384    tr_peer * peer = tr_new0( tr_peer, 1 );
     
    408408    if( peer == NULL )
    409409    {
    410         peer = peerConstructor( atom );
     410        peer = peerNew( atom );
    411411        tr_ptrArrayInsertSorted( &torrent->peers, peer, peerCompare );
    412412    }
     
    418418
    419419static void
    420 peerDestructor( Torrent * t, tr_peer * peer )
     420peerDelete( Torrent * t, tr_peer * peer )
    421421{
    422422    assert( peer != NULL );
     
    20202020
    20212021                peer->io = tr_handshakeStealIO( handshake ); /* this steals its refcount too, which is
    2022                                                                 balanced by our unref in peerDestructor()  */
     2022                                                                balanced by our unref in peerDelete()  */
    20232023                tr_peerIoSetParent( peer->io, t->tor->bandwidth );
    20242024                tr_peerMsgsNew( t->tor, peer, peerCallbackFunc, t );
     
    24062406    /* disconnect the peers. */
    24072407    for( i=0, n=tr_ptrArraySize( &t->peers ); i<n; ++i )
    2408         peerDestructor( t, tr_ptrArrayNth( &t->peers, i ) );
     2408        peerDelete( t, tr_ptrArrayNth( &t->peers, i ) );
    24092409    tr_ptrArrayClear( &t->peers );
    24102410
     
    32073207
    32083208    assert( removed == peer );
    3209     peerDestructor( t, removed );
     3209    peerDelete( t, removed );
    32103210}
    32113211
Note: See TracChangeset for help on using the changeset viewer.