diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2024-03-12 21:09:42 +0100 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2024-03-12 21:27:37 +0100 |
commit | 24c4029c96fa04b3cb4f90fbb36dc5248dd39810 (patch) | |
tree | ca51727f97207117f335f0309c063ffd2f168f2d /src/core/core-arraylist.h | |
parent | bb346f8c6c62655a6ef8fe4bc848d179258ce008 (diff) | |
download | weechat-24c4029c96fa04b3cb4f90fbb36dc5248dd39810.zip |
core: remove "wee-" prefix from source files in src/core and src/core/hook
Diffstat (limited to 'src/core/core-arraylist.h')
-rw-r--r-- | src/core/core-arraylist.h | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/src/core/core-arraylist.h b/src/core/core-arraylist.h new file mode 100644 index 000000000..d8a6d3214 --- /dev/null +++ b/src/core/core-arraylist.h @@ -0,0 +1,64 @@ +/* + * Copyright (C) 2014-2024 Sébastien Helleu <flashcode@flashtux.org> + * + * This file is part of WeeChat, the extensible chat client. + * + * WeeChat is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * WeeChat is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with WeeChat. If not, see <https://www.gnu.org/licenses/>. + */ + +#ifndef WEECHAT_ARRAYLIST_H +#define WEECHAT_ARRAYLIST_H + +struct t_arraylist; + +typedef int (t_arraylist_cmp)(void *data, struct t_arraylist *arraylist, + void *pointer1, void *pointer2); +typedef void (t_arraylist_free)(void *data, struct t_arraylist *arraylist, + void *pointer); + +struct t_arraylist +{ + int size; /* number of items in data */ + int size_alloc; /* number of allocated items */ + int size_alloc_min; /* min number of allocated items */ + int sorted; /* 1 if the arraylist is sorted */ + int allow_duplicates; /* 1 if duplicates are allowed */ + void **data; /* pointers to data */ + t_arraylist_cmp *callback_cmp; /* compare two elements */ + void *callback_cmp_data; /* data for compare callback */ + t_arraylist_free *callback_free; /* free an element */ + void *callback_free_data; /* data for free callback */ +}; + +extern struct t_arraylist *arraylist_new (int initial_size, + int sorted, + int allow_duplicates, + t_arraylist_cmp *callback_cmp, + void *callback_cmp_data, + t_arraylist_free *callback_free, + void *callback_free_data); +extern int arraylist_size (struct t_arraylist *arraylist); +extern void *arraylist_get (struct t_arraylist *arraylist, int index); +extern void *arraylist_search (struct t_arraylist *arraylist, void *pointer, + int *index, int *index_insert); +extern int arraylist_insert (struct t_arraylist *arraylist, int index, + void *pointer); +extern int arraylist_add (struct t_arraylist *arraylist, void *pointer); +extern int arraylist_remove (struct t_arraylist *arraylist, int index); +extern int arraylist_clear (struct t_arraylist *arraylist); +extern void arraylist_free (struct t_arraylist *arraylist); +extern void arraylist_print_log (struct t_arraylist *arraylist, + const char *name); + +#endif /* WEECHAT_ARRAYLIST_H */ |