Changeset 12161


Ignore:
Timestamp:
Mar 14, 2011, 2:09:41 PM (10 years ago)
Author:
jordan
Message:

(trunk libT) make tr_ptrArrayNth() an inline function

Location:
trunk/libtransmission
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/ptrarray.c

    r11709 r12161  
    5656    *size = t->n_items;
    5757    return t->items;
    58 }
    59 
    60 void*
    61 tr_ptrArrayNth( tr_ptrArray* t,
    62                 int          i )
    63 {
    64     assert( t );
    65     assert( i >= 0 );
    66     assert( i < t->n_items );
    67 
    68     return t->items[i];
    6958}
    7059
  • trunk/libtransmission/ptrarray.h

    r12141 r12161  
    1717#ifndef _TR_PTR_ARRAY_H_
    1818#define _TR_PTR_ARRAY_H_
     19
     20#include <assert.h>
    1921
    2022#include "transmission.h"
     
    4951/** @brief Return the nth item in a tr_ptrArray
    5052    @return the nth item in a tr_ptrArray */
    51 void*         tr_ptrArrayNth( tr_ptrArray   * array,
    52                               int             nth );
     53static inline void*
     54tr_ptrArrayNth( tr_ptrArray * array, int i )
     55{
     56    assert( array );
     57    assert( i >= 0 );
     58    assert( i < array->n_items );
     59
     60    return array->items[i];
     61}
    5362
    5463/** @brief Remove the last item from the array and return it
Note: See TracChangeset for help on using the changeset viewer.