Changeset 7591


Ignore:
Timestamp:
Jan 3, 2009, 12:25:27 AM (12 years ago)
Author:
charles
Message:

(trunk libT) inline a few more torrent methods

Location:
trunk/libtransmission
Files:
3 edited

Legend:

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

    r7586 r7591  
    165165**/
    166166
    167 static void
     167static inline void
    168168managerLock( const struct tr_peerMgr * manager )
    169169{
     
    171171}
    172172
    173 static void
     173static inline void
    174174managerUnlock( const struct tr_peerMgr * manager )
    175175{
     
    177177}
    178178
    179 static void
     179static inline void
    180180torrentLock( Torrent * torrent )
    181181{
     
    183183}
    184184
    185 static void
     185static inline void
    186186torrentUnlock( Torrent * torrent )
    187187{
     
    189189}
    190190
    191 static int
     191static inline int
    192192torrentIsLocked( const Torrent * t )
    193193{
  • trunk/libtransmission/torrent.c

    r7584 r7591  
    661661}
    662662
    663 tr_bool
    664 tr_torrentIsPrivate( const tr_torrent * tor )
    665 {
    666     return tor
    667         && tor->info.isPrivate;
    668 }
    669 
    670 tr_bool
    671 tr_torrentAllowsPex( const tr_torrent * tor )
    672 {
    673     return tor
    674         && tor->session->isPexEnabled
    675         && !tr_torrentIsPrivate( tor );
    676 }
    677 
    678663static inline void
    679664tr_torrentManualUpdateImpl( void * vtor )
     
    13131298}
    13141299
    1315 tr_bool
    1316 tr_torrentIsSeed( const tr_torrent * tor )
    1317 {
    1318     return tor->completeness != TR_LEECH;
    1319 }
    1320 
    13211300/**
    13221301***  File priorities
     
    15741553****
    15751554***/
    1576 
    1577 tr_bool
    1578 tr_torrentIsPieceChecked( const tr_torrent * tor,
    1579                           tr_piece_index_t   piece )
    1580 {
    1581     return tr_bitfieldHas( &tor->checkedPieces, piece );
    1582 }
    15831555
    15841556void
  • trunk/libtransmission/torrent.h

    r7584 r7591  
    5757                                   tr_bool           do_download );
    5858
    59 tr_bool     tr_torrentIsPrivate( const tr_torrent * );
    60 
    6159void        tr_torrentRecheckCompleteness( tr_torrent * );
    6260
     
    6765                                   tr_bool          has );
    6866
    69 tr_bool     tr_torrentIsSeed( const tr_torrent * session );
    70 
    7167void        tr_torrentChangeMyPort( tr_torrent * session );
    7268
     
    8278tr_torrent* tr_torrentFindFromObfuscatedHash( tr_session    * session,
    8379                                              const uint8_t * hash );
    84 
    85 tr_bool     tr_torrentAllowsPex( const tr_torrent * );
    8680
    8781tr_bool     tr_torrentIsPieceTransferAllowed( const tr_torrent * torrent,
     
    110104
    111105int              tr_torrentCountUncheckedPieces( const tr_torrent * );
    112 
    113 tr_bool          tr_torrentIsPieceChecked( const tr_torrent  * tor,
    114                                            tr_piece_index_t    piece );
    115106
    116107tr_bool          tr_torrentIsFileChecked( const tr_torrent  * tor,
     
    255246}
    256247
    257 static inline void
    258 tr_torrentLock( const tr_torrent * tor )
     248static inline void tr_torrentLock( const tr_torrent * tor )
    259249{
    260250    tr_globalLock( tor->session );
    261251}
    262252
    263 static inline void
    264 tr_torrentUnlock( const tr_torrent * tor )
     253static inline void tr_torrentUnlock( const tr_torrent * tor )
    265254{
    266255    tr_globalUnlock( tor->session );
     
    273262}
    274263
     264static inline tr_bool
     265tr_torrentIsSeed( const tr_torrent * tor )
     266{
     267    return tor->completeness != TR_LEECH;
     268}
     269
     270static inline tr_bool tr_torrentIsPrivate( const tr_torrent * tor )
     271{
     272    return ( tor != NULL ) && tor->info.isPrivate;
     273}
     274
     275static inline tr_bool tr_torrentAllowsPex( const tr_torrent * tor )
     276{
     277    return ( tor != NULL  ) && tor->session->isPexEnabled && !tr_torrentIsPrivate( tor );
     278}
     279
     280static inline tr_bool tr_torrentIsPieceChecked( const tr_torrent  * tor, tr_piece_index_t i )
     281{
     282    return tr_bitfieldHas( &tor->checkedPieces, i );
     283}
    275284
    276285#endif
Note: See TracChangeset for help on using the changeset viewer.