29 lines
		
	
	
		
			626 B
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			29 lines
		
	
	
		
			626 B
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
|   if (!list || !node || !(node->item)) {{
 | |
|     return;
 | |
|   }}
 | |
| 
 | |
|   if (index == 0) {{
 | |
|     wapp_{Tlower}_list_push_front(list, node);
 | |
|     return;
 | |
|   }} else if (index == list->node_count) {{
 | |
|     wapp_{Tlower}_list_push_back(list, node);
 | |
|     return;
 | |
|   }}
 | |
| 
 | |
|   {NodeType} *dst_node = wapp_{Tlower}_list_get(list, index);
 | |
|   if (!dst_node) {{
 | |
|     return;
 | |
|   }}
 | |
| 
 | |
|   {ListType} node_list = {Tlower}_node_to_list(node);
 | |
| 
 | |
|   list->node_count += node_list.node_count;
 | |
| 
 | |
|   {NodeType} *prev = dst_node->prev;
 | |
| 
 | |
|   dst_node->prev = node_list.last;
 | |
|   prev->next     = node_list.first;
 | |
| 
 | |
|   node_list.first->prev = prev;
 | |
|   node_list.last->next  = dst_node;
 |