diff options
Diffstat (limited to 'common/list.c')
-rw-r--r-- | common/list.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/common/list.c b/common/list.c index 42d377b7..a887bcdd 100644 --- a/common/list.c +++ b/common/list.c @@ -55,6 +55,21 @@ struct slist *slist_append(struct slist *list, void *data) return list; } +struct slist *slist_prepend(struct slist *list, void *data) +{ + struct slist *entry; + + entry = malloc(sizeof(struct slist)); + /* FIXME: this currently just silently fails */ + if (!entry) + return list; + + entry->data = data; + entry->next = list; + + return entry; +} + struct slist *slist_remove(struct slist *list, void *data) { struct slist *l, *next, *prev = NULL, *match = NULL; |