[b7d3cc34] | 1 | /* |
---|
| 2 | * yahoo_list.h: linked list routines |
---|
| 3 | * |
---|
| 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> |
---|
| 6 | * |
---|
| 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. |
---|
| 11 | * |
---|
| 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. |
---|
| 16 | * |
---|
| 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 |
---|
| 20 | * |
---|
| 21 | */ |
---|
| 22 | |
---|
| 23 | /* |
---|
| 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 |
---|
| 26 | * most of it. |
---|
| 27 | */ |
---|
| 28 | |
---|
| 29 | #ifndef __YLIST_H__ |
---|
| 30 | #define __YLIST_H__ |
---|
| 31 | |
---|
| 32 | #ifdef __cplusplus |
---|
| 33 | extern "C" { |
---|
| 34 | #endif |
---|
| 35 | |
---|
| 36 | typedef struct _YList { |
---|
| 37 | struct _YList *next; |
---|
| 38 | struct _YList *prev; |
---|
| 39 | void *data; |
---|
| 40 | } YList; |
---|
| 41 | |
---|
| 42 | typedef int (*YListCompFunc) (const void *, const void *); |
---|
| 43 | typedef void (*YListFunc) (void *, void *); |
---|
| 44 | |
---|
| 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); |
---|
| 49 | |
---|
| 50 | YList *y_list_insert_sorted(YList * list, void * data, YListCompFunc comp); |
---|
| 51 | |
---|
| 52 | YList *y_list_copy(YList * list); |
---|
| 53 | |
---|
| 54 | YList *y_list_concat(YList * list, YList * add); |
---|
| 55 | |
---|
| 56 | YList *y_list_find(YList * list, const void *data); |
---|
| 57 | YList *y_list_find_custom(YList * list, const void *data, YListCompFunc comp); |
---|
| 58 | |
---|
| 59 | YList *y_list_nth(YList * list, int n); |
---|
| 60 | |
---|
| 61 | void y_list_foreach(YList * list, YListFunc fn, void *user_data); |
---|
| 62 | |
---|
| 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); |
---|
| 68 | |
---|
| 69 | #define y_list_next(list) list->next |
---|
| 70 | |
---|
| 71 | #ifdef __cplusplus |
---|
| 72 | } |
---|
| 73 | #endif |
---|
| 74 | #endif |
---|