wizapp-stdlib/codegen/dbl_list/snippets/list_pop_front
Abdelrahman Said 3c32b247c0 Upgrade codegen
2025-04-17 09:03:30 +01:00

21 lines
406 B
Plaintext

{Ttitle}Node *output = NULL;
if (!list || list->node_count == 0) {{
goto RETURN_{Tupper}_LIST_POP_FRONT;
}}
output = list->first;
if (list->node_count == 1) {{
*list = ({Ttitle}List){{0}};
goto RETURN_{Tupper}_LIST_POP_FRONT;
}}
--(list->node_count);
list->first = output->next;
output->prev = output->next = NULL;
RETURN_{Tupper}_LIST_POP_FRONT:
return output;