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