minor tweaks: dead code removal, make functions static, etc

This commit is contained in:
Charles Kerr 2008-04-22 20:51:15 +00:00
parent 0c1599608d
commit 1b901ca9df
3 changed files with 6 additions and 17 deletions

View File

@ -206,7 +206,7 @@ getNode( tr_benc * top, tr_ptrArray * parentStack, int type )
int
tr_bencParse( const void * buf_in,
const void * bufend_in,
tr_benc * top,
tr_benc * top,
const uint8_t ** setme_end )
{
int err;
@ -396,14 +396,6 @@ tr_bencGetInt ( const tr_benc * val, int64_t * setme )
return success;
}
char *
tr_bencStealStr( tr_benc * val )
{
assert( tr_bencIsString( val ) );
val->val.s.nofree = 1;
return val->val.s.s;
}
int
tr_bencDictFindInt( tr_benc * dict, const char * key, int64_t * setme )
{
@ -1124,7 +1116,7 @@ tr_bencSaveFile( const char * filename, const tr_benc * b )
int
tr_bencLoadFile( const char * filename, tr_benc * b )
{
int ret = TR_ERROR;
int ret;
size_t contentLen;
uint8_t * content = tr_loadFile( filename, &contentLen );
ret = content ? tr_bencLoad( content, contentLen, b, NULL )

View File

@ -76,9 +76,6 @@ tr_benc * tr_bencDictFind( tr_benc * dict, const char * key );
tr_benc * tr_bencDictFindType( tr_benc * dict, const char * key, int type );
tr_benc * tr_bencDictFindFirst( tr_benc * dict, ... );
/* marks a string as 'do not free' and returns it */
char * tr_bencStealStr( tr_benc * val );
/* convenience functions for building tr_benc structures */
static inline void tr_bencInit( tr_benc * val, int type )

View File

@ -48,7 +48,7 @@ static void
getResumeFilename( char * buf, size_t buflen, const tr_torrent * tor )
{
const char * dir = tr_getResumeDir( tor->handle );
char base[4096];
char base[MAX_PATH_LENGTH];
snprintf( base, sizeof( base ), "%s.%16.16s.resume",
tor->info.name,
tor->info.hashString );
@ -102,7 +102,7 @@ loadPeers( tr_benc * dict, tr_torrent * tor )
static void
saveDND( tr_benc * dict, const tr_torrent * tor )
{
const tr_info * inf = &tor->info;
const tr_info * inf = tr_torrentInfo( tor );
const tr_file_index_t n = inf->fileCount;
tr_file_index_t i;
tr_benc * list;
@ -164,7 +164,7 @@ loadDND( tr_benc * dict, tr_torrent * tor )
static void
savePriorities( tr_benc * dict, const tr_torrent * tor )
{
const tr_info * inf = &tor->info;
const tr_info * inf = tr_torrentInfo( tor );
const tr_file_index_t n = inf->fileCount;
tr_file_index_t i;
tr_benc * list;
@ -371,7 +371,7 @@ tr_torrentSaveResume( const tr_torrent * tor )
tr_bencFree( &top );
}
uint64_t
static uint64_t
loadFromFile( tr_torrent * tor,
uint64_t fieldsToLoad )
{