X-Git-Url: http://pileus.org/git/?a=blobdiff_plain;f=util.c;h=a91d1bdc329d151ee9dad33ec7c1df34fd15c3ee;hb=c8fbd497f0c6b24ece62a771b238666b87c69261;hp=24100f2243d6576d8481109a17a43c614d4a7c1a;hpb=5dd54ab27b27c888741e5700aad89226009eb449;p=wmpus diff --git a/util.c b/util.c index 24100f2..a91d1bd 100644 --- a/util.c +++ b/util.c @@ -15,6 +15,18 @@ list_t *list_insert(list_t *next, void *data) return node; } +void list_insert_after(list_t *prev, void *data) +{ + // prev must be valid, + // as we cannot return the original list head + list_t *node = new0(list_t); + node->data = data; + node->prev = prev; + node->next = prev->next; + prev->next = node; + if (node->next) node->next->prev = node; +} + list_t *list_append(list_t *head, void *data) { list_t *last = head;