+ if(list->tail)
+ return list->tail->data;
+ else
+ return NULL;
+}
+
+/* Fast list deletion */
+
+void list_delete_list(list_t *list)
+{
+ list_node_t *node, *next;
+
+ for(node = list->head; node; node = next) {
+ next = node->next;
+ list_free_node(list, node);
+ }
+
+ list_free(list);
+}
+
+/* Traversing */
+
+void list_foreach_node(list_t *list, list_action_node_t action)
+{
+ list_node_t *node, *next;
+
+ for(node = list->head; node; node = next) {
+ next = node->next;
+ action(node);
+ }
+}
+
+void list_foreach(list_t *list, list_action_t action)
+{
+ list_node_t *node, *next;
+
+ for(node = list->head; node; node = next) {
+ next = node->next;
+ if(node->data)
+ action(node->data);
+ }