Ignore:
Timestamp:
Dec 29, 2008, 8:54:36 AM (12 years ago)
Author:
charles
Message:

(trunk libT) avoid some unnecessary memory fragmentation... for composited objects that have a tr_ptrArray, contain the tr_ptrArray directly rather than a pointer to one allocated elsewhere on the heap.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/ptrarray.h

    r7404 r7524  
    3333 * A simple pointer array that resizes itself dynamically.
    3434 */
    35 typedef struct tr_ptrArray tr_ptrArray;
     35typedef struct tr_ptrArray
     36{
     37    void ** items;
     38    int     n_items;
     39    int     n_alloc;
     40}
     41tr_ptrArray;
     42
     43#define TR_PTR_ARRAY_DATA( A ) ((A)->items)
     44#define TR_PTR_ARRAY_LENGTH( A ) ((A)->n_items)
    3645
    3746typedef void ( *PtrArrayForeachFunc )( void * );
     47
     48extern const tr_ptrArray TR_PTR_ARRAY_INIT;
     49
     50void          tr_ptrArrayDestruct( tr_ptrArray*, PtrArrayForeachFunc func );
    3851
    3952tr_ptrArray * tr_ptrArrayNew( void );
Note: See TracChangeset for help on using the changeset viewer.