]> granicus.if.org Git - transmission/commitdiff
(trunk libT) minor cleanup: improve the function names peerConstructor() and peerDest...
authorJordan Lee <jordan@transmissionbt.com>
Wed, 23 Feb 2011 06:14:06 +0000 (06:14 +0000)
committerJordan Lee <jordan@transmissionbt.com>
Wed, 23 Feb 2011 06:14:06 +0000 (06:14 +0000)
These functions actually allocate/free the memory where these peer objects reside, so it's clearer to name them peerNew() and peerDelete().

libtransmission/peer-mgr.c

index d770ac9f83c59b242452a5a704978bf93ef8a8c3..18a91691cb449d8d755d569a0e96a0a8331bd98d 100644 (file)
@@ -379,7 +379,7 @@ peerIsInUse( const Torrent * ct, const struct peer_atom * atom )
 }
 
 static tr_peer*
-peerConstructor( struct peer_atom * atom )
+peerNew( struct peer_atom * atom )
 {
     tr_peer * peer = tr_new0( tr_peer, 1 );
 
@@ -407,7 +407,7 @@ getPeer( Torrent * torrent, struct peer_atom * atom )
 
     if( peer == NULL )
     {
-        peer = peerConstructor( atom );
+        peer = peerNew( atom );
         tr_ptrArrayInsertSorted( &torrent->peers, peer, peerCompare );
     }
 
@@ -417,7 +417,7 @@ getPeer( Torrent * torrent, struct peer_atom * atom )
 static void peerDeclinedAllRequests( Torrent *, const tr_peer * );
 
 static void
-peerDestructor( Torrent * t, tr_peer * peer )
+peerDelete( Torrent * t, tr_peer * peer )
 {
     assert( peer != NULL );
 
@@ -2019,7 +2019,7 @@ myHandshakeDoneCB( tr_handshake  * handshake,
                 }
 
                 peer->io = tr_handshakeStealIO( handshake ); /* this steals its refcount too, which is
-                                                                balanced by our unref in peerDestructor()  */
+                                                                balanced by our unref in peerDelete()  */
                 tr_peerIoSetParent( peer->io, t->tor->bandwidth );
                 tr_peerMsgsNew( t->tor, peer, peerCallbackFunc, t );
 
@@ -2405,7 +2405,7 @@ stopTorrent( Torrent * t )
 
     /* disconnect the peers. */
     for( i=0, n=tr_ptrArraySize( &t->peers ); i<n; ++i )
-        peerDestructor( t, tr_ptrArrayNth( &t->peers, i ) );
+        peerDelete( t, tr_ptrArrayNth( &t->peers, i ) );
     tr_ptrArrayClear( &t->peers );
 
     /* disconnect the handshakes. handshakeAbort calls handshakeDoneCB(),
@@ -3206,7 +3206,7 @@ removePeer( Torrent * t, tr_peer * peer )
         tr_decrReplicationFromBitset( t, &peer->have );
 
     assert( removed == peer );
-    peerDestructor( t, removed );
+    peerDelete( t, removed );
 }
 
 static void