3 Revision 1.2 2000/10/10 08:50:01 ivo
4 some annotation for lclint
6 Revision 1.1 1997/08/04 21:05:32 walter
14 /*---------------------- Macros and type definitions ----------------------*/
16 typedef struct LST_BUCKET {
17 struct LST_BUCKET *next;
22 int count; /* Number of elements currently in list */
23 LST_BUCKET *head; /* Pointer to head element of list */
24 LST_BUCKET *z; /* Pointer to last node of list */
25 LST_BUCKET hz[2]; /* Space for head and z nodes */
29 /* Return a pointer to the user space given the address of the header of
33 #define LST_USERSPACE(h) ((void*)((LST_BUCKET*)(h) + 1))
35 /* Return a pointer to the header of a node, given the address of the
39 #define LST_HEADER(n) ((LST_BUCKET*)(n) - 1)
41 /* Return a pointer to the user space of the list's head node. This user
42 * space does not actually exist, but it is useful to be able to address
43 * it to enable insertion at the start of the list.
46 #define LST_HEAD(l) LST_USERSPACE((l)->head)
48 /* Determine if a list is empty
51 #define LST_EMPTY(l) ((l)->count == 0)
53 /*-------------------------- Function Prototypes --------------------------*/
55 /*@only@*//*@out@*/ void *lst_newnode (int size);
56 void lst_freenode (/*@only@*/ void *node);
57 /*@only@*//*@out@*/ LIST *lst_init (void);
58 void lst_kill (LIST * l, void (*freeNode) ());
59 void lst_insertafter (LIST * l, /*@keep@*/ void *node, void *after);
60 void *lst_deletenext (/*@only@*/ LIST * l, void *node);
61 /*@dependent@*/ void *lst_first (LIST * l);
62 /*@dependent@*/ void *lst_next (void *prev);
63 void lst_mergesort (LIST * l, int (*cmp_func) ());