X-Git-Url: https://tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Flist.c;h=9b67791120c3746decab18d0d620aaacc954fd05;hb=80ca91769d48e546d3e4cde03c2eb2820c03acc4;hp=9d4920b70a075c0b257c622aeb24f87b277791ff;hpb=311f60f4f0bdf974d4890d7eb4a752299d1c9458;p=tinc diff --git a/src/list.c b/src/list.c index 9d4920b7..9b677911 100644 --- a/src/list.c +++ b/src/list.c @@ -111,6 +111,26 @@ list_node_t *list_insert_after(list_t *list, list_node_t *after, void *data) { return node; } +list_node_t *list_insert_before(list_t *list, list_node_t *before, void *data) { + list_node_t *node; + + node = list_alloc_node(); + + node->data = data; + node->next = before; + node->prev = before->prev; + before->prev = node; + + if(node->prev) + node->prev->next = node; + else + list->head = node; + + list->count++; + + return node; +} + void list_unlink_node(list_t *list, list_node_t *node) { if(node->prev) node->prev->next = node->next;