ListRemove
- Macro
- October 8, 2025
Table of Contents
ListRemove
ListRemoveDescription
Remove item from list at given index and store in given pointer. Order of elements is guaranteed to be preserved.
Parameters
| Name | Direction | Description |
|---|---|---|
l | in,out | List to remove item from. |
val | out | Where removed item will be stored. If not provided then it’s equivalent to deleting the item at specified index. |
idx | in | Index in list to remove item from. |
Success
Returns v on success.
Failure
Returns NULL otherwise.
Usage example (Cross-references)
- In
Remove.h:35:
/// FAILURE : Returns `NULL` otherwise.
///
#define ListPopFront(l, val) ListRemove((l), (val), 0);
///
- In
Remove.h:48:
/// FAILURE : Returns NULL otherwise.
///
#define ListPopBack(l, val) ListRemove((l), (val), ((l) ? (l)->length - 1 : (size_t)-1));
///
- In
Remove.h:74:
/// Delete item at given index
///
#define ListDelete(l, idx) ListRemove((l), NULL, (idx))
///
- In
ListInt.c:71:
if (idx < list->length) {
i32 removed;
ListRemove(list, &removed, idx);
}
break;