Add code generation for doubly linked list
This commit is contained in:
21
codegen/dbl_list/snippets/list_pop_front
Normal file
21
codegen/dbl_list/snippets/list_pop_front
Normal file
@@ -0,0 +1,21 @@
|
||||
{T}Node *output = NULL;
|
||||
|
||||
if (!list || list->node_count == 0) {{
|
||||
goto RETURN_{Tupper}_LIST_POP_FRONT;
|
||||
}}
|
||||
|
||||
output = list->first;
|
||||
|
||||
if (list->node_count == 1) {{
|
||||
*list = ({T}List){{0}};
|
||||
goto RETURN_{Tupper}_LIST_POP_FRONT;
|
||||
}}
|
||||
|
||||
--(list->node_count);
|
||||
list->total_size -= output->string->size;
|
||||
list->first = output->next;
|
||||
|
||||
output->prev = output->next = NULL;
|
||||
|
||||
RETURN_{Tupper}_LIST_POP_FRONT:
|
||||
return output;
|
Reference in New Issue
Block a user