1 /* Copyright (C) 2000 MySQL AB
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; version 2 of the License.
7 This program is distributed in the hope that it will be useful,
8 but WITHOUT ANY WARRANTY; without even the implied warranty of
9 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 GNU General Public License for more details.
12 You should have received a copy of the GNU General Public License
13 along with this program; if not, write to the Free Software
14 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
23 typedef struct st_list
{
24 struct st_list
*prev
,*next
;
28 typedef int (*list_walk_action
)(void *,void *);
30 extern LIST
*list_add(LIST
*root
,LIST
*element
);
31 extern LIST
*list_delete(LIST
*root
,LIST
*element
);
32 extern LIST
*list_cons(void *data
,LIST
*root
);
33 extern LIST
*list_reverse(LIST
*root
);
34 extern void list_free(LIST
*root
,unsigned int free_data
);
35 extern unsigned int list_length(LIST
*);
36 extern int list_walk(LIST
*,list_walk_action action
,gptr argument
);
38 #define list_rest(a) ((a)->next)
39 #define list_push(a,b) (a)=list_cons((b),(a))
40 #define list_pop(A) {LIST *old=(A); (A)=list_delete(old,old) ; my_free((gptr) old,MYF(MY_FAE)); }