10 list
* make_new(list
* next
, void* item
){
14 ptr
= malloc(sizeof(struct list
));
26 void remove_from_list(list
* prev
, list
* node
){
27 prev
->next
= node
->next
;
29 node
->next
= freelist
;
35 return make_new(NULL
, NULL
);
38 void push(list
* L
, void* item
){
39 list
* ptr
= make_new(L
->next
, item
);
44 void* item
= L
->next
->item
;
45 remove_from_list(L
, L
->next
);
49 void append(list
* L
, void* item
){
54 ptr
->next
= make_new(NULL
, item
);
57 void recycle(list
* L
){
60 ptr
->next
->item
= NULL
;
71 void print_list(list
* L
, void (*print
)(void* item
)){
83 void println_list(list
* L
, void (*print
)(void* item
)){
88 void list_print_free(){
101 void print(void* item
){
106 void list_sanitytest(){
110 println_list(L
, print
);
112 printf("push a b c: ");
116 println_list(L
, print
);
121 println_list(L
, print
);
123 printf("freelist: ");
129 println_list(L
, print
);
131 printf("freelist: ");
134 printf("append a b c: ");
138 println_list(L
, print
);
140 printf("freelist: ");