mirror of
https://github.com/transmission/transmission
synced 2025-03-04 10:38:13 +00:00
(trunk libT) make tr_ptrArrayNth() an inline function
This commit is contained in:
parent
46b85c7994
commit
6b682f8042
2 changed files with 11 additions and 13 deletions
|
@ -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,
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue