Add initialization and cleanup functions
This commit is contained in:
parent
237a676351
commit
ee7886b3a4
1 changed files with 19 additions and 0 deletions
19
src/ordinary.c
Normal file
19
src/ordinary.c
Normal file
|
@ -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 a new issue