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

(trunk libT) inline a few more torrent methods

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.