Function darray_remove
Defined in File darray.h
Function Documentation
-
status_t darray_remove(struct darray *arr, void *e, size_t index)
Remove an item from an darray.
If RCSW_DS_SORTED was passed during initialization, then the remaining elements in the list are shifted to close the empty slot and preserve the sort order (inefficient). If RCSW_DS_SORTED was not passed during initialization, then the last element in the array is simply used to overwrite the element to be removed, which is a much faster operation.
If the darray was initialized with an unlimited capacity, then the darray is shrunk to 1/2 its current size whenever the current deletion brought its utilization down at or below 25% (for amortized O(1) deletions).
- Parameters:
arr – The darray handle
e – To be filled with the removed element if non-NULL
index – The index of the element to remove
- Returns: