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
);
45 void* item
= L
->next
->item
;
46 remove_from_list(L
, L
->next
);
54 void append(list
* L
, void* item
){
59 ptr
->next
= make_new(NULL
, item
);
62 void recycle(list
* L
){
65 ptr
->next
->item
= NULL
;
76 void print_list(list
* L
, void (*print
)(void* item
)){
88 void println_list(list
* L
, void (*print
)(void* item
)){
93 void list_print_free(){
106 void print(void* item
){
111 void list_sanitytest(){
115 println_list(L
, print
);
117 printf("push a b c: ");
121 println_list(L
, print
);
126 println_list(L
, print
);
128 printf("freelist: ");
134 println_list(L
, print
);
136 printf("freelist: ");
139 printf("append a b c: ");
143 println_list(L
, print
);
145 printf("freelist: ");