Go to the source code of this file.
Defines | |
#define | GARBAGE_ONCE 1 |
Typedefs | |
typedef int(* | garbage_proc_t )(void *client_data) |
Functions | |
int | garbage_add (garbage_proc_t garbage_proc, void *client_data, int flags) |
int | garbage_run () |
#define GARBAGE_ONCE 1 |
Definition at line 25 of file garbage.h.
Referenced by botnet_delete(), garbage_add(), module_unload(), on_chanset(), partychan_delete(), partychan_part(), partymember_delete(), and schedule_bind_cleanup().
typedef int(* garbage_proc_t)(void *client_data) |
int garbage_add | ( | garbage_proc_t | garbage_proc, | |
void * | client_data, | |||
int | flags | |||
) |
Definition at line 34 of file garbage.c.
References garbage_list::client_data, GARBAGE_ONCE, garbage_list::garbage_proc, and garbage_list::next.
Referenced by botnet_delete(), module_unload(), on_chanset(), partychan_delete(), partychan_part(), partymember_delete(), schedule_bind_cleanup(), and user_delete().
00035 { 00036 garbage_list_t *g; 00037 00038 /* Make sure it's not a duplicate (helpful for cleanup functions). */ 00039 if (flags & GARBAGE_ONCE) { 00040 for (g = garbage_list_head; g; g = g->next) { 00041 if (g->garbage_proc == garbage_proc && g->client_data == client_data) return(0); 00042 } 00043 } 00044 00045 /* Create the entry. */ 00046 g = malloc(sizeof(*g)); 00047 g->garbage_proc = garbage_proc; 00048 g->client_data = client_data; 00049 00050 /* Add to list. */ 00051 g->next = garbage_list_head; 00052 garbage_list_head = g; 00053 00054 return(0); 00055 }
int garbage_run | ( | ) |
Definition at line 58 of file garbage.c.
References garbage_list::client_data, garbage_list::garbage_proc, and garbage_list::next.
Referenced by botnet_shutdown(), core_shutdown_or_restart(), main(), module_shutdown(), partychan_shutdown(), partymember_shutdown(), and user_shutdown().
00059 { 00060 garbage_list_t *g; 00061 00062 for (g = garbage_list_head; g; g = garbage_list_head) { 00063 garbage_list_head = g->next; 00064 (g->garbage_proc)(g->client_data); 00065 free(g); 00066 } 00067 return(0); 00068 }