Changeset 10348


Ignore:
Timestamp:
Mar 10, 2010, 4:35:11 PM (12 years ago)
Author:
charles
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/1.9x/libtransmission/ptrarray.c

    r10209 r10348  
    7474                   int           pos )
    7575{
    76     if( pos < 0 || pos > t->n_items )
    77         pos = t->n_items;
    78 
    7976    if( t->n_items >= t->n_alloc )
    8077    {
     
    8380    }
    8481
    85     memmove( t->items + pos + 1,
    86              t->items + pos,
    87              sizeof( void* ) * ( t->n_items - pos ) );
     82    if( pos < 0 || pos > t->n_items )
     83        pos = t->n_items;
     84    else
     85        memmove( t->items + pos + 1,
     86                 t->items + pos,
     87                 sizeof( void* ) * ( t->n_items - pos ) );
    8888
    8989    t->items[pos] = ptr;
Note: See TracChangeset for help on using the changeset viewer.