inline tr_removeElementFromArray()

This commit is contained in:
Mitchell Livingston 2009-11-30 01:31:05 +00:00
parent ad58089864
commit 0563580dda
3 changed files with 10 additions and 18 deletions

View File

@ -1167,7 +1167,7 @@ void tr_torrentSetDownloadDir( tr_torrent * torrent, const char * path );
const char * tr_torrentGetDownloadDir( const tr_torrent * torrent );
/**
* Returns the the root directory of where the torrent is.
* Returns the root directory of where the torrent is.
*
* This will usually be the downloadDir. However if the torrent
* has an incompleteDir enabled and hasn't finished downloading

View File

@ -1406,18 +1406,3 @@ tr_moveFile( const char * oldpath, const char * newpath, tr_bool * renamed )
unlink( oldpath );
return 0;
}
/***
****
***/
void
tr_removeElementFromArray( void * array, int index_to_remove,
size_t sizeof_element, size_t nmemb )
{
char * a = array;
memmove( a + sizeof_element * index_to_remove,
a + sizeof_element * ( index_to_remove + 1 ),
sizeof_element * ( --nmemb - index_to_remove ) );
}

View File

@ -434,8 +434,15 @@ struct tm * tr_localtime_r( const time_t *_clock, struct tm *_result );
int tr_moveFile( const char * oldpath, const char * newpath,
tr_bool * renamed ) TR_GNUC_NONNULL(1,2);
void tr_removeElementFromArray( void * array, int index_to_remove,
size_t sizeof_element, size_t nmemb );
static TR_INLINE void tr_removeElementFromArray( void * array, int index_to_remove,
size_t sizeof_element, size_t nmemb )
{
char * a = array;
memmove( a + sizeof_element * index_to_remove,
a + sizeof_element * ( index_to_remove + 1 ),
sizeof_element * ( --nmemb - index_to_remove ) );
}
/***
****