2 * yahoo_list.h: linked list routines
4 * Some code copyright (C) 2002-2004, Philip S Tellis <philip.tellis AT gmx.net>
5 * Other code copyright Meredydd Luff <meredydd AT everybuddy.com>
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 * This is a replacement for the GList. It only provides functions that
25 * we use in Ayttm. Thanks to Meredyyd from everybuddy dev for doing
36 typedef struct _YList
{
42 typedef int (*YListCompFunc
) (const void *, const void *);
43 typedef void (*YListFunc
) (void *, void *);
45 YList
*y_list_append(YList
* list
, void *data
);
46 YList
*y_list_prepend(YList
* list
, void *data
);
47 YList
*y_list_remove_link(YList
* list
, const YList
* link
);
48 YList
*y_list_remove(YList
* list
, void *data
);
50 YList
*y_list_insert_sorted(YList
* list
, void * data
, YListCompFunc comp
);
52 YList
*y_list_copy(YList
* list
);
54 YList
*y_list_concat(YList
* list
, YList
* add
);
56 YList
*y_list_find(YList
* list
, const void *data
);
57 YList
*y_list_find_custom(YList
* list
, const void *data
, YListCompFunc comp
);
59 YList
*y_list_nth(YList
* list
, int n
);
61 void y_list_foreach(YList
* list
, YListFunc fn
, void *user_data
);
63 void y_list_free_1(YList
* list
);
64 void y_list_free(YList
* list
);
65 int y_list_length(const YList
* list
);
66 int y_list_empty(const YList
* list
);
67 int y_list_singleton(const YList
* list
);
69 #define y_list_next(list) list->next