X-Git-Url: http://pileus.org/git/?a=blobdiff_plain;f=util.c;fp=util.c;h=2099953ddce60d2832e9fe7f6c814e82e4ebfed9;hb=affe32b94267ef0c1f38a7954bee255a55350cbb;hp=98c40c68a13e89d317992678da38c8361a617ea9;hpb=ee556f1413d9da165fd6ea74f0bf4039ab28da0d;p=wmpus diff --git a/util.c b/util.c index 98c40c6..2099953 100644 --- a/util.c +++ b/util.c @@ -14,6 +14,18 @@ list_t *list_insert(list_t *next, void *data) return node; } +list_t *list_append(list_t *head, void *data) +{ + list_t *last = head; + while (last->next) + last = last->next; + list_t *node = new0(list_t); + node->data = data; + node->prev = last; + if (last) last->next = node; + return last ? head : node; +} + list_t *list_remove(list_t *head, list_t *node) { list_t *next = node->next;