]> jfr.im git - irc/quakenet/newserv.git/blame - glines/glines_alloc.c
BUILD: add require-all build mode
[irc/quakenet/newserv.git] / glines / glines_alloc.c
CommitLineData
a44fc5f7 1#include <string.h>
c684f472 2#include "../core/nsmalloc.h"
a44fc5f7
GB
3#include "glines.h"
4
5gline *glinelist;
6
7gline *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
18void freegline(gline *gl) {
a6558256
GB
19 freesstring(gl->nick);
20 freesstring(gl->user);
21 freesstring(gl->host);
22 freesstring(gl->reason);
23 freesstring(gl->creator);
a44fc5f7
GB
24
25 nsfree(POOL_GLINE, gl);
26}
27
28void removegline(gline *gl) {
29 gline **pnext;
30
c684f472 31 for (pnext = &glinelist; *pnext; pnext = &((*pnext)->next)) {
a44fc5f7
GB
32 if (*pnext == gl) {
33 *pnext = gl->next;
34 break;
35 }
36 }
37
38 freegline(gl);
39}