]> jfr.im git - irc/quakenet/newserv.git/blobdiff - glines/glines_alloc.c
CHANSERV: better batcher error handling for expired accounts/accounts with no email.
[irc/quakenet/newserv.git] / glines / glines_alloc.c
index 772b9d2e9bfcfefab0fd19f2320de9ae58b644f5..b3434127f4324ec20f09ce5dcafe4f13c1cc1014 100644 (file)
@@ -1,9 +1,5 @@
-#include <stdlib.h>
-#include <assert.h>
-#include "../core/nsmalloc.h"
-#include <stdio.h>
 #include <string.h>
-
+#include "../core/nsmalloc.h"
 #include "glines.h"
 
 gline *glinelist;
@@ -11,39 +7,20 @@ gline *glinelist;
 gline *newgline() {
   gline *gl = nsmalloc(POOL_GLINE, sizeof(gline));
 
-  if(!gl)
+  if (!gl)
     return NULL;
 
-  gl->next=NULL;
-  
-  gl->nick=NULL;
-  gl->user=NULL;
-  gl->host=NULL;
-  gl->reason=NULL;
-  gl->creator=NULL;
-
-  gl->expire=0;
-  gl->lastmod=0;
-  gl->lifetime=0;
-
-  gl->flags=0;
+  memset(gl, 0, sizeof(gline));
 
-  gl->next=NULL;
-  
   return gl;
 }
 
 void freegline(gline *gl) {
-  if (gl->nick)
-    freesstring(gl->nick);
-  if (gl->user)
-    freesstring(gl->user);
-  if (gl->host)
-    freesstring(gl->host);
-  if (gl->reason)
-    freesstring(gl->reason);
-  if (gl->creator)
-    freesstring(gl->creator);
+  freesstring(gl->nick);
+  freesstring(gl->user);
+  freesstring(gl->host);
+  freesstring(gl->reason);
+  freesstring(gl->creator);
 
   nsfree(POOL_GLINE, gl);
 }
@@ -51,7 +28,7 @@ void freegline(gline *gl) {
 void removegline(gline *gl) {
   gline **pnext;
 
-  for(pnext=&glinelist;*pnext;pnext=&((*pnext)->next)) {
+  for (pnext = &glinelist; *pnext; pnext = &((*pnext)->next)) {
     if (*pnext == gl) {
       *pnext = gl->next;
       break;