(trunk libT) #2958 "Minimize use of tr_ptrArray in critical parts of the code" -- accept patch from sadface to make tr_ptrArrayInsert() a little cleaner

This commit is contained in:
Charles Kerr 2010-03-10 16:35:12 +00:00
parent 1d8d9d8447
commit 64a847baf0
1 changed files with 6 additions and 6 deletions

View File

@ -73,18 +73,18 @@ tr_ptrArrayInsert( tr_ptrArray * t,
void * ptr,
int pos )
{
if( pos < 0 || pos > t->n_items )
pos = t->n_items;
if( t->n_items >= t->n_alloc )
{
t->n_alloc = MAX( FLOOR, t->n_alloc * 2 );
t->items = tr_renew( void*, t->items, t->n_alloc );
}
memmove( t->items + pos + 1,
t->items + pos,
sizeof( void* ) * ( t->n_items - pos ) );
if( pos < 0 || pos > t->n_items )
pos = t->n_items;
else
memmove( t->items + pos + 1,
t->items + pos,
sizeof( void* ) * ( t->n_items - pos ) );
t->items[pos] = ptr;
t->n_items++;