]> granicus.if.org Git - transmission/commitdiff
(trunk libT) inline a few more torrent methods
authorCharles Kerr <charles@transmissionbt.com>
Sat, 3 Jan 2009 00:25:27 +0000 (00:25 +0000)
committerCharles Kerr <charles@transmissionbt.com>
Sat, 3 Jan 2009 00:25:27 +0000 (00:25 +0000)
libtransmission/peer-mgr.c
libtransmission/torrent.c
libtransmission/torrent.h

index a2b874828fcabf9b8704426e0b4003b11005f407..c1147ecc4b0746ff66dd06902a17baf9886c4f43 100644 (file)
@@ -164,31 +164,31 @@ struct tr_peerMgr
 ***
 **/
 
-static void
+static inline void
 managerLock( const struct tr_peerMgr * manager )
 {
     tr_globalLock( manager->session );
 }
 
-static void
+static inline void
 managerUnlock( const struct tr_peerMgr * manager )
 {
     tr_globalUnlock( manager->session );
 }
 
-static void
+static inline void
 torrentLock( Torrent * torrent )
 {
     managerLock( torrent->manager );
 }
 
-static void
+static inline void
 torrentUnlock( Torrent * torrent )
 {
     managerUnlock( torrent->manager );
 }
 
-static int
+static inline int
 torrentIsLocked( const Torrent * t )
 {
     return tr_globalIsLocked( t->manager->session );
index 48a2a4dffa6e3cffbbdb41102f58275304cbde4c..336c0daf6dae299b897c0abd1ee1f1d0da4f14f0 100644 (file)
@@ -660,21 +660,6 @@ tr_torrentChangeMyPort( tr_torrent * tor )
         tr_trackerChangeMyPort( tor->tracker );
 }
 
-tr_bool
-tr_torrentIsPrivate( const tr_torrent * tor )
-{
-    return tor
-        && tor->info.isPrivate;
-}
-
-tr_bool
-tr_torrentAllowsPex( const tr_torrent * tor )
-{
-    return tor
-        && tor->session->isPexEnabled
-        && !tr_torrentIsPrivate( tor );
-}
-
 static inline void
 tr_torrentManualUpdateImpl( void * vtor )
 {
@@ -1312,12 +1297,6 @@ tr_torrentRecheckCompleteness( tr_torrent * tor )
     tr_torrentUnlock( tor );
 }
 
-tr_bool
-tr_torrentIsSeed( const tr_torrent * tor )
-{
-    return tor->completeness != TR_LEECH;
-}
-
 /**
 ***  File priorities
 **/
@@ -1574,13 +1553,6 @@ tr_pieceOffset( const tr_torrent * tor,
 ****
 ***/
 
-tr_bool
-tr_torrentIsPieceChecked( const tr_torrent * tor,
-                          tr_piece_index_t   piece )
-{
-    return tr_bitfieldHas( &tor->checkedPieces, piece );
-}
-
 void
 tr_torrentSetPieceChecked( tr_torrent        * tor,
                            tr_piece_index_t    piece,
index c460b4cdab7f6528ff5fb6ecb5d1a87a1090f905..47231f6a43c3891506cf8f1d2e2ff54c147950fa 100644 (file)
@@ -56,8 +56,6 @@ void        tr_torrentInitFileDLs( tr_torrent *      tor,
                                    tr_file_index_t   fileCount,
                                    tr_bool           do_download );
 
-tr_bool     tr_torrentIsPrivate( const tr_torrent * );
-
 void        tr_torrentRecheckCompleteness( tr_torrent * );
 
 void        tr_torrentResetTransferStats( tr_torrent * );
@@ -66,8 +64,6 @@ void        tr_torrentSetHasPiece( tr_torrent *     tor,
                                    tr_piece_index_t pieceIndex,
                                    tr_bool          has );
 
-tr_bool     tr_torrentIsSeed( const tr_torrent * session );
-
 void        tr_torrentChangeMyPort( tr_torrent * session );
 
 tr_torrent* tr_torrentFindFromId( tr_session * session,
@@ -82,8 +78,6 @@ tr_torrent* tr_torrentFindFromHashString( tr_session * session,
 tr_torrent* tr_torrentFindFromObfuscatedHash( tr_session    * session,
                                               const uint8_t * hash );
 
-tr_bool     tr_torrentAllowsPex( const tr_torrent * );
-
 tr_bool     tr_torrentIsPieceTransferAllowed( const tr_torrent * torrent,
                                               tr_direction       direction );
 
@@ -110,9 +104,6 @@ void             tr_torrentInitFilePriority( tr_torrent       * tor,
 
 int              tr_torrentCountUncheckedPieces( const tr_torrent * );
 
-tr_bool          tr_torrentIsPieceChecked( const tr_torrent  * tor,
-                                           tr_piece_index_t    piece );
-
 tr_bool          tr_torrentIsFileChecked( const tr_torrent  * tor,
                                           tr_file_index_t     file );
 
@@ -254,14 +245,12 @@ tr_torBlockCountBytes( const tr_torrent * tor, const tr_block_index_t block )
                                         : tor->blockSize;
 }
 
-static inline void
-tr_torrentLock( const tr_torrent * tor )
+static inline void tr_torrentLock( const tr_torrent * tor )
 {
     tr_globalLock( tor->session );
 }
 
-static inline void
-tr_torrentUnlock( const tr_torrent * tor )
+static inline void tr_torrentUnlock( const tr_torrent * tor )
 {
     tr_globalUnlock( tor->session );
 }
@@ -272,5 +261,25 @@ tr_torrentExists( const tr_session * session, const uint8_t *   torrentHash )
     return tr_torrentFindFromHash( (tr_session*)session, torrentHash ) != NULL;
 }
 
+static inline tr_bool
+tr_torrentIsSeed( const tr_torrent * tor )
+{
+    return tor->completeness != TR_LEECH;
+}
+
+static inline tr_bool tr_torrentIsPrivate( const tr_torrent * tor )
+{
+    return ( tor != NULL ) && tor->info.isPrivate;
+}
+
+static inline tr_bool tr_torrentAllowsPex( const tr_torrent * tor )
+{
+    return ( tor != NULL  ) && tor->session->isPexEnabled && !tr_torrentIsPrivate( tor );
+}
+
+static inline tr_bool tr_torrentIsPieceChecked( const tr_torrent  * tor, tr_piece_index_t i )
+{
+    return tr_bitfieldHas( &tor->checkedPieces, i );
+}
 
 #endif