diff --git a/libtransmission/handshake.c b/libtransmission/handshake.c index 5cd063f64..97fe1a70e 100644 --- a/libtransmission/handshake.c +++ b/libtransmission/handshake.c @@ -862,7 +862,7 @@ readCryptoProvide( tr_handshake * handshake, const tr_bool clientIsSeed = tr_torrentIsSeed( tor ); const tr_bool peerIsSeed = tr_peerMgrPeerIsSeed( tor, tr_peerIoGetAddress( handshake->io, NULL ) ); dbgmsg( handshake, "got INCOMING connection's encrypted handshake for torrent [%s]", - tor->info.name ); + tr_torrentName( tor ) ); tr_peerIoSetTorrentHash( handshake->io, tor->info.hash ); if( clientIsSeed && peerIsSeed ) diff --git a/libtransmission/peer-mgr.c b/libtransmission/peer-mgr.c index 363cde180..654183818 100644 --- a/libtransmission/peer-mgr.c +++ b/libtransmission/peer-mgr.c @@ -171,7 +171,7 @@ struct tr_peerMgr #define tordbg( t, ... ) \ do { \ if( tr_deepLoggingIsActive( ) ) \ - tr_deepLog( __FILE__, __LINE__, t->tor->info.name, __VA_ARGS__ ); \ + tr_deepLog( __FILE__, __LINE__, tr_torrentName( t->tor ), __VA_ARGS__ ); \ } while( 0 ) #define dbgmsg( ... ) \ @@ -2363,7 +2363,7 @@ reconnectTorrent( Torrent * t ) "%d connection candidates, " "%d atoms, " "max per pulse is %d", - t->tor->info.name, + tr_torrentName( t->tor ), mustCloseCount, canCloseCount, candidateCount, diff --git a/libtransmission/peer-msgs.c b/libtransmission/peer-msgs.c index 75c27cf56..afcc1aff5 100644 --- a/libtransmission/peer-msgs.c +++ b/libtransmission/peer-msgs.c @@ -219,7 +219,7 @@ myDebug( const char * file, int line, evbuffer_add_printf( buf, "[%s] %s - %s [%s]: ", tr_getLogTimeStr( timestr, sizeof( timestr ) ), - msgs->torrent->info.name, + tr_torrentName( msgs->torrent ), tr_peerIoGetAddrStr( msgs->peer->io ), msgs->peer->client ); va_start( args, fmt ); diff --git a/libtransmission/resume.c b/libtransmission/resume.c index ceb6b0809..92b036a32 100644 --- a/libtransmission/resume.c +++ b/libtransmission/resume.c @@ -69,7 +69,7 @@ getResumeFilename( const tr_torrent * tor ) return tr_strdup_printf( "%s%c%s.%16.16s.resume", tr_getResumeDir( tor->session ), TR_PATH_DELIMITER, - tor->info.name, + tr_torrentName( tor ), tor->info.hashString ); } @@ -501,7 +501,7 @@ tr_torrentSaveResume( const tr_torrent * tor ) if( !tr_isTorrent( tor ) ) return; - tr_tordbg( tor, "Saving .resume file for \"%s\"", tor->info.name ); + tr_tordbg( tor, "Saving .resume file for \"%s\"", tr_torrentName( tor ) ); tr_bencInitDict( &top, 32 ); /* arbitrary "big enough" number */ tr_bencDictAddInt( &top, KEY_ACTIVITY_DATE, diff --git a/libtransmission/torrent.h b/libtransmission/torrent.h index 03d48a5c0..4ded66206 100644 --- a/libtransmission/torrent.h +++ b/libtransmission/torrent.h @@ -326,7 +326,7 @@ enum TORRENT_MAGIC_NUMBER = 95549 }; -static inline tr_bool tr_isTorrent( const tr_torrent * tor ) +static TR_INLINE tr_bool tr_isTorrent( const tr_torrent * tor ) { return ( tor != NULL ) && ( tor->magicNumber == TORRENT_MAGIC_NUMBER ) @@ -335,11 +335,18 @@ static 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 inline void tr_torrentSetDirty( tr_torrent * tor ) +static TR_INLINE void tr_torrentSetDirty( tr_torrent * tor ) { assert( tr_isTorrent( tor ) ); tor->isDirty = TRUE; } +static TR_INLINE const char * tr_torrentName( const tr_torrent * tor ) +{ + assert( tr_isTorrent( tor ) ); + + return tor->info.name; +} + #endif