2 * Copyright (C) 2006-2009 Stig Venaas <venaas@uninett.no>
4 * Permission to use, copy, modify, and distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
10 #include <sys/inttypes.h>
15 #if defined (__cplusplus)
20 struct list_node *next;
25 struct list_node *first, *last;
29 /* allocates and initialises list structure; returns NULL if malloc fails */
30 struct list *list_create();
32 /* frees all memory associated with the list */
33 void list_destroy(struct list *list);
35 /* appends entry to list; returns 1 if ok, 0 if malloc fails */
36 int list_push(struct list *list, void *data);
38 /* removes first entry from list and returns data */
39 void *list_shift(struct list *list);
41 /* removes first entry with matching data pointer */
42 void list_removedata(struct list *list, void *data);
44 /* returns first node */
45 struct list_node *list_first(struct list *list);
47 /* returns the next node after the argument */
48 struct list_node *list_next(struct list_node *node);
50 /* returns number of nodes */
51 uint32_t list_count(struct list *list);
53 #if defined (__cplusplus)
57 /* Local Variables: */
58 /* c-file-style: "stroustrup" */