Fix some faults.

This commit is contained in:
Saturneric 2018-02-08 10:37:44 +08:00
parent 23db1b897c
commit 656658a0ef

View File

@ -1,15 +1,15 @@
typedef struct Node{ typedef struct Node{
unsigned long int id;//what's this? unsigned long int id;
void *value; void *value;
Node *next; struct Node *next;
Node *last; struct Node *last;
}; }Node;
typedef struct List{ typedef struct List{
Node *head; Node *head;
Node *tail; Node *tail;
unsigned long int length; unsigned long int length;
}; }List;
List *init_list(); List *init_list();
Node *init_node(); Node *init_node();
@ -29,6 +29,7 @@ int insertInHead(List *p_list, Node *p_node){
//p_node->last = NULL; //p_node->last = NULL;
p_node->next = p_list->head; p_node->next = p_list->head;
p_list->head = p_node; p_list->head = p_node;
return 0;
} }
int insertInTail(List *p_list, Node *p_node){ int insertInTail(List *p_list, Node *p_node){
@ -36,4 +37,5 @@ int insertInTail(List *p_list, Node *p_node){
//p_node->next = NULL; //p_node->next = NULL;
p_node->last = p_list->tail; p_node->last = p_list->tail;
p_list->tail = p_node; p_list->tail = p_node;
return 0;
} }