Add initialization and cleanup functions
This commit is contained in:
parent
237a676351
commit
ee7886b3a4
|
@ -0,0 +1,19 @@
|
|||
#include <ordinary.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
void ordinary_list_new(struct ordinary_list *list, uint32_t limit) {
|
||||
list->head = NULL;
|
||||
list->tail = NULL;
|
||||
list->count = 0;
|
||||
list->limit = limit;
|
||||
}
|
||||
|
||||
void ordinary_list_del(struct ordinary_list *list) {
|
||||
struct ordinary_node *at = list->head;
|
||||
|
||||
while(at) {
|
||||
struct ordinary_node *next = at->next;
|
||||
free(at);
|
||||
at = next;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue