X-Git-Url: https://www.tinc-vpn.org/git/browse?p=tinc;a=blobdiff_plain;f=lib%2Flist.c;h=cb2d4d2104a2630c2a2e8209f6cac72bb8be9746;hp=bcee38586a032bcc15e739b9bf12e26131dbe6c7;hb=7608136a8dae24f2df30eac8644efd0d7cd57dc9;hpb=d3f889c8076dff9c00ebfe1459cb36425f8da41d diff --git a/lib/list.c b/lib/list.c index bcee3858..cb2d4d21 100644 --- a/lib/list.c +++ b/lib/list.c @@ -17,7 +17,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id: list.c,v 1.1.2.8 2001/01/07 17:08:49 guus Exp $ + $Id: list.c,v 1.1.2.10 2002/03/27 15:01:16 guus Exp $ */ #include "config.h" @@ -60,7 +60,7 @@ void list_free_node(list_t *list, list_node_t *node) if(node->data && list->delete) list->delete(node->data); - free(node->data); + free(node); } /* Insertion and deletion */ @@ -81,6 +81,8 @@ list_node_t *list_insert_head(list_t *list, void *data) else list->tail = node; + list->count++; + return node; } @@ -100,6 +102,8 @@ list_node_t *list_insert_tail(list_t *list, void *data) else list->head = node; + list->count++; + return node; } @@ -114,6 +118,8 @@ void list_unlink_node(list_t *list, list_node_t *node) node->next->prev = node->prev; else list->tail = node->prev; + + list->count--; } void list_delete_node(list_t *list, list_node_t *node)