Main Page | Modules | Class List | Directories | File List | Class Members | File Members | Related Pages

my_list.h

Go to the documentation of this file.
00001 /* Copyright (C) 2000 MySQL AB
00002 
00003    This program is free software; you can redistribute it and/or modify
00004    it under the terms of the GNU General Public License as published by
00005    the Free Software Foundation; either version 2 of the License, or
00006    (at your option) any later version.
00007 
00008    This program is distributed in the hope that it will be useful,
00009    but WITHOUT ANY WARRANTY; without even the implied warranty of
00010    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00011    GNU General Public License for more details.
00012 
00013    You should have received a copy of the GNU General Public License
00014    along with this program; if not, write to the Free Software
00015    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
00016 
00017 #ifndef _list_h_
00018 #define _list_h_
00019 
00020 #ifdef  __cplusplus
00021 extern "C" {
00022 #endif
00023 
00024 typedef struct st_list {
00025   struct st_list *prev,*next;
00026   void *data;
00027 } LIST;
00028 
00029 typedef int (*list_walk_action)(void *,void *);
00030 
00031 extern LIST *list_add(LIST *root,LIST *element);
00032 extern LIST *list_delete(LIST *root,LIST *element);
00033 extern LIST *list_cons(void *data,LIST *root);
00034 extern LIST *list_reverse(LIST *root);
00035 extern void list_free(LIST *root,unsigned int free_data);
00036 extern unsigned int list_length(LIST *);
00037 extern int list_walk(LIST *,list_walk_action action,gptr argument);
00038 
00039 #define rest(a) ((a)->next)
00040 #define list_push(a,b) (a)=list_cons((b),(a))
00041 #define list_pop(A) {LIST *old=(A); (A)=list_delete(old,old) ; my_free((gptr) old,MYF(MY_FAE)); }
00042 
00043 #ifdef  __cplusplus
00044 }
00045 #endif
00046 #endif

Generated on Sun May 14 14:51:19 2006 by  doxygen 1.4.2