1 struct item 2 { 3 void *data; 4 struct item *prev; 5 struct item *next; 6 }; 7 8 /* 9 * Create space for a new item and add it to the head of mainlist. 10 * 11 * Returns item or NULL if out of memory. 12 */ 13 struct item *additem(struct item **mainlist); 14 15 /* 16 * Delete item from list mainlist. 17 */ 18 void delitem(struct item **mainlist, struct item *item); 19 20 /* 21 * Free any data in current item and then delete item. Optionally 22 * update number of items in list if stored != NULL. 23 */ 24 void freeitem(struct item **list, int *stored, 25 struct item *item); 26 27 /* 28 * Delete all items in list. Optionally update number of items in list 29 * if stored != NULL. 30 */ 31 void delallitems(struct item **list, int *stored); 32 33 /* 34 * Print all items in mainlist on stdout. 35 */ 36 void listitems(struct item *mainlist); 37