#include "services.h"#include "slist.h"
Go to the source code of this file.
Functions | |
| int | slist_add (SList *slist, void *item) |
| void | slist_clear (SList *slist, int mustfree) |
| int | slist_delete (SList *slist, int index) |
| int | slist_delete_range (SList *slist, char *range, slist_delcheckcb_t cb,...) |
| int | slist_enum (SList *slist, char *range, slist_enumcb_t cb,...) |
| int | slist_full (SList *slist) |
| void | slist_init (SList *slist) |
| int | slist_indexof (SList *slist, void *item) |
| void | slist_pack (SList *slist) |
| int | slist_remove (SList *slist, void *item) |
| int | slist_setcapacity (SList *slist, int16 capacity) |
Variables | |
| static SListOpts | slist_defopts = { 0, NULL, NULL, NULL } |
| int slist_add | ( | SList * | slist, | |
| void * | item | |||
| ) |
Adds a pointer to the list. Returns the index of the new item. Returns -2 if there are too many items in the list, -3 if the item already exists when the flags of the list contain SLISTF_NODUP.
| slist | Slist Struct | |
| item | Item being added |
Definition at line 30 of file slist.c.
References slist_::capacity, slistopts_::compareitem, slist_::count, slistopts_::flags, slist_::limit, slist_::list, slist_::opts, slist_indexof(), slist_setcapacity(), SLISTF_NODUP, and SLISTF_SORT.
Referenced by add_akill(), add_sgline(), add_sqline(), add_szline(), db_mysql_load_ns_dbase(), db_mysql_load_os_dbase(), do_admin(), do_oper(), load_ns_dbase(), load_old_akill(), load_old_ns_dbase(), load_os_dbase(), makealias(), and makenick().
| void slist_clear | ( | SList * | slist, | |
| int | mustfree | |||
| ) |
Clears the list. If free is 1, the freeitem function will be called for each item before clearing.
| slist | Slist Struct | |
| mustfree | What is being freed |
Definition at line 71 of file slist.c.
References slist_::capacity, slist_::count, slistopts_::freeitem, slist_::list, and slist_::opts.
Referenced by do_admin(), do_akill(), do_oper(), do_sgline(), do_sqline(), and do_szline().
| int slist_delete | ( | SList * | slist, | |
| int | index | |||
| ) |
Deletes an item from the list, by index. Returns 1 if successful, 0 otherwise.
| slist | Slist Struct | |
| index | beign deleted |
Definition at line 98 of file slist.c.
References slist_::capacity, slist_::count, slistopts_::freeitem, slist_::list, slist_::opts, and slist_setcapacity().
Referenced by add_akill(), add_sgline(), add_sqline(), add_szline(), do_admin(), do_akill(), do_oper(), do_sgline(), do_sqline(), do_szline(), expire_akills(), expire_sglines(), expire_sqlines(), expire_szlines(), load_old_akill(), slist_pack(), and slist_remove().
| int slist_delete_range | ( | SList * | slist, | |
| char * | range, | |||
| slist_delcheckcb_t | cb, | |||
| ... | ||||
| ) |
Deletes a range of entries. Return -1 if the permission was denied, 0 if no records were deleted, or the number of records deleted
| slist | Slist Struct | |
| range | Range to delete | |
| cb | Call back function | |
| ... | various args |
Definition at line 130 of file slist.c.
References slist_::count, slistopts_::freeitem, slist_::list, slist_::opts, slist_pack(), and VA_COPY.
Referenced by do_admin(), do_akill(), do_oper(), do_sgline(), do_sqline(), and do_szline().
| int slist_enum | ( | SList * | slist, | |
| char * | range, | |||
| slist_enumcb_t | cb, | |||
| ... | ||||
| ) |
Enumerates all entries of the list. If range is not NULL, will only enumerate entries that are in the range. Returns the total number of entries enumerated.
| slit | Slist struct | |
| range | Range to enum | |
| cb | Call back function | |
| ... | various args |
Definition at line 204 of file slist.c.
References alog(), slist_::count, slist_::list, and VA_COPY.
Referenced by do_admin(), do_akill(), do_oper(), do_sgline(), do_sqline(), and do_szline().
| int slist_full | ( | SList * | slist | ) |
Determines whether the list is full.
| slist | Slist Struct |
Definition at line 288 of file slist.c.
References slist_::count, and slist_::limit.
Referenced by add_akill(), add_sgline(), add_sqline(), and add_szline().
| int slist_indexof | ( | SList * | slist, | |
| void * | item | |||
| ) |
Returns the index of an item in the list, -1 if inexistant.
| slist | Slist Struct | |
| item | Item index |
Definition at line 318 of file slist.c.
References slist_::count, slistopts_::isequal, slist_::list, and slist_::opts.
Referenced by do_admin(), do_akill(), do_oper(), do_sgline(), do_sqline(), do_szline(), load_old_akill(), load_os_dbase(), slist_add(), and slist_remove().
| void slist_init | ( | SList * | slist | ) |
Initialization of the list.
| slist | Slist Struct |
Definition at line 303 of file slist.c.
References slist_::limit, slist_::opts, and SLIST_DEFAULT_LIMIT.
Referenced by load_ns_dbase(), load_old_ns_dbase(), makenick(), and os_init().
| void slist_pack | ( | SList * | slist | ) |
Removes all NULL pointers from the list.
| slist | Slist Struct |
Definition at line 345 of file slist.c.
References slist_::count, slist_::list, and slist_delete().
Referenced by slist_delete_range().
| int slist_remove | ( | SList * | slist, | |
| void * | item | |||
| ) |
Removes a specific item from the list. Returns the old index of the deleted item, or -1 if the item was not found.
| slist | Slist Struct | |
| item | to remove |
Definition at line 363 of file slist.c.
References slist_delete(), and slist_indexof().
Referenced by delnick(), and os_remove_nick().
Sets the maximum capacity of the list
| slist | Slist Struct | |
| capacity | How large the list can be |
Definition at line 380 of file slist.c.
References slist_::capacity, slist_::count, slist_::list, and srealloc().
Referenced by db_mysql_load_os_dbase(), load_old_akill(), load_os_dbase(), slist_add(), and slist_delete().
SListOpts slist_defopts = { 0, NULL, NULL, NULL } [static] |
1.5.7.1