lib/eggdrop/garbage.c File Reference

#include <eggdrop/eggdrop.h>

Go to the source code of this file.

Data Structures

struct  garbage_list

Typedefs

typedef struct garbage_list garbage_list_t

Functions

int garbage_add (garbage_proc_t garbage_proc, void *client_data, int flags)
int garbage_run ()

Variables

static const char rcsid [] = "$Id: garbage.c,v 1.5 2004-10-17 05:14:06 stdarg Exp $"
static garbage_list_tgarbage_list_head = NULL


Typedef Documentation

typedef struct garbage_list garbage_list_t


Function Documentation

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 }


Variable Documentation

Definition at line 32 of file garbage.c.

const char rcsid[] = "$Id: garbage.c,v 1.5 2004-10-17 05:14:06 stdarg Exp $" [static]

Definition at line 21 of file garbage.c.


Generated on Sun Nov 30 18:43:34 2008 for eggdrop1.9 by  doxygen 1.5.6