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
);
55 void append(list
* L
, void* item
){
60 ptr
->next
= make_new(NULL
, item
);
63 void recycle(list
* L
){
66 ptr
->next
->item
= NULL
;
77 void print_list(list
* L
, void (*print
)(void* item
)){
89 void println_list(list
* L
, void (*print
)(void* item
)){
94 void list_print_free(){
107 void print(void* item
){
112 void list_sanitytest(){
116 println_list(L
, print
);
118 printf("push a b c: ");
122 println_list(L
, print
);
127 println_list(L
, print
);
129 printf("freelist: ");
135 println_list(L
, print
);
137 printf("freelist: ");
140 printf("append a b c: ");
144 println_list(L
, print
);
146 printf("freelist: ");