-#ifdef L_llist_free_one
-/* Free the current list element and advance to the next entry in the list.
- * Returns a pointer to the next element. */
-extern llist_t *llist_free_one(llist_t *elm)
+/* Remove first element from the list and return it */
+void *llist_pop(llist_t **head)
+{
+ void *data;
+
+ if(!*head) data = *head;
+ else {
+ void *next = (*head)->link;
+ data = (*head)->data;
+ free(*head);
+ *head = next;
+ }
+
+ return data;
+}
+
+/* Recursively free all elements in the linked list. If freeit != NULL
+ * call it on each datum in the list */
+void llist_free(llist_t *elm, void (*freeit)(void *data))