MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
my_list.h
1 /* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 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 unsigned int list_length(LIST *);
36 extern int list_walk(LIST *,list_walk_action action,unsigned char * argument);
37 
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(old); }
41 
42 #ifdef __cplusplus
43 }
44 #endif
45 #endif