* hb_list_rem ********************************************************************** * Remove an item from the list. Bad things will happen if called * with a NULL pointer or if the item is not in the list. *********************************************************************/
| 4195 | * with a NULL pointer or if the item is not in the list. |
| 4196 | *********************************************************************/ |
| 4197 | void hb_list_rem( hb_list_t * l, void * p ) |
| 4198 | { |
| 4199 | int i; |
| 4200 | |
| 4201 | /* Find the item in the list */ |
| 4202 | for( i = 0; i < l->items_count; i++ ) |
| 4203 | { |
| 4204 | if( l->items[i] == p ) |
| 4205 | { |
| 4206 | /* Shift all items after it sizeof( void * ) bytes earlier */ |
| 4207 | memmove( &l->items[i], &l->items[i+1], |
| 4208 | ( l->items_count - i - 1 ) * sizeof( void * ) ); |
| 4209 | |
| 4210 | (l->items_count)--; |
| 4211 | break; |
| 4212 | } |
| 4213 | } |
| 4214 | } |
| 4215 | |
| 4216 | /********************************************************************** |
| 4217 | * hb_list_item |
no outgoing calls
no test coverage detected