(trunk libT) replace the TR_INLINE macro with the standard "inline" keyword, since we require inline functions anyway
This commit is contained in:
parent
21bd268aa9
commit
6b8fb48d64
|
@ -71,7 +71,7 @@ bytesUsed( const uint64_t now, struct bratecontrol * r, size_t size )
|
|||
*******
|
||||
******/
|
||||
|
||||
static TR_INLINE int
|
||||
static inline int
|
||||
comparePointers( const void * a, const void * b )
|
||||
{
|
||||
if( a != b )
|
||||
|
|
|
@ -123,7 +123,7 @@ tr_bandwidth* tr_bandwidthConstruct( tr_bandwidth * bandwidth,
|
|||
tr_bandwidth * parent );
|
||||
|
||||
/** @brief create a new tr_bandwidth object */
|
||||
static TR_INLINE tr_bandwidth* tr_bandwidthNew( tr_session * session, tr_bandwidth * parent )
|
||||
static inline tr_bandwidth* tr_bandwidthNew( tr_session * session, tr_bandwidth * parent )
|
||||
{
|
||||
return tr_bandwidthConstruct( tr_new0( tr_bandwidth, 1 ), session, parent );
|
||||
}
|
||||
|
@ -131,13 +131,13 @@ static TR_INLINE tr_bandwidth* tr_bandwidthNew( tr_session * session, tr_bandwid
|
|||
tr_bandwidth* tr_bandwidthDestruct( tr_bandwidth * bandwidth );
|
||||
|
||||
/** @brief free a tr_bandwidth object */
|
||||
static TR_INLINE void tr_bandwidthFree( tr_bandwidth * bandwidth )
|
||||
static inline void tr_bandwidthFree( tr_bandwidth * bandwidth )
|
||||
{
|
||||
tr_free( tr_bandwidthDestruct( bandwidth ) );
|
||||
}
|
||||
|
||||
/** @brief test to see if the pointer refers to a live bandwidth object */
|
||||
static TR_INLINE tr_bool tr_isBandwidth( const tr_bandwidth * b )
|
||||
static inline tr_bool tr_isBandwidth( const tr_bandwidth * b )
|
||||
{
|
||||
return ( b != NULL ) && ( b->magicNumber == MAGIC_NUMBER );
|
||||
}
|
||||
|
@ -151,7 +151,7 @@ static TR_INLINE tr_bool tr_isBandwidth( const tr_bandwidth * b )
|
|||
* @see tr_bandwidthAllocate
|
||||
* @see tr_bandwidthGetDesiredSpeed
|
||||
*/
|
||||
static TR_INLINE tr_bool tr_bandwidthSetDesiredSpeed( tr_bandwidth * bandwidth,
|
||||
static inline tr_bool tr_bandwidthSetDesiredSpeed( tr_bandwidth * bandwidth,
|
||||
tr_direction dir,
|
||||
double desiredSpeed )
|
||||
{
|
||||
|
@ -165,7 +165,7 @@ static TR_INLINE tr_bool tr_bandwidthSetDesiredSpeed( tr_bandwidth * band
|
|||
* @brief Get the desired speed (in KiB/s) for ths bandwidth subtree.
|
||||
* @see tr_bandwidthSetDesiredSpeed
|
||||
*/
|
||||
static TR_INLINE double
|
||||
static inline double
|
||||
tr_bandwidthGetDesiredSpeed( const tr_bandwidth * bandwidth,
|
||||
tr_direction dir )
|
||||
{
|
||||
|
@ -175,7 +175,7 @@ tr_bandwidthGetDesiredSpeed( const tr_bandwidth * bandwidth,
|
|||
/**
|
||||
* @brief Set whether or not this bandwidth should throttle its peer-io's speeds
|
||||
*/
|
||||
static TR_INLINE tr_bool tr_bandwidthSetLimited( tr_bandwidth * bandwidth,
|
||||
static inline tr_bool tr_bandwidthSetLimited( tr_bandwidth * bandwidth,
|
||||
tr_direction dir,
|
||||
tr_bool isLimited )
|
||||
{
|
||||
|
@ -188,7 +188,7 @@ static TR_INLINE tr_bool tr_bandwidthSetLimited( tr_bandwidth * bandwidth
|
|||
/**
|
||||
* @return nonzero if this bandwidth throttles its peer-ios speeds
|
||||
*/
|
||||
static TR_INLINE tr_bool tr_bandwidthIsLimited( const tr_bandwidth * bandwidth,
|
||||
static inline tr_bool tr_bandwidthIsLimited( const tr_bandwidth * bandwidth,
|
||||
tr_direction dir )
|
||||
{
|
||||
return bandwidth->band[dir].isLimited;
|
||||
|
@ -244,7 +244,7 @@ void tr_bandwidthSetParent ( tr_bandwidth * bandwidth,
|
|||
* But when we set a torrent's speed mode to TR_SPEEDLIMIT_UNLIMITED, then
|
||||
* in that particular case we want to ignore the global speed limit...
|
||||
*/
|
||||
static TR_INLINE tr_bool tr_bandwidthHonorParentLimits ( tr_bandwidth * bandwidth,
|
||||
static inline tr_bool tr_bandwidthHonorParentLimits ( tr_bandwidth * bandwidth,
|
||||
tr_direction direction,
|
||||
tr_bool isEnabled )
|
||||
{
|
||||
|
@ -254,7 +254,7 @@ static TR_INLINE tr_bool tr_bandwidthHonorParentLimits ( tr_bandwidth * b
|
|||
return didChange;
|
||||
}
|
||||
|
||||
static TR_INLINE tr_bool tr_bandwidthAreParentLimitsHonored( tr_bandwidth * bandwidth,
|
||||
static inline tr_bool tr_bandwidthAreParentLimitsHonored( tr_bandwidth * bandwidth,
|
||||
tr_direction direction )
|
||||
{
|
||||
assert( tr_isBandwidth( bandwidth ) );
|
||||
|
|
|
@ -354,7 +354,7 @@ tr_bencLoad( const void * buf_in,
|
|||
***/
|
||||
|
||||
/* returns true if the given string length would fit in our string buffer */
|
||||
static TR_INLINE int
|
||||
static inline int
|
||||
stringFitsInBuffer( const tr_benc * val, int len )
|
||||
{
|
||||
return len < (int)sizeof( val->val.s.str.buf );
|
||||
|
@ -362,14 +362,14 @@ stringFitsInBuffer( const tr_benc * val, int len )
|
|||
|
||||
/* returns true if the benc's string was malloced.
|
||||
* this occurs when the string is too long for our string buffer */
|
||||
static TR_INLINE int
|
||||
static inline int
|
||||
stringIsAlloced( const tr_benc * val )
|
||||
{
|
||||
return !stringFitsInBuffer( val, val->val.s.len );
|
||||
}
|
||||
|
||||
/* returns a const pointer to the benc's string */
|
||||
static TR_INLINE const char*
|
||||
static inline const char*
|
||||
getStr( const tr_benc* val )
|
||||
{
|
||||
return stringIsAlloced(val) ? val->val.s.str.ptr : val->val.s.str.buf;
|
||||
|
|
|
@ -203,13 +203,13 @@ tr_bool tr_bencGetStr( const tr_benc * val, const char ** setme );
|
|||
tr_bool tr_bencGetBool( const tr_benc * val, tr_bool * setme );
|
||||
tr_bool tr_bencGetReal( const tr_benc * val, double * setme );
|
||||
|
||||
static TR_INLINE tr_bool tr_bencIsType ( const tr_benc * b, int type ) { return ( b != NULL ) && ( b->type == type ); }
|
||||
static TR_INLINE tr_bool tr_bencIsInt ( const tr_benc * b ) { return tr_bencIsType( b, TR_TYPE_INT ); }
|
||||
static TR_INLINE tr_bool tr_bencIsDict ( const tr_benc * b ) { return tr_bencIsType( b, TR_TYPE_DICT ); }
|
||||
static TR_INLINE tr_bool tr_bencIsList ( const tr_benc * b ) { return tr_bencIsType( b, TR_TYPE_LIST ); }
|
||||
static TR_INLINE tr_bool tr_bencIsString( const tr_benc * b ) { return tr_bencIsType( b, TR_TYPE_STR ); }
|
||||
static TR_INLINE tr_bool tr_bencIsBool ( const tr_benc * b ) { return tr_bencIsType( b, TR_TYPE_BOOL ); }
|
||||
static TR_INLINE tr_bool tr_bencIsReal ( const tr_benc * b ) { return tr_bencIsType( b, TR_TYPE_REAL ); }
|
||||
static inline tr_bool tr_bencIsType ( const tr_benc * b, int type ) { return ( b != NULL ) && ( b->type == type ); }
|
||||
static inline tr_bool tr_bencIsInt ( const tr_benc * b ) { return tr_bencIsType( b, TR_TYPE_INT ); }
|
||||
static inline tr_bool tr_bencIsDict ( const tr_benc * b ) { return tr_bencIsType( b, TR_TYPE_DICT ); }
|
||||
static inline tr_bool tr_bencIsList ( const tr_benc * b ) { return tr_bencIsType( b, TR_TYPE_LIST ); }
|
||||
static inline tr_bool tr_bencIsString( const tr_benc * b ) { return tr_bencIsType( b, TR_TYPE_STR ); }
|
||||
static inline tr_bool tr_bencIsBool ( const tr_benc * b ) { return tr_bencIsType( b, TR_TYPE_BOOL ); }
|
||||
static inline tr_bool tr_bencIsReal ( const tr_benc * b ) { return tr_bencIsType( b, TR_TYPE_REAL ); }
|
||||
|
||||
/**
|
||||
*** Treat these as private -- they're only made public here
|
||||
|
|
|
@ -32,12 +32,12 @@ tr_bitfield* tr_bitfieldConstruct( tr_bitfield*, size_t bitcount );
|
|||
|
||||
tr_bitfield* tr_bitfieldDestruct( tr_bitfield* );
|
||||
|
||||
static TR_INLINE tr_bitfield* tr_bitfieldNew( size_t bitcount )
|
||||
static inline tr_bitfield* tr_bitfieldNew( size_t bitcount )
|
||||
{
|
||||
return tr_bitfieldConstruct( tr_new0( tr_bitfield, 1 ), bitcount );
|
||||
}
|
||||
|
||||
static TR_INLINE void tr_bitfieldFree( tr_bitfield * b )
|
||||
static inline void tr_bitfieldFree( tr_bitfield * b )
|
||||
{
|
||||
tr_free( tr_bitfieldDestruct( b ) );
|
||||
}
|
||||
|
@ -67,20 +67,20 @@ tr_bitfield* tr_bitfieldOr( tr_bitfield*, const tr_bitfield* );
|
|||
has none of tr_bitfieldHas()'s safety checks, so you
|
||||
need to call tr_bitfieldTestFast() first before you
|
||||
start looping. */
|
||||
static TR_INLINE tr_bool tr_bitfieldHasFast( const tr_bitfield * b, const size_t nth )
|
||||
static inline tr_bool tr_bitfieldHasFast( const tr_bitfield * b, const size_t nth )
|
||||
{
|
||||
return ( b->bits[nth>>3u] << ( nth & 7u ) & 0x80 ) != 0;
|
||||
}
|
||||
|
||||
/** @param high the highest nth bit you're going to access */
|
||||
static TR_INLINE tr_bool tr_bitfieldTestFast( const tr_bitfield * b, const size_t high )
|
||||
static inline tr_bool tr_bitfieldTestFast( const tr_bitfield * b, const size_t high )
|
||||
{
|
||||
return ( b != NULL )
|
||||
&& ( b->bits != NULL )
|
||||
&& ( high < b->bitCount );
|
||||
}
|
||||
|
||||
static TR_INLINE tr_bool tr_bitfieldHas( const tr_bitfield * b, size_t nth )
|
||||
static inline tr_bool tr_bitfieldHas( const tr_bitfield * b, size_t nth )
|
||||
{
|
||||
return tr_bitfieldTestFast( b, nth ) && tr_bitfieldHasFast( b, nth );
|
||||
}
|
||||
|
|
|
@ -29,19 +29,19 @@ typedef struct tr_bitset
|
|||
}
|
||||
tr_bitset;
|
||||
|
||||
static TR_INLINE void
|
||||
static inline void
|
||||
tr_bitsetConstructor( tr_bitset * b, int size )
|
||||
{
|
||||
tr_bitfieldConstruct( &b->bitfield, size );
|
||||
}
|
||||
|
||||
static TR_INLINE void
|
||||
static inline void
|
||||
tr_bitsetDestructor( tr_bitset * b )
|
||||
{
|
||||
tr_bitfieldDestruct( &b->bitfield );
|
||||
}
|
||||
|
||||
static TR_INLINE void
|
||||
static inline void
|
||||
tr_bitsetReserve( tr_bitset * b, size_t size )
|
||||
{
|
||||
if( b->bitfield.bitCount < size )
|
||||
|
@ -56,7 +56,7 @@ tr_bitsetReserve( tr_bitset * b, size_t size )
|
|||
}
|
||||
}
|
||||
|
||||
static TR_INLINE tr_bool
|
||||
static inline tr_bool
|
||||
tr_bitsetHasFast( const tr_bitset * b, const size_t nth )
|
||||
{
|
||||
if( b->haveAll ) return TRUE;
|
||||
|
@ -65,7 +65,7 @@ tr_bitsetHasFast( const tr_bitset * b, const size_t nth )
|
|||
return tr_bitfieldHasFast( &b->bitfield, nth );
|
||||
}
|
||||
|
||||
static TR_INLINE tr_bool
|
||||
static inline tr_bool
|
||||
tr_bitsetHas( const tr_bitset * b, const size_t nth )
|
||||
{
|
||||
if( b->haveAll ) return TRUE;
|
||||
|
@ -74,7 +74,7 @@ tr_bitsetHas( const tr_bitset * b, const size_t nth )
|
|||
return tr_bitfieldHas( &b->bitfield, nth );
|
||||
}
|
||||
|
||||
static TR_INLINE void
|
||||
static inline void
|
||||
tr_bitsetOr( tr_bitfield * a, const tr_bitset * b )
|
||||
{
|
||||
if( b->haveAll )
|
||||
|
@ -84,7 +84,7 @@ tr_bitsetOr( tr_bitfield * a, const tr_bitset * b )
|
|||
}
|
||||
|
||||
/* set 'a' to all the flags that were in 'a' but not 'b' */
|
||||
static TR_INLINE void
|
||||
static inline void
|
||||
tr_bitsetDifference( tr_bitfield * a, const tr_bitset * b )
|
||||
{
|
||||
if( b->haveAll )
|
||||
|
@ -93,7 +93,7 @@ tr_bitsetDifference( tr_bitfield * a, const tr_bitset * b )
|
|||
tr_bitfieldDifference( a, &b->bitfield );
|
||||
}
|
||||
|
||||
static TR_INLINE double
|
||||
static inline double
|
||||
tr_bitsetPercent( const tr_bitset * b )
|
||||
{
|
||||
if( b->haveAll ) return 1.0;
|
||||
|
@ -102,21 +102,21 @@ tr_bitsetPercent( const tr_bitset * b )
|
|||
return tr_bitfieldCountTrueBits( &b->bitfield ) / (double)b->bitfield.bitCount;
|
||||
}
|
||||
|
||||
static TR_INLINE void
|
||||
static inline void
|
||||
tr_bitsetSetHaveAll( tr_bitset * b )
|
||||
{
|
||||
b->haveAll = 1;
|
||||
b->haveNone = 0;
|
||||
}
|
||||
|
||||
static TR_INLINE void
|
||||
static inline void
|
||||
tr_bitsetSetHaveNone( tr_bitset * b )
|
||||
{
|
||||
b->haveAll = 0;
|
||||
b->haveNone = 1;
|
||||
}
|
||||
|
||||
static TR_INLINE int
|
||||
static inline int
|
||||
tr_bitsetAdd( tr_bitset * b, int i )
|
||||
{
|
||||
int ret = 0;
|
||||
|
|
|
@ -62,12 +62,12 @@ tr_completion * tr_cpConstruct( tr_completion *, tr_torrent * );
|
|||
|
||||
tr_completion * tr_cpDestruct( tr_completion * );
|
||||
|
||||
static TR_INLINE tr_completion* tr_cpNew( tr_torrent * tor )
|
||||
static inline tr_completion* tr_cpNew( tr_torrent * tor )
|
||||
{
|
||||
return tr_cpConstruct( tr_new0( tr_completion, 1 ), tor );
|
||||
}
|
||||
|
||||
static TR_INLINE void tr_cpFree( tr_completion * cp )
|
||||
static inline void tr_cpFree( tr_completion * cp )
|
||||
{
|
||||
tr_free( tr_cpDestruct( cp ) );
|
||||
}
|
||||
|
@ -88,22 +88,22 @@ void tr_cpGetAmountDone( const tr_completion * completio
|
|||
float * tab,
|
||||
int tabCount );
|
||||
|
||||
static TR_INLINE uint64_t tr_cpHaveTotal( const tr_completion * cp )
|
||||
static inline uint64_t tr_cpHaveTotal( const tr_completion * cp )
|
||||
{
|
||||
return cp->sizeNow;
|
||||
}
|
||||
|
||||
static TR_INLINE uint64_t tr_cpLeftUntilComplete( const tr_completion * cp )
|
||||
static inline uint64_t tr_cpLeftUntilComplete( const tr_completion * cp )
|
||||
{
|
||||
return tr_torrentInfo(cp->tor)->totalSize - cp->sizeNow;
|
||||
}
|
||||
|
||||
static TR_INLINE uint64_t tr_cpLeftUntilDone( const tr_completion * cp )
|
||||
static inline uint64_t tr_cpLeftUntilDone( const tr_completion * cp )
|
||||
{
|
||||
return tr_cpSizeWhenDone( cp ) - cp->sizeNow;
|
||||
}
|
||||
|
||||
static TR_INLINE float tr_cpPercentComplete( const tr_completion * cp )
|
||||
static inline float tr_cpPercentComplete( const tr_completion * cp )
|
||||
{
|
||||
const double ratio = tr_getRatio( cp->sizeNow, tr_torrentInfo(cp->tor)->totalSize );
|
||||
if( (int)ratio == TR_RATIO_NA )
|
||||
|
@ -114,7 +114,7 @@ static TR_INLINE float tr_cpPercentComplete( const tr_completion * cp )
|
|||
return ratio;
|
||||
}
|
||||
|
||||
static TR_INLINE float tr_cpPercentDone( const tr_completion * cp )
|
||||
static inline float tr_cpPercentDone( const tr_completion * cp )
|
||||
{
|
||||
const double ratio = tr_getRatio( cp->sizeNow, tr_cpSizeWhenDone( cp ) );
|
||||
return (ratio == TR_RATIO_NA || ratio == TR_RATIO_INF) ? 0.0f : ratio;
|
||||
|
@ -142,12 +142,12 @@ tr_bool tr_cpFileIsComplete( const tr_completion * cp, tr_file_index_t );
|
|||
*** Blocks
|
||||
**/
|
||||
|
||||
static TR_INLINE tr_bool tr_cpBlockIsCompleteFast( const tr_completion * cp, tr_block_index_t block )
|
||||
static inline tr_bool tr_cpBlockIsCompleteFast( const tr_completion * cp, tr_block_index_t block )
|
||||
{
|
||||
return tr_bitfieldHasFast( &cp->blockBitfield, block );
|
||||
}
|
||||
|
||||
static TR_INLINE tr_bool tr_cpBlockIsComplete( const tr_completion * cp, tr_block_index_t block )
|
||||
static inline tr_bool tr_cpBlockIsComplete( const tr_completion * cp, tr_block_index_t block )
|
||||
{
|
||||
return tr_bitfieldHas( &cp->blockBitfield, block );
|
||||
}
|
||||
|
@ -162,11 +162,11 @@ tr_bool tr_cpBlockBitfieldSet( tr_completion * completion,
|
|||
****
|
||||
***/
|
||||
|
||||
static TR_INLINE const struct tr_bitfield * tr_cpPieceBitfield( const tr_completion * cp ) {
|
||||
static inline const struct tr_bitfield * tr_cpPieceBitfield( const tr_completion * cp ) {
|
||||
return &cp->pieceBitfield;
|
||||
}
|
||||
|
||||
static TR_INLINE const struct tr_bitfield * tr_cpBlockBitfield( const tr_completion * cp ) {
|
||||
static inline const struct tr_bitfield * tr_cpBlockBitfield( const tr_completion * cp ) {
|
||||
assert( cp );
|
||||
assert( cp->blockBitfield.bits );
|
||||
assert( cp->blockBitfield.bitCount );
|
||||
|
|
|
@ -403,7 +403,7 @@ TrOpenFile( tr_session * session,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static TR_INLINE tr_bool
|
||||
static inline tr_bool
|
||||
fileIsOpen( const struct tr_openfile * o )
|
||||
{
|
||||
return o->fd >= 0;
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
#ifndef TR_LIST_H
|
||||
#define TR_LIST_H
|
||||
|
||||
#include "transmission.h" /* TR_INLINE */
|
||||
#include "transmission.h" /* inline */
|
||||
|
||||
typedef struct tr_list
|
||||
{
|
||||
|
@ -82,7 +82,7 @@ typedef void ( *__tr_list_free_t )( void * );
|
|||
*
|
||||
* Init @head as an empty list.
|
||||
*/
|
||||
static TR_INLINE void
|
||||
static inline void
|
||||
__tr_list_init( struct __tr_list * head )
|
||||
{
|
||||
head->next = head->prev = head;
|
||||
|
@ -114,7 +114,7 @@ __tr_list_splice( struct __tr_list * prev,
|
|||
*
|
||||
* Append @list to the end of @head.
|
||||
*/
|
||||
static TR_INLINE void
|
||||
static inline void
|
||||
__tr_list_append( struct __tr_list * head,
|
||||
struct __tr_list * list)
|
||||
{
|
||||
|
|
|
@ -91,7 +91,7 @@ int tr_compareAddresses( const tr_address * a,
|
|||
|
||||
tr_bool tr_isValidPeerAddress( const tr_address * addr, tr_port port );
|
||||
|
||||
static TR_INLINE tr_bool tr_isAddress( const tr_address * a ) { return ( a != NULL ) && ( a->type==TR_AF_INET || a->type==TR_AF_INET6 ); }
|
||||
static inline tr_bool tr_isAddress( const tr_address * a ) { return ( a != NULL ) && ( a->type==TR_AF_INET || a->type==TR_AF_INET6 ); }
|
||||
|
||||
tr_bool tr_net_hasIPv6( tr_port );
|
||||
|
||||
|
|
|
@ -151,7 +151,7 @@ tr_bool tr_isPeerIo ( const tr_peerIo * io );
|
|||
|
||||
void tr_peerIoEnableLTEP( tr_peerIo * io, tr_bool flag );
|
||||
|
||||
static TR_INLINE tr_bool tr_peerIoSupportsLTEP( const tr_peerIo * io )
|
||||
static inline tr_bool tr_peerIoSupportsLTEP( const tr_peerIo * io )
|
||||
{
|
||||
assert( tr_isPeerIo( io ) );
|
||||
|
||||
|
@ -160,7 +160,7 @@ static TR_INLINE tr_bool tr_peerIoSupportsLTEP( const tr_peerIo * io )
|
|||
|
||||
void tr_peerIoEnableFEXT( tr_peerIo * io, tr_bool flag );
|
||||
|
||||
static TR_INLINE tr_bool tr_peerIoSupportsFEXT( const tr_peerIo * io )
|
||||
static inline tr_bool tr_peerIoSupportsFEXT( const tr_peerIo * io )
|
||||
{
|
||||
assert( tr_isPeerIo( io ) );
|
||||
|
||||
|
@ -169,7 +169,7 @@ static TR_INLINE tr_bool tr_peerIoSupportsFEXT( const tr_peerIo * io )
|
|||
|
||||
void tr_peerIoEnableDHT( tr_peerIo * io, tr_bool flag );
|
||||
|
||||
static TR_INLINE tr_bool tr_peerIoSupportsDHT( const tr_peerIo * io )
|
||||
static inline tr_bool tr_peerIoSupportsDHT( const tr_peerIo * io )
|
||||
{
|
||||
assert( tr_isPeerIo( io ) );
|
||||
|
||||
|
@ -180,7 +180,7 @@ static TR_INLINE tr_bool tr_peerIoSupportsDHT( const tr_peerIo * io )
|
|||
***
|
||||
**/
|
||||
|
||||
static TR_INLINE tr_session* tr_peerIoGetSession ( tr_peerIo * io )
|
||||
static inline tr_session* tr_peerIoGetSession ( tr_peerIo * io )
|
||||
{
|
||||
assert( tr_isPeerIo( io ) );
|
||||
assert( io->session );
|
||||
|
@ -191,7 +191,7 @@ static TR_INLINE tr_session* tr_peerIoGetSession ( tr_peerIo * io )
|
|||
const char* tr_peerIoAddrStr( const struct tr_address * addr,
|
||||
tr_port port );
|
||||
|
||||
static TR_INLINE const char* tr_peerIoGetAddrStr( const tr_peerIo * io )
|
||||
static inline const char* tr_peerIoGetAddrStr( const tr_peerIo * io )
|
||||
{
|
||||
return tr_isPeerIo( io ) ? tr_peerIoAddrStr( &io->addr, io->port ) : "error";
|
||||
}
|
||||
|
@ -208,12 +208,12 @@ void tr_peerIoSetTorrentHash( tr_peerIo * io,
|
|||
|
||||
int tr_peerIoReconnect( tr_peerIo * io );
|
||||
|
||||
static TR_INLINE tr_bool tr_peerIoIsIncoming( const tr_peerIo * io )
|
||||
static inline tr_bool tr_peerIoIsIncoming( const tr_peerIo * io )
|
||||
{
|
||||
return io->isIncoming;
|
||||
}
|
||||
|
||||
static TR_INLINE int tr_peerIoGetAge( const tr_peerIo * io )
|
||||
static inline int tr_peerIoGetAge( const tr_peerIo * io )
|
||||
{
|
||||
return time( NULL ) - io->timeCreated;
|
||||
}
|
||||
|
@ -226,7 +226,7 @@ static TR_INLINE int tr_peerIoGetAge( const tr_peerIo * io )
|
|||
void tr_peerIoSetPeersId( tr_peerIo * io,
|
||||
const uint8_t * peer_id );
|
||||
|
||||
static TR_INLINE const uint8_t* tr_peerIoGetPeersId( const tr_peerIo * io )
|
||||
static inline const uint8_t* tr_peerIoGetPeersId( const tr_peerIo * io )
|
||||
{
|
||||
assert( tr_isPeerIo( io ) );
|
||||
assert( io->peerIdIsSet );
|
||||
|
@ -263,7 +263,7 @@ void tr_peerIoWriteBuf ( tr_peerIo * io,
|
|||
***
|
||||
**/
|
||||
|
||||
static TR_INLINE struct tr_crypto * tr_peerIoGetCrypto( tr_peerIo * io )
|
||||
static inline struct tr_crypto * tr_peerIoGetCrypto( tr_peerIo * io )
|
||||
{
|
||||
return io->crypto;
|
||||
}
|
||||
|
@ -279,12 +279,12 @@ EncryptionMode;
|
|||
void tr_peerIoSetEncryption( tr_peerIo * io,
|
||||
int encryptionMode );
|
||||
|
||||
static TR_INLINE tr_bool tr_peerIoIsEncrypted( const tr_peerIo * io )
|
||||
static inline tr_bool tr_peerIoIsEncrypted( const tr_peerIo * io )
|
||||
{
|
||||
return ( io != NULL ) && ( io->encryptionMode == PEER_ENCRYPTION_RC4 );
|
||||
}
|
||||
|
||||
static TR_INLINE void tr_peerIoWriteBytes( tr_peerIo * io UNUSED,
|
||||
static inline void tr_peerIoWriteBytes( tr_peerIo * io UNUSED,
|
||||
struct evbuffer * outbuf,
|
||||
const void * bytes,
|
||||
size_t byteCount )
|
||||
|
@ -292,14 +292,14 @@ static TR_INLINE void tr_peerIoWriteBytes( tr_peerIo * io UNUSED,
|
|||
evbuffer_add( outbuf, bytes, byteCount );
|
||||
}
|
||||
|
||||
static TR_INLINE void tr_peerIoWriteUint8( tr_peerIo * io,
|
||||
static inline void tr_peerIoWriteUint8( tr_peerIo * io,
|
||||
struct evbuffer * outbuf,
|
||||
uint8_t writeme )
|
||||
{
|
||||
tr_peerIoWriteBytes( io, outbuf, &writeme, sizeof( uint8_t ) );
|
||||
}
|
||||
|
||||
static TR_INLINE void tr_peerIoWriteUint16( tr_peerIo * io,
|
||||
static inline void tr_peerIoWriteUint16( tr_peerIo * io,
|
||||
struct evbuffer * outbuf,
|
||||
uint16_t writeme )
|
||||
{
|
||||
|
@ -307,7 +307,7 @@ static TR_INLINE void tr_peerIoWriteUint16( tr_peerIo * io,
|
|||
tr_peerIoWriteBytes( io, outbuf, &tmp, sizeof( uint16_t ) );
|
||||
}
|
||||
|
||||
static TR_INLINE void tr_peerIoWriteUint32( tr_peerIo * io,
|
||||
static inline void tr_peerIoWriteUint32( tr_peerIo * io,
|
||||
struct evbuffer * outbuf,
|
||||
uint32_t writeme )
|
||||
{
|
||||
|
@ -320,14 +320,14 @@ void tr_peerIoReadBytes( tr_peerIo * io,
|
|||
void * bytes,
|
||||
size_t byteCount );
|
||||
|
||||
static TR_INLINE void tr_peerIoReadUint8( tr_peerIo * io,
|
||||
static inline void tr_peerIoReadUint8( tr_peerIo * io,
|
||||
struct evbuffer * inbuf,
|
||||
uint8_t * setme )
|
||||
{
|
||||
tr_peerIoReadBytes( io, inbuf, setme, sizeof( uint8_t ) );
|
||||
}
|
||||
|
||||
static TR_INLINE void tr_peerIoReadUint16( tr_peerIo * io,
|
||||
static inline void tr_peerIoReadUint16( tr_peerIo * io,
|
||||
struct evbuffer * inbuf,
|
||||
uint16_t * setme )
|
||||
{
|
||||
|
@ -336,7 +336,7 @@ static TR_INLINE void tr_peerIoReadUint16( tr_peerIo * io,
|
|||
*setme = ntohs( tmp );
|
||||
}
|
||||
|
||||
static TR_INLINE void tr_peerIoReadUint32( tr_peerIo * io,
|
||||
static inline void tr_peerIoReadUint32( tr_peerIo * io,
|
||||
struct evbuffer * inbuf,
|
||||
uint32_t * setme )
|
||||
{
|
||||
|
@ -355,7 +355,7 @@ void tr_peerIoDrain( tr_peerIo * io,
|
|||
|
||||
size_t tr_peerIoGetWriteBufferSpace( const tr_peerIo * io, uint64_t now );
|
||||
|
||||
static TR_INLINE void tr_peerIoSetParent( tr_peerIo * io,
|
||||
static inline void tr_peerIoSetParent( tr_peerIo * io,
|
||||
struct tr_bandwidth * parent )
|
||||
{
|
||||
assert( tr_isPeerIo( io ) );
|
||||
|
@ -368,7 +368,7 @@ void tr_peerIoBandwidthUsed( tr_peerIo * io,
|
|||
size_t byteCount,
|
||||
int isPieceData );
|
||||
|
||||
static TR_INLINE tr_bool tr_peerIoHasBandwidthLeft( const tr_peerIo * io,
|
||||
static inline tr_bool tr_peerIoHasBandwidthLeft( const tr_peerIo * io,
|
||||
tr_direction dir )
|
||||
{
|
||||
assert( tr_isPeerIo( io ) );
|
||||
|
@ -377,7 +377,7 @@ static TR_INLINE tr_bool tr_peerIoHasBandwidthLeft( const tr_peerIo * io,
|
|||
|| ( tr_bandwidthClamp( &io->bandwidth, dir, 1024 ) > 0 );
|
||||
}
|
||||
|
||||
static TR_INLINE double tr_peerIoGetPieceSpeed( const tr_peerIo * io, uint64_t now, tr_direction dir )
|
||||
static inline double tr_peerIoGetPieceSpeed( const tr_peerIo * io, uint64_t now, tr_direction dir )
|
||||
{
|
||||
assert( tr_isPeerIo( io ) );
|
||||
assert( tr_isDirection( dir ) );
|
||||
|
@ -403,7 +403,7 @@ int tr_peerIoFlushOutgoingProtocolMsgs( tr_peerIo * io );
|
|||
***
|
||||
**/
|
||||
|
||||
static TR_INLINE struct evbuffer * tr_peerIoGetReadBuffer( tr_peerIo * io )
|
||||
static inline struct evbuffer * tr_peerIoGetReadBuffer( tr_peerIo * io )
|
||||
{
|
||||
return io->inbuf;
|
||||
}
|
||||
|
|
|
@ -214,31 +214,31 @@ struct tr_peerMgr
|
|||
***
|
||||
**/
|
||||
|
||||
static TR_INLINE void
|
||||
static inline void
|
||||
managerLock( const struct tr_peerMgr * manager )
|
||||
{
|
||||
tr_globalLock( manager->session );
|
||||
}
|
||||
|
||||
static TR_INLINE void
|
||||
static inline void
|
||||
managerUnlock( const struct tr_peerMgr * manager )
|
||||
{
|
||||
tr_globalUnlock( manager->session );
|
||||
}
|
||||
|
||||
static TR_INLINE void
|
||||
static inline void
|
||||
torrentLock( Torrent * torrent )
|
||||
{
|
||||
managerLock( torrent->manager );
|
||||
}
|
||||
|
||||
static TR_INLINE void
|
||||
static inline void
|
||||
torrentUnlock( Torrent * torrent )
|
||||
{
|
||||
managerUnlock( torrent->manager );
|
||||
}
|
||||
|
||||
static TR_INLINE int
|
||||
static inline int
|
||||
torrentIsLocked( const Torrent * t )
|
||||
{
|
||||
return tr_globalIsLocked( t->manager->session );
|
||||
|
|
|
@ -245,7 +245,7 @@ getHave( const struct tr_peermsgs * msgs )
|
|||
}
|
||||
#endif
|
||||
|
||||
static TR_INLINE tr_session*
|
||||
static inline tr_session*
|
||||
getSession( struct tr_peermsgs * msgs )
|
||||
{
|
||||
return msgs->torrent->session;
|
||||
|
@ -307,7 +307,7 @@ pokeBatchPeriod( tr_peermsgs * msgs,
|
|||
}
|
||||
}
|
||||
|
||||
static TR_INLINE void
|
||||
static inline void
|
||||
dbgOutMessageLen( tr_peermsgs * msgs )
|
||||
{
|
||||
dbgmsg( msgs, "outMessage size is now %zu", EVBUFFER_LENGTH( msgs->outMessages ) );
|
||||
|
@ -1566,7 +1566,7 @@ readBtMessage( tr_peermsgs * msgs, struct evbuffer * inbuf, size_t inlen )
|
|||
return READ_NOW;
|
||||
}
|
||||
|
||||
static TR_INLINE void
|
||||
static inline void
|
||||
decrementDownloadedCount( tr_peermsgs * msgs, uint32_t byteCount )
|
||||
{
|
||||
tr_torrent * tor = msgs->torrent;
|
||||
|
@ -1574,7 +1574,7 @@ decrementDownloadedCount( tr_peermsgs * msgs, uint32_t byteCount )
|
|||
tor->downloadedCur -= MIN( tor->downloadedCur, byteCount );
|
||||
}
|
||||
|
||||
static TR_INLINE void
|
||||
static inline void
|
||||
clientGotUnwantedBlock( tr_peermsgs * msgs, const struct peer_request * req )
|
||||
{
|
||||
decrementDownloadedCount( msgs, req->length );
|
||||
|
@ -2125,7 +2125,7 @@ pexAddedCb( void * vpex,
|
|||
}
|
||||
}
|
||||
|
||||
static TR_INLINE void
|
||||
static inline void
|
||||
pexDroppedCb( void * vpex,
|
||||
void * userData )
|
||||
{
|
||||
|
@ -2138,7 +2138,7 @@ pexDroppedCb( void * vpex,
|
|||
}
|
||||
}
|
||||
|
||||
static TR_INLINE void
|
||||
static inline void
|
||||
pexElementCb( void * vpex,
|
||||
void * userData )
|
||||
{
|
||||
|
|
|
@ -63,9 +63,9 @@ tr_ratecontrol;
|
|||
****
|
||||
***/
|
||||
|
||||
static TR_INLINE void tr_rcConstruct ( tr_ratecontrol * rc ) { memset( rc, 0, sizeof( tr_ratecontrol ) ); }
|
||||
static inline void tr_rcConstruct ( tr_ratecontrol * rc ) { memset( rc, 0, sizeof( tr_ratecontrol ) ); }
|
||||
|
||||
static TR_INLINE void tr_rcDestruct ( tr_ratecontrol * rc ) { memset( rc, 0xDEAD, sizeof( tr_ratecontrol ) ); }
|
||||
static inline void tr_rcDestruct ( tr_ratecontrol * rc ) { memset( rc, 0xDEAD, sizeof( tr_ratecontrol ) ); }
|
||||
|
||||
void tr_rcTransferred ( tr_ratecontrol * ratecontrol,
|
||||
size_t byteCount );
|
||||
|
|
|
@ -169,26 +169,26 @@ enum
|
|||
SESSION_MAGIC_NUMBER = 3845
|
||||
};
|
||||
|
||||
static TR_INLINE tr_bool tr_isSession( const tr_session * session )
|
||||
static inline tr_bool tr_isSession( const tr_session * session )
|
||||
{
|
||||
return ( session != NULL ) && ( session->magicNumber == SESSION_MAGIC_NUMBER );
|
||||
}
|
||||
|
||||
static TR_INLINE tr_bool tr_isPreallocationMode( tr_preallocation_mode m )
|
||||
static inline tr_bool tr_isPreallocationMode( tr_preallocation_mode m )
|
||||
{
|
||||
return ( m == TR_PREALLOCATE_NONE )
|
||||
|| ( m == TR_PREALLOCATE_SPARSE )
|
||||
|| ( m == TR_PREALLOCATE_FULL );
|
||||
}
|
||||
|
||||
static TR_INLINE tr_bool tr_isEncryptionMode( tr_encryption_mode m )
|
||||
static inline tr_bool tr_isEncryptionMode( tr_encryption_mode m )
|
||||
{
|
||||
return ( m == TR_CLEAR_PREFERRED )
|
||||
|| ( m == TR_ENCRYPTION_PREFERRED )
|
||||
|| ( m == TR_ENCRYPTION_REQUIRED );
|
||||
}
|
||||
|
||||
static TR_INLINE tr_bool tr_isPriority( tr_priority_t p )
|
||||
static inline tr_bool tr_isPriority( tr_priority_t p )
|
||||
{
|
||||
return ( p == TR_PRI_LOW )
|
||||
|| ( p == TR_PRI_NORMAL )
|
||||
|
|
|
@ -813,7 +813,7 @@ tr_torrentChangeMyPort( tr_torrent * tor )
|
|||
tr_announcerChangeMyPort( tor );
|
||||
}
|
||||
|
||||
static TR_INLINE void
|
||||
static inline void
|
||||
tr_torrentManualUpdateImpl( void * vtor )
|
||||
{
|
||||
tr_torrent * tor = vtor;
|
||||
|
|
|
@ -254,21 +254,21 @@ struct tr_torrent
|
|||
};
|
||||
|
||||
/* get the index of this piece's first block */
|
||||
static TR_INLINE tr_block_index_t
|
||||
static inline tr_block_index_t
|
||||
tr_torPieceFirstBlock( const tr_torrent * tor, const tr_piece_index_t piece )
|
||||
{
|
||||
return piece * tor->blockCountInPiece;
|
||||
}
|
||||
|
||||
/* what piece index is this block in? */
|
||||
static TR_INLINE tr_piece_index_t
|
||||
static inline tr_piece_index_t
|
||||
tr_torBlockPiece( const tr_torrent * tor, const tr_block_index_t block )
|
||||
{
|
||||
return block / tor->blockCountInPiece;
|
||||
}
|
||||
|
||||
/* how many blocks are in this piece? */
|
||||
static TR_INLINE uint32_t
|
||||
static inline uint32_t
|
||||
tr_torPieceCountBlocks( const tr_torrent * tor, const tr_piece_index_t piece )
|
||||
{
|
||||
return piece == tor->info.pieceCount - 1 ? tor->blockCountInLastPiece
|
||||
|
@ -276,7 +276,7 @@ tr_torPieceCountBlocks( const tr_torrent * tor, const tr_piece_index_t piece )
|
|||
}
|
||||
|
||||
/* how many bytes are in this piece? */
|
||||
static TR_INLINE uint32_t
|
||||
static inline uint32_t
|
||||
tr_torPieceCountBytes( const tr_torrent * tor, const tr_piece_index_t piece )
|
||||
{
|
||||
return piece == tor->info.pieceCount - 1 ? tor->lastPieceSize
|
||||
|
@ -284,55 +284,55 @@ tr_torPieceCountBytes( const tr_torrent * tor, const tr_piece_index_t piece )
|
|||
}
|
||||
|
||||
/* how many bytes are in this block? */
|
||||
static TR_INLINE uint32_t
|
||||
static inline uint32_t
|
||||
tr_torBlockCountBytes( const tr_torrent * tor, const tr_block_index_t block )
|
||||
{
|
||||
return block == tor->blockCount - 1 ? tor->lastBlockSize
|
||||
: tor->blockSize;
|
||||
}
|
||||
|
||||
static TR_INLINE void tr_torrentLock( const tr_torrent * tor )
|
||||
static inline void tr_torrentLock( const tr_torrent * tor )
|
||||
{
|
||||
tr_globalLock( tor->session );
|
||||
}
|
||||
|
||||
static TR_INLINE void tr_torrentUnlock( const tr_torrent * tor )
|
||||
static inline void tr_torrentUnlock( const tr_torrent * tor )
|
||||
{
|
||||
tr_globalUnlock( tor->session );
|
||||
}
|
||||
|
||||
static TR_INLINE tr_bool
|
||||
static inline tr_bool
|
||||
tr_torrentExists( const tr_session * session, const uint8_t * torrentHash )
|
||||
{
|
||||
return tr_torrentFindFromHash( (tr_session*)session, torrentHash ) != NULL;
|
||||
}
|
||||
|
||||
static TR_INLINE tr_bool
|
||||
static inline tr_bool
|
||||
tr_torrentIsSeed( const tr_torrent * tor )
|
||||
{
|
||||
return tor->completeness != TR_LEECH;
|
||||
}
|
||||
|
||||
static TR_INLINE tr_bool tr_torrentIsPrivate( const tr_torrent * tor )
|
||||
static inline tr_bool tr_torrentIsPrivate( const tr_torrent * tor )
|
||||
{
|
||||
return ( tor != NULL ) && tor->info.isPrivate;
|
||||
}
|
||||
|
||||
static TR_INLINE tr_bool tr_torrentAllowsPex( const tr_torrent * tor )
|
||||
static inline tr_bool tr_torrentAllowsPex( const tr_torrent * tor )
|
||||
{
|
||||
return ( tor != NULL )
|
||||
&& ( tor->session->isPexEnabled )
|
||||
&& ( !tr_torrentIsPrivate( tor ) );
|
||||
}
|
||||
|
||||
static TR_INLINE tr_bool tr_torrentAllowsDHT( const tr_torrent * tor )
|
||||
static inline tr_bool tr_torrentAllowsDHT( const tr_torrent * tor )
|
||||
{
|
||||
return ( tor != NULL )
|
||||
&& ( tr_sessionAllowsDHT( tor->session ) )
|
||||
&& ( !tr_torrentIsPrivate( tor ) );
|
||||
}
|
||||
|
||||
static TR_INLINE tr_bool tr_torrentIsPieceChecked( const tr_torrent * tor,
|
||||
static inline tr_bool tr_torrentIsPieceChecked( const tr_torrent * tor,
|
||||
tr_piece_index_t i )
|
||||
{
|
||||
return tr_bitfieldHasFast( &tor->checkedPieces, i );
|
||||
|
@ -347,7 +347,7 @@ enum
|
|||
TORRENT_MAGIC_NUMBER = 95549
|
||||
};
|
||||
|
||||
static TR_INLINE tr_bool tr_isTorrent( const tr_torrent * tor )
|
||||
static inline tr_bool tr_isTorrent( const tr_torrent * tor )
|
||||
{
|
||||
return ( tor != NULL )
|
||||
&& ( tor->magicNumber == TORRENT_MAGIC_NUMBER )
|
||||
|
@ -356,7 +356,7 @@ static TR_INLINE tr_bool tr_isTorrent( const tr_torrent * tor )
|
|||
|
||||
/* set a flag indicating that the torrent's .resume file
|
||||
* needs to be saved when the torrent is closed */
|
||||
static TR_INLINE
|
||||
static inline
|
||||
void tr_torrentSetDirty( tr_torrent * tor )
|
||||
{
|
||||
assert( tr_isTorrent( tor ) );
|
||||
|
@ -364,7 +364,7 @@ void tr_torrentSetDirty( tr_torrent * tor )
|
|||
tor->isDirty = TRUE;
|
||||
}
|
||||
|
||||
static TR_INLINE
|
||||
static inline
|
||||
const char * tr_torrentName( const tr_torrent * tor )
|
||||
{
|
||||
assert( tr_isTorrent( tor ) );
|
||||
|
|
|
@ -54,8 +54,8 @@ static int messageQueueCount = 0;
|
|||
|
||||
#ifndef WIN32
|
||||
/* make null versions of these win32 functions */
|
||||
static TR_INLINE int IsDebuggerPresent( void ) { return FALSE; }
|
||||
static TR_INLINE void OutputDebugString( const void * unused UNUSED ) { }
|
||||
static inline int IsDebuggerPresent( void ) { return FALSE; }
|
||||
static inline void OutputDebugString( const void * unused UNUSED ) { }
|
||||
#endif
|
||||
|
||||
/***
|
||||
|
|
Loading…
Reference in New Issue