Use new github account
[oggfilter.git] / list.c
blob868d72fddb837d4bc9378942127b47807067d9ba
1 /*-
2 * "THE BEER-WARE LICENSE" (Revision 42):
3 * <tobias.rehbein@web.de> wrote this file. As long as you retain this notice
4 * you can do whatever you want with this stuff. If we meet some day, and you
5 * think this stuff is worth it, you can buy me a beer in return.
6 * Tobias Rehbein
7 */
9 #include <assert.h>
10 #include <stdlib.h>
12 #include "list.h"
14 struct element *
15 create_element(void *payload)
17 assert(payload != NULL);
19 struct element *new = malloc(sizeof(*new));
20 if (new != NULL) {
21 new->payload = payload;
22 new->next = NULL;
25 return (new);
28 struct element *
29 destroy_element(struct element *element)
31 assert(element !=NULL);
33 struct element *next = element->next;
34 free(element);
36 return (next);
40 struct element *
41 prepend_element(struct element *new, struct element *list)
43 assert(new != NULL);
45 new->next = list;
47 return (new);