1
by brian
clean slate |
1 |
/* Copyright (C) 2000 MySQL AB
|
2 |
||
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.
|
|
6 |
||
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.
|
|
11 |
||
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 */
|
|
15 |
||
16 |
#ifndef _list_h_
|
|
17 |
#define _list_h_
|
|
18 |
||
19 |
#ifdef __cplusplus
|
|
20 |
extern "C" { |
|
21 |
#endif
|
|
22 |
||
23 |
typedef struct st_list { |
|
24 |
struct st_list *prev,*next; |
|
25 |
void *data; |
|
26 |
} LIST; |
|
27 |
||
28 |
typedef int (*list_walk_action)(void *,void *); |
|
29 |
||
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 int list_walk(LIST *,list_walk_action action,unsigned char * argument); |
|
36 |
||
37 |
#define list_rest(a) ((a)->next)
|
|
38 |
#define list_push(a,b) (a)=list_cons((b),(a))
|
|
477
by Monty Taylor
Removed my_free(). It turns out that it had been def'd to ignore the flags passed to it in the second arg anyway. Gotta love that. |
39 |
#define list_pop(A) {LIST *old=(A); (A)=list_delete(old,old) ; free((unsigned char *) old); }
|
1
by brian
clean slate |
40 |
|
41 |
#ifdef __cplusplus
|
|
42 |
}
|
|
43 |
#endif
|
|
44 |
#endif
|