diff --git a/libtransmission/peer-mgr.c b/libtransmission/peer-mgr.c index a2b874828..c1147ecc4 100644 --- a/libtransmission/peer-mgr.c +++ b/libtransmission/peer-mgr.c @@ -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 ); diff --git a/libtransmission/torrent.c b/libtransmission/torrent.c index 48a2a4dff..336c0daf6 100644 --- a/libtransmission/torrent.c +++ b/libtransmission/torrent.c @@ -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, diff --git a/libtransmission/torrent.h b/libtransmission/torrent.h index c460b4cda..47231f6a4 100644 --- a/libtransmission/torrent.h +++ b/libtransmission/torrent.h @@ -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