00001 #ifndef _LLIST_H_ 00002 #define _LLIST_H_ 00003 00004 #define llhooktail(node, list){\ 00005 node->previous = list.tail;\ 00006 node->next = NULL;\ 00007 list.size++;\ 00008 if(list.head == NULL){\ 00009 list.head = node; \ 00010 list.tail = node;\ 00011 return node;\ 00012 }\ 00013 list.tail->next = node;\ 00014 list.tail = node;}; 00015 00016 #define llcut(node,list){\ 00017 if(node==list.head){\ 00018 list.head = node->next;\ 00019 if(list.head!=NULL)\ 00020 list.head->previous = NULL;\ 00021 }\ 00022 else{\ 00023 if(node==list.tail){\ 00024 list.tail = node->previous;\ 00025 if(list.tail!=NULL)\ 00026 list.tail->next = NULL;\ 00027 }\ 00028 else{\ 00029 node->next->previous = node->previous;\ 00030 node->previous->next = node->next;\ 00031 }\ 00032 }\ 00033 list.size--;}; 00034 00035 #endif //_LLIST_H_