Changeset 3221
- Timestamp:
- Sep 28, 2007, 3:05:42 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libtransmission/ptrarray.c
r3105 r3221 161 161 162 162 return first; 163 } 163 } 164 165 static void 166 assertSortedAndUnique( const tr_ptrArray * t, 167 int compare(const void*, const void*) ) 168 { 169 int i; 170 for( i=0; i<t->n_items-2; ++i ) 171 assert( compare( t->items[i], t->items[i+1] ) < 0 ); 172 } 164 173 165 174 int … … 169 178 { 170 179 const int pos = tr_ptrArrayLowerBound( t, ptr, compare, NULL ); 171 return tr_ptrArrayInsert( t, ptr, pos ); 180 const int ret = tr_ptrArrayInsert( t, ptr, pos ); 181 assertSortedAndUnique( t, compare ); 182 return ret; 172 183 } 173 184 … … 194 205 tr_ptrArrayErase( t, pos, pos+1 ); 195 206 } 207 assertSortedAndUnique( t, compare ); 196 208 return ret; 197 209 }
Note: See TracChangeset
for help on using the changeset viewer.