Add code generation for doubly linked list
This commit is contained in:
21
codegen/dbl_list/snippets/list_push_back
Normal file
21
codegen/dbl_list/snippets/list_push_back
Normal file
@@ -0,0 +1,21 @@
|
||||
if (!list || !node || !(node->string)) {{
|
||||
return;
|
||||
}}
|
||||
|
||||
{T}List node_list = {Tlower}_node_to_list(node);
|
||||
|
||||
if (list->node_count == 0) {{
|
||||
*list = node_list;
|
||||
return;
|
||||
}}
|
||||
|
||||
list->total_size += node_list.total_size;
|
||||
list->node_count += node_list.node_count;
|
||||
|
||||
{T}Node *last = list->last;
|
||||
if (last) {{
|
||||
last->next = node_list.first;
|
||||
}}
|
||||
|
||||
list->last = node_list.last;
|
||||
node_list.first->prev = last;
|
Reference in New Issue
Block a user