From 6b682f80425be105965897bc5be0d468a69a4fcf Mon Sep 17 00:00:00 2001 From: Jordan Lee Date: Mon, 14 Mar 2011 14:09:41 +0000 Subject: [PATCH] (trunk libT) make tr_ptrArrayNth() an inline function --- libtransmission/ptrarray.c | 11 ----------- libtransmission/ptrarray.h | 13 +++++++++++-- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/libtransmission/ptrarray.c b/libtransmission/ptrarray.c index 2b6c8a8e6..853c68582 100644 --- a/libtransmission/ptrarray.c +++ b/libtransmission/ptrarray.c @@ -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, diff --git a/libtransmission/ptrarray.h b/libtransmission/ptrarray.h index e154f2ea1..314a43ee5 100644 --- a/libtransmission/ptrarray.h +++ b/libtransmission/ptrarray.h @@ -17,6 +17,8 @@ #ifndef _TR_PTR_ARRAY_H_ #define _TR_PTR_ARRAY_H_ +#include + #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