ListDelete
Description
Delete the element at idx.
Parameters
| Name | Direction | Description |
|---|---|---|
l |
in,out | List handle. |
idx |
in | Position in [0, length). |
Success
Returns to the caller. The node at idx is unlinked and freed; list length shrinks by one. When copy_deinit is configured it is invoked on the dropped element.
Failure
Function cannot fail. An out-of-range idx is a caller bug and aborts via LOG_FATAL.
Usage example (Cross-references)
Usage examples (Cross-references)
- In
ListInt.c:86:
uint16_t idx = extract_u16(data, offset, data_size);
if (idx < ListLen(list)) {
ListDelete(list, idx);
}
break;- In
List.Remove.c:97:
result = result && list_matches(GENERIC_LIST(&list), (const int[]) {1, 2, 5, 6}, 4);
ListDelete(&list, 1);
result = result && list_matches(GENERIC_LIST(&list), (const int[]) {1, 5, 6}, 3); result = result && list_matches(GENERIC_LIST(&list), (const int[]) {8, 9}, 2);
ListDelete(&list, 0);
result = result && (g_copy_deinit_count == 1);
result = result && list_matches(GENERIC_LIST(&list), (const int[]) {9}, 1);
Last updated on