]>
Commit | Line | Data |
---|---|---|
1 | #include <string.h> | |
2 | #include "../core/nsmalloc.h" | |
3 | #include "glines.h" | |
4 | ||
5 | gline *glinelist; | |
6 | ||
7 | gline *newgline() { | |
8 | gline *gl = nsmalloc(POOL_GLINE, sizeof(gline)); | |
9 | ||
10 | if (!gl) | |
11 | return NULL; | |
12 | ||
13 | memset(gl, 0, sizeof(gline)); | |
14 | ||
15 | return gl; | |
16 | } | |
17 | ||
18 | void freegline(gline *gl) { | |
19 | freesstring(gl->nick); | |
20 | freesstring(gl->user); | |
21 | freesstring(gl->host); | |
22 | freesstring(gl->reason); | |
23 | freesstring(gl->creator); | |
24 | ||
25 | nsfree(POOL_GLINE, gl); | |
26 | } | |
27 | ||
28 | void removegline(gline *gl) { | |
29 | gline **pnext; | |
30 | ||
31 | for (pnext = &glinelist; *pnext; pnext = &((*pnext)->next)) { | |
32 | if (*pnext == gl) { | |
33 | *pnext = gl->next; | |
34 | break; | |
35 | } | |
36 | } | |
37 | ||
38 | freegline(gl); | |
39 | } |