ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/hopm/trunk/src/list.h
Revision: 7005
Committed: Fri Jan 1 00:06:56 2016 UTC (9 years, 7 months ago) by michael
Content type: text/x-chdr
File size: 1681 byte(s)
Log Message:
- Update copyright years

File Contents

# User Rev Content
1 michael 5351 /*
2     * Copyright (c) 2002-2003 Erik Fears
3 michael 7005 * Copyright (c) 2014-2016 ircd-hybrid development team
4 michael 5052 *
5 michael 5351 * This program is free software; you can redistribute it and/or modify
6     * it under the terms of the GNU General Public License as published by
7     * the Free Software Foundation; either version 2 of the License, or
8     * (at your option) any later version.
9 michael 5052 *
10 michael 5351 * This program is distributed in the hope that it will be useful,
11     * but WITHOUT ANY WARRANTY; without even the implied warranty of
12     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13     * GNU General Public License for more details.
14 michael 5052 *
15 michael 5351 * You should have received a copy of the GNU General Public License
16     * along with this program; if not, write to the Free Software
17     * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
18     * USA
19 michael 5052 */
20    
21 michael 5351 #ifndef LIST_H
22     #define LIST_H
23    
24 michael 5052 #define LIST_FOREACH(pos, head) for (pos = (head); pos != NULL; pos = pos->next)
25     #define LIST_FOREACH_SAFE(pos, n, head) for (pos = (head), n = pos ? pos->next : NULL; pos != NULL; pos = n, n = pos ? pos->next : NULL)
26     #define LIST_FOREACH_PREV(pos, head) for (pos = (head); pos != NULL; pos = pos->prev)
27 michael 6175 #define LIST_SIZE(list) (list)->elements
28 michael 5052
29     typedef struct _node node_t;
30     typedef struct _list list_t;
31    
32     struct _list
33     {
34 michael 5704 struct _node *head;
35     struct _node *tail;
36     int elements;
37 michael 5052 };
38    
39     struct _node
40     {
41 michael 5704 struct _node *next;
42     struct _node *prev;
43     void *data;
44 michael 5052 };
45    
46 michael 5704 extern node_t *node_create(void *);
47     extern list_t *list_create(void);
48 michael 5052
49 michael 5704 extern node_t *list_add(list_t *, node_t *);
50     extern node_t *list_remove(list_t *, node_t *);
51 michael 5052
52 michael 5704 extern void list_free(list_t *);
53     extern void node_free(node_t *);
54 michael 5052 #endif /* LIST_H */

Properties

Name Value
svn:eol-style native
svn:keywords Id