- Style corrections
authormichael <michael@82007160-df01-0410-b94d-b575c5fd34c7>
Sun, 15 Mar 2015 13:04:24 +0000 (13:04 +0000)
committermichael <michael@82007160-df01-0410-b94d-b575c5fd34c7>
Sun, 15 Mar 2015 13:04:24 +0000 (13:04 +0000)
git-svn-id: svn://svn.ircd-hybrid.org/svnroot/hopm/trunk@5695 82007160-df01-0410-b94d-b575c5fd34c7

src/dnsbl.c
src/firedns.c
src/irc.c
src/negcache.c
src/opercmd.c
src/scan.c

index 9cf966f04347ca500bf30031b8c7fdbfc6c49580..f8ea9a471f23de34c9682d81084cab616fe0c2e0 100644 (file)
@@ -53,7 +53,7 @@ dnsbl_add(struct scan_struct *ss)
   struct in_addr in;
   unsigned char a, b, c, d;
   char lookup[128];
-  node_t *p;
+  node_t *node;
   int res;
   struct dnsbl_scan *ds;
 
@@ -68,9 +68,9 @@ dnsbl_add(struct scan_struct *ss)
   b = (unsigned char)(in.s_addr >>  8) & 0xFF;
   a = (unsigned char) in.s_addr & 0xFF;
 
-  LIST_FOREACH(p, OpmItem->blacklists->head)
+  LIST_FOREACH(node, OpmItem->blacklists->head)
   {
-    struct BlacklistConf *bl = p->data;
+    struct BlacklistConf *bl = node->data;
 
 #ifdef WORDS_BIGENDIAN
     snprintf(lookup, sizeof(lookup), "%d.%d.%d.%d.%s", a, b, c, d, bl->name);
@@ -101,13 +101,13 @@ static void
 dnsbl_positive(struct scan_struct *ss, struct BlacklistConf *bl, unsigned char type)
 {
   char text_type[128] = "";
-  node_t *p;
+  node_t *node;
 
   if (bl->type == A_BITMASK)
   {
-    LIST_FOREACH(p, bl->reply->head)
+    LIST_FOREACH(node, bl->reply->head)
     {
-      const struct BlacklistReplyConf *item = p->data;
+      const struct BlacklistReplyConf *item = node->data;
 
       if (item->number & type)
       {
@@ -124,9 +124,9 @@ dnsbl_positive(struct scan_struct *ss, struct BlacklistConf *bl, unsigned char t
   }
   else
   {
-    LIST_FOREACH(p, bl->reply->head)
+    LIST_FOREACH(node, bl->reply->head)
     {
-      const struct BlacklistReplyConf *item = p->data;
+      const struct BlacklistReplyConf *item = node->data;
 
       if (item->number == type)
       {
index fdb48b76ec6f1a5cd0a093d6ad3ebad8cc0b8d37..bd6c5d8249d185c6a8c6d348036b10a739aaf397 100644 (file)
@@ -762,7 +762,7 @@ cleanup:
 void
 firedns_cycle(void)
 {
-  node_t *node, *next;
+  node_t *node, *node_next;
   struct s_connection *p;
   struct firedns_result *res, new_result;
   static struct pollfd *ufds = NULL;
@@ -779,7 +779,7 @@ firedns_cycle(void)
   time(&timenow);
   size = 0;
 
-  LIST_FOREACH_SAFE(node, next, CONNECTIONS->head)
+  LIST_FOREACH_SAFE(node, node_next, CONNECTIONS->head)
   {
     if (size >= OptionsItem->dns_fdlimit)
       break;
index ee0e185c5f84093de426bc10492c6c3f343656d2..f5d0c6db7edcd0fa3164c224339e3d69bde3c659 100644 (file)
--- a/src/irc.c
+++ b/src/irc.c
@@ -78,15 +78,13 @@ static void m_kill(char *[], unsigned int, const char *, const struct UserInfo *
  * Certain variables we don't want to allocate memory for over and over
  * again so global scope is given.
  */
+static char         IRC_RAW[MSGLENMAX];  /* Buffer to read data into               */
+static unsigned int IRC_RAW_LEN;         /* Position of IRC_RAW                    */
+static int          IRC_FD;              /* File descriptor for IRC client         */
 
-static char          IRC_RAW[MSGLENMAX];         /* Buffer to read data into              */
-static unsigned int  IRC_RAW_LEN    = 0;         /* Position of IRC_RAW                   */
-static int           IRC_FD         = 0;         /* File descriptor for IRC client        */
-
-static struct sockaddr_storage IRC_SVR;          /* Sock Address Struct for IRC server    */
-
-static time_t IRC_LAST = 0;                      /* Last full line of data from irc server*/
-static time_t IRC_LASTRECONNECT = 0;             /* Time of last reconnection */
+static struct sockaddr_storage IRC_SVR;  /* Sock Address Struct for IRC server     */
+static time_t IRC_LAST;                  /* Last full line of data from irc server */
+static time_t IRC_LASTRECONNECT;         /* Time of last reconnection              */
 
 /*
  * Table should be ordered with most occuring (or priority)
@@ -126,7 +124,7 @@ irc_cycle(void)
   if (IRC_FD <= 0)
   {
     /* Initialise negative cache. */
-    if (OptionsItem->negcache > 0)
+    if (OptionsItem->negcache)
       nc_init(&nc_head);
 
     /* Resolve remote host. */
@@ -594,12 +592,12 @@ userinfo_create(const char *source)
   char *username = NULL;
   char *hostname = NULL;
   char tmp[MSGLENMAX];
-  size_t i, len;
+  size_t len;
 
   len = strlcpy(tmp, source, sizeof(tmp));
   nick = tmp;
 
-  for (i = 0; i < len; ++i)
+  for (size_t i = 0; i < len; ++i)
   {
     if (tmp[i] == '!')
     {
index a0b203184631e9d89faaf449b6bcebd4819319e0..a4caab2c63087117d1c85e4f7e9237327a91f26c 100644 (file)
@@ -174,7 +174,7 @@ struct cnode *check_neg_cache(const unsigned long ip)
    time_t now;
    struct cnode *n;
 
-   if (OptionsItem->negcache <= 0)
+   if (OptionsItem->negcache == 0)
       return(NULL);
 
    n = nc_search(nc_head, ip);
index 103be0564481011506d60db51f2f62136037fa47..07873df5626c3060b25bb3ea902f98dc4ba83c1e 100644 (file)
@@ -87,7 +87,7 @@ void
 command_timer(void)
 {
   static unsigned int interval;
-  node_t *node, *next;
+  node_t *node, *node_next;
   time_t present;
 
   /* Only perform command removal every COMMANDINTERVAL seconds */
@@ -98,7 +98,7 @@ command_timer(void)
 
   time(&present);
 
-  LIST_FOREACH_SAFE(node, next, COMMANDS->head)
+  LIST_FOREACH_SAFE(node, node_next, COMMANDS->head)
   {
     struct Command *cs = node->data;
 
@@ -108,7 +108,7 @@ command_timer(void)
       list_remove(COMMANDS, node);
       node_free(node);
     }
-    else   /* Since the queue is in order, it's also ordered by time, no nodes after this will be timed out */
+    else  /* Since the queue is in order, it's also ordered by time, no nodes after this will be timed out */
       return;
   }
 }
@@ -214,7 +214,7 @@ command_create(const struct OperCommandHash *tab, char *param, char *irc_nick,
   ret->irc_nick = xstrdup(irc_nick);
   ret->target = target;  /* FIXME: This needs fixed if rehash is implemented */
 
-  time(&(ret->added));
+  time(&ret->added);
 
   return ret;
 }
@@ -253,7 +253,7 @@ command_free(struct Command *command)
 void
 command_userhost(const char *reply)
 {
-  node_t *node, *next;
+  node_t *node, *node_next;
   char *tmp;
   int oper = 0;
 
@@ -274,7 +274,7 @@ command_userhost(const char *reply)
     *(tmp) = '\0';
 
   /* Find any queued commands that match this user */
-  LIST_FOREACH_SAFE(node, next, COMMANDS->head)
+  LIST_FOREACH_SAFE(node, node_next, COMMANDS->head)
   {
     struct Command *cs = node->data;
 
index 5ea6c44bd451728eeadcb9e9920e930ee818af8e..8ea6e7e8682bf32e14afbe67c537558d0b960737 100644 (file)
@@ -85,15 +85,15 @@ extern FILE *scanlogfile;
 void
 scan_cycle(void)
 {
-  node_t *p;
+  node_t *node;
 
   /* Cycle through the blacklist first.. */
   dnsbl_cycle();
 
   /* Cycle each scanner object */
-  LIST_FOREACH(p, SCANNERS->head)
+  LIST_FOREACH(node, SCANNERS->head)
   {
-    struct scanner_struct *scs = p->data;
+    struct scanner_struct *scs = node->data;
     opm_cycle(scs->scanner);
   }
 }
@@ -111,7 +111,7 @@ scan_timer(void)
 {
   static time_t nc_counter;
 
-  if (OptionsItem->negcache > 0)
+  if (OptionsItem->negcache)
   {
     if (nc_counter++ >= OptionsItem->negcache_rebuild)
     {
@@ -271,7 +271,7 @@ scan_init(void)
   }
 
   /* Initialise negative cache */
-  if (OptionsItem->negcache > 0)
+  if (OptionsItem->negcache)
   {
     if (OPT_DEBUG >= 2)
       log_printf("SCAN -> Initializing negative cache");
@@ -314,7 +314,7 @@ scan_connect(const char *user[], const char *msg)
   char ipmask[MSGLENMAX];
 
   /* Check negcache before anything */
-  if (OptionsItem->negcache > 0)
+  if (OptionsItem->negcache)
   {
     if (inet_pton(AF_INET, user[3], &ip.sin_addr) <= 0)
     {
@@ -748,7 +748,7 @@ static void
 scan_negative(const struct scan_struct *ss)
 {
   /* Insert IP in negcache */
-  if (OptionsItem->negcache > 0)
+  if (OptionsItem->negcache)
   {
     if (OPT_DEBUG >= 2)
       log_printf("SCAN -> Adding %s to negative cache", ss->ip);
@@ -865,7 +865,7 @@ scan_manual(char *param, const struct ChannelConf *target)
   struct scanner_struct *scs;
   const char *ip = NULL;
   char *scannername;
-  node_t *p;
+  node_t *node;
   int ret;
 
   /* If there were no parameters sent, simply alert the user and return */
@@ -920,9 +920,9 @@ scan_manual(char *param, const struct ChannelConf *target)
     dnsbl_add(ss);
 
   /* Add ss->remote to all scanners */
-  LIST_FOREACH(p, SCANNERS->head)
+  LIST_FOREACH(node, SCANNERS->head)
   {
-    scs = p->data;
+    scs = node->data;
 
     /*
      * If we have a scannername, only allow that scanner