root/trunk/dep/include/mysql/my_list.h

Revision 2, 1.4 kB (checked in by yumileroy, 17 years ago)

[svn] * Proper SVN structure

Original author: Neo2003
Date: 2008-10-02 16:23:55-05:00

Line 
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
20extern "C" {
21#endif
22
23typedef struct st_list {
24  struct st_list *prev,*next;
25  void *data;
26} LIST;
27
28typedef int (*list_walk_action)(void *,void *);
29
30extern LIST *list_add(LIST *root,LIST *element);
31extern LIST *list_delete(LIST *root,LIST *element);
32extern LIST *list_cons(void *data,LIST *root);
33extern LIST *list_reverse(LIST *root);
34extern void list_free(LIST *root,unsigned int free_data);
35extern unsigned int list_length(LIST *);
36extern int list_walk(LIST *,list_walk_action action,gptr 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((gptr) old,MYF(MY_FAE)); }
41
42#ifdef  __cplusplus
43}
44#endif
45#endif
Note: See TracBrowser for help on using the browser.