1 /* 2 ** LIST: Simple doubly-linked list implementation. 3 ** Copyright (C) 2002 Michael W. Shaffer <mwshaffer@angrypot.com> 4 ** 5 ** 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 ** 10 ** 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 ** 15 ** You should have received a copy of the GNU General Public License 16 ** along with this program (see the file COPYING). If not, write to: 17 ** 18 ** The Free Software Foundation, Inc. 19 ** 59 Temple Place, Suite 330, 20 ** Boston, MA 02111-1307 USA 21 */ 22 23 #ifndef LIST_H 24 #define LIST_H 25 26 struct list_item { 27 long size; 28 void *data; 29 struct list_item *prev; 30 struct list_item *next; 31 struct list *list; 32 }; 33 34 struct list { 35 struct list_item *head; 36 }; 37 38 void list_init (struct list *list); 39 void list_free (struct list *list); 40 struct list_item *list_insert (struct list *list, void *data, long size); 41 struct list_item *list_search (struct list *list, void *data, long size); 42 void list_delete (struct list_item *item); 43 44 #endif /* LIST_H */ 45 46