Files
wizapp-stdlib/codegen/dbl_list/snippets/list_pop_back
2025-05-05 19:55:42 +01:00

23 lines
407 B
Plaintext

assert(list != NULL);
{NodeType} *output = NULL;
if (list->node_count == 0) {{
goto RETURN_{Tupper}_LIST_POP_BACK;
}}
output = list->last;
if (list->node_count == 1) {{
*list = ({ListType}){{0}};
goto RETURN_{Tupper}_LIST_POP_BACK;
}}
--(list->node_count);
list->last = output->prev;
output->prev = output->next = NULL;
RETURN_{Tupper}_LIST_POP_BACK:
return output;