(trunk libT) inline the ptrarray one-liners
This commit is contained in:
parent
5e9af46612
commit
d202c5ecea
|
@ -790,7 +790,7 @@ refillPulse( void * vtorrent )
|
|||
blockIterator = blockIteratorNew( t );
|
||||
peers = getPeersUploadingToClient( t, &peerCount );
|
||||
webseedCount = tr_ptrArraySize( &t->webseeds );
|
||||
webseeds = tr_memdup( tr_ptrArrayBase( &t->webseeds ),
|
||||
webseeds = tr_memdup( TR_PTR_ARRAY_DATA( &t->webseeds ),
|
||||
webseedCount * sizeof( tr_webseed* ) );
|
||||
|
||||
while( ( webseedCount || peerCount )
|
||||
|
|
|
@ -85,12 +85,6 @@ tr_ptrArrayPeek( tr_ptrArray * t,
|
|||
return t->items;
|
||||
}
|
||||
|
||||
void**
|
||||
tr_ptrArrayBase( tr_ptrArray * t )
|
||||
{
|
||||
return t->items;
|
||||
}
|
||||
|
||||
void*
|
||||
tr_ptrArrayNth( tr_ptrArray* t,
|
||||
int i )
|
||||
|
@ -110,24 +104,6 @@ tr_ptrArrayBack( tr_ptrArray* t )
|
|||
return tr_ptrArrayNth( t, t->n_items - 1 );
|
||||
}
|
||||
|
||||
int
|
||||
tr_ptrArraySize( const tr_ptrArray * t )
|
||||
{
|
||||
return t->n_items;
|
||||
}
|
||||
|
||||
int
|
||||
tr_ptrArrayEmpty( const tr_ptrArray * t )
|
||||
{
|
||||
return t->n_items == 0;
|
||||
}
|
||||
|
||||
void
|
||||
tr_ptrArrayClear( tr_ptrArray * t )
|
||||
{
|
||||
t->n_items = 0;
|
||||
}
|
||||
|
||||
int
|
||||
tr_ptrArrayInsert( tr_ptrArray * t,
|
||||
void * ptr,
|
||||
|
@ -151,13 +127,6 @@ tr_ptrArrayInsert( tr_ptrArray * t,
|
|||
return pos;
|
||||
}
|
||||
|
||||
int
|
||||
tr_ptrArrayAppend( tr_ptrArray * t,
|
||||
void * ptr )
|
||||
{
|
||||
return tr_ptrArrayInsert( t, ptr, -1 );
|
||||
}
|
||||
|
||||
void*
|
||||
tr_ptrArrayPop( tr_ptrArray* t )
|
||||
{
|
||||
|
|
|
@ -29,6 +29,8 @@
|
|||
#ifndef _TR_PTR_ARRAY_H_
|
||||
#define _TR_PTR_ARRAY_H_
|
||||
|
||||
#include "transmission.h"
|
||||
|
||||
/**
|
||||
* A simple pointer array that resizes itself dynamically.
|
||||
*/
|
||||
|
@ -67,16 +69,16 @@ void* tr_ptrArrayBack( tr_ptrArray * array );
|
|||
void** tr_ptrArrayPeek( tr_ptrArray * array,
|
||||
int * size );
|
||||
|
||||
void** tr_ptrArrayBase( tr_ptrArray * array );
|
||||
|
||||
void tr_ptrArrayClear( tr_ptrArray * array );
|
||||
static inline void tr_ptrArrayClear( tr_ptrArray * a ) { a->n_items = 0; }
|
||||
|
||||
int tr_ptrArrayInsert( tr_ptrArray * array,
|
||||
void * insertMe,
|
||||
int pos );
|
||||
|
||||
int tr_ptrArrayAppend( tr_ptrArray * array,
|
||||
void * appendMe );
|
||||
static inline int tr_ptrArrayAppend( tr_ptrArray * array, void * appendMe )
|
||||
{
|
||||
return tr_ptrArrayInsert( array, appendMe, -1 );
|
||||
}
|
||||
|
||||
void* tr_ptrArrayPop( tr_ptrArray * array );
|
||||
|
||||
|
@ -84,9 +86,15 @@ void tr_ptrArrayErase( tr_ptrArray * array,
|
|||
int begin,
|
||||
int end );
|
||||
|
||||
int tr_ptrArraySize( const tr_ptrArray* );
|
||||
static inline int tr_ptrArraySize( const tr_ptrArray * a )
|
||||
{
|
||||
return a->n_items;
|
||||
}
|
||||
|
||||
int tr_ptrArrayEmpty( const tr_ptrArray* );
|
||||
static inline tr_bool tr_ptrArrayEmpty( const tr_ptrArray * a )
|
||||
{
|
||||
return tr_ptrArraySize(a) == 0;
|
||||
}
|
||||
|
||||
int tr_ptrArrayInsertSorted( tr_ptrArray * array,
|
||||
void * value,
|
||||
|
|
Loading…
Reference in New Issue