| 318 | } |
| 319 | |
| 320 | int acl_array_delete_obj(ACL_ARRAY *a, void *obj, void (*free_fn)(void *)) |
| 321 | { |
| 322 | int idx, position, ret; |
| 323 | |
| 324 | position = -1; |
| 325 | for (idx = 0; idx < a->count; idx++) { |
| 326 | if (a->items[idx] == obj) { |
| 327 | position = idx; |
| 328 | break; |
| 329 | } |
| 330 | } |
| 331 | |
| 332 | if (free_fn != NULL && obj != NULL) |
| 333 | free_fn(obj); |
| 334 | if (position == -1) /* not found */ |
| 335 | return -1; |
| 336 | |
| 337 | /* don't need to free the obj in acl_array_delete_idx */ |
| 338 | a->items[idx] = NULL; |
| 339 | ret = acl_array_delete_idx(a, position, NULL); |
| 340 | if (ret < 0) |
| 341 | return -1; |
| 342 | return ret; |
| 343 | } |
| 344 | |
| 345 | int acl_array_delete_range(ACL_ARRAY *a, int ibegin, int iend, |
| 346 | void (*free_fn)(void*)) |
no test coverage detected
searching dependent graphs…