aklog-20040412
[openafs.git] / src / WINNT / aklog / linked_list.h
1 /* $Id$ */
2
3 /* Copyright 1990, 1991, 1999 by the Massachusetts Institute of
4  * Technology.
5  *
6  * Permission to use, copy, modify, and distribute this
7  * software and its documentation for any purpose and without
8  * fee is hereby granted, provided that the above copyright
9  * notice appear in all copies and that both that copyright
10  * notice and this permission notice appear in supporting
11  * documentation, and that the name of M.I.T. not be used in
12  * advertising or publicity pertaining to distribution of the
13  * software without specific, written prior permission.
14  * M.I.T. makes no representations about the suitability of
15  * this software for any purpose.  It is provided "as is"
16  * without express or implied warranty.
17  */
18
19 #ifndef AKLOG__LINKED_LIST_H
20 #define AKLOG__LINKED_LIST_H
21
22 #define LL_SUCCESS 0
23 #define LL_FAILURE -1
24
25 typedef struct _ll_node {
26     struct _ll_node *prev;
27     struct _ll_node *next;
28     void *data;
29 } ll_node;
30
31 typedef struct {
32     ll_node *first;
33     ll_node *last;
34     int nelements;
35 } linked_list;
36
37 typedef enum {ll_head, ll_tail} ll_end;
38
39
40 /* ll_add_data just assigns the data field of node to be d. */
41 #define ll_add_data(n,d) (((n)->data)=(d))
42
43 void ll_init(linked_list *list);
44 ll_node *ll_add_node(linked_list *list, ll_end which_end);
45 int ll_delete_node(linked_list *list, ll_node *node);
46 int ll_string_check(linked_list *, char *);
47 int ll_add_string(linked_list *, char *);
48
49 #endif /* AKLOG__LINKED_LIST_H */