(trunk libT) make tr_ptrArrayNth() an inline function

This commit is contained in:
Jordan Lee 2011-03-14 14:09:41 +00:00
parent 46b85c7994
commit 6b682f8042
2 changed files with 11 additions and 13 deletions

View File

@ -57,17 +57,6 @@ tr_ptrArrayPeek( tr_ptrArray * t,
return t->items;
}
void*
tr_ptrArrayNth( tr_ptrArray* t,
int i )
{
assert( t );
assert( i >= 0 );
assert( i < t->n_items );
return t->items[i];
}
int
tr_ptrArrayInsert( tr_ptrArray * t,
void * ptr,

View File

@ -17,6 +17,8 @@
#ifndef _TR_PTR_ARRAY_H_
#define _TR_PTR_ARRAY_H_
#include <assert.h>
#include "transmission.h"
/**
@ -48,8 +50,15 @@ void tr_ptrArrayForeach( tr_ptrArray * array,
/** @brief Return the nth item in a tr_ptrArray
@return the nth item in a tr_ptrArray */
void* tr_ptrArrayNth( tr_ptrArray * array,
int nth );
static inline void*
tr_ptrArrayNth( tr_ptrArray * array, int i )
{
assert( array );
assert( i >= 0 );
assert( i < array->n_items );
return array->items[i];
}
/** @brief Remove the last item from the array and return it
@return the pointer that's been removed from the array