dl_delete()
#
Removes a specified item from a doubly linked list and optionally frees its memory.
Prototype
int dl_delete(
dl_list_t *dl,
void *curr_,
void (*fnfree)(void *)
);
Parameters
Key |
Type |
Description |
---|---|---|
|
|
Pointer to the doubly linked list from which the item will be removed. |
|
|
Pointer to the item to be removed from the list. |
|
|
Optional function pointer to free the memory of the removed item. |
Return Value
Returns 0 on success, or -1 if an error occurs (e.g., null item, empty list, or item not found).
Notes
The function ensures that the list remains consistent after deletion. If fnfree
is provided, it is called to free the memory of the removed item.
Prototype
// Not applicable in JS
Prototype
# Not applicable in Python
Examples
// TODO C examples
// TODO JS examples
# TODO Python examples