1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2025-03-04 18:48:06 +00:00

(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; 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 int
tr_ptrArrayInsert( tr_ptrArray * t, tr_ptrArrayInsert( tr_ptrArray * t,
void * ptr, void * ptr,

View file

@ -17,6 +17,8 @@
#ifndef _TR_PTR_ARRAY_H_ #ifndef _TR_PTR_ARRAY_H_
#define _TR_PTR_ARRAY_H_ #define _TR_PTR_ARRAY_H_
#include <assert.h>
#include "transmission.h" #include "transmission.h"
/** /**
@ -48,8 +50,15 @@ void tr_ptrArrayForeach( tr_ptrArray * array,
/** @brief Return the nth item in a tr_ptrArray /** @brief Return the nth item in a tr_ptrArray
@return the nth item in a tr_ptrArray */ @return the nth item in a tr_ptrArray */
void* tr_ptrArrayNth( tr_ptrArray * array, static inline void*
int nth ); 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 /** @brief Remove the last item from the array and return it
@return the pointer that's been removed from the array @return the pointer that's been removed from the array