- firedns.c: removed max() macro. Renamed 'fdns_errno', and 'fdns_fdinuse',
authormichael <michael@82007160-df01-0410-b94d-b575c5fd34c7>
Sun, 18 Jan 2015 14:13:42 +0000 (14:13 +0000)
committermichael <michael@82007160-df01-0410-b94d-b575c5fd34c7>
Sun, 18 Jan 2015 14:13:42 +0000 (14:13 +0000)
  to meet our coding convention.

git-svn-id: svn://svn.ircd-hybrid.org/svnroot/hopm/branches/1.0.x@5391 82007160-df01-0410-b94d-b575c5fd34c7

src/dnsbl.c
src/firedns.c
src/firedns.h
src/irc.c
src/scan.c

index b43181d846d37c114aed47c88a9648a920949692..261dba2a6936d74212b229308dca4f0a0045f7ef 100644 (file)
@@ -87,9 +87,9 @@ dnsbl_add(struct scan_struct *ss)
 
     res = firedns_getip(FDNS_QRY_A, lookup, ds);
 
-    if (res == -1 && fdns_errno != FDNS_ERR_FDLIMIT)
+    if (res == -1 && firedns_errno != FDNS_ERR_FDLIMIT)
     {
-      log_printf("DNSBL -> Error sending dns lookup for '%s': %s", lookup, firedns_strerror(fdns_errno));
+      log_printf("DNSBL -> Error sending dns lookup for '%s': %s", lookup, firedns_strerror(firedns_errno));
       MyFree(ds);
     }
     else
@@ -178,7 +178,7 @@ dnsbl_result(struct firedns_result *res)
                  (unsigned char)res->text[0],
                  (unsigned char)res->text[1],
                  (unsigned char)res->text[2],
-                 (unsigned char)res->text[3], fdns_errno);
+                 (unsigned char)res->text[3], firedns_errno);
     else
       log_printf("DNSBL -> Lookup result for %s!%s@%s (%s) %d.%d.%d.%d (error: %d)",
                  ds->ss->irc_nick,
@@ -188,11 +188,11 @@ dnsbl_result(struct firedns_result *res)
                  (unsigned char)res->text[0],
                  (unsigned char)res->text[1],
                  (unsigned char)res->text[2],
-                 (unsigned char)res->text[3], fdns_errno);
+                 (unsigned char)res->text[3], firedns_errno);
   }
 
   /* Everything is OK */
-  if (res->text[0] == '\0' && fdns_errno == FDNS_ERR_NXDOMAIN)
+  if (res->text[0] == '\0' && firedns_errno == FDNS_ERR_NXDOMAIN)
   {
     if (ds->ss->manual_target)
       irc_send("PRIVMSG %s :CHECK -> DNSBL -> %s does not appear in BL zone %s",
@@ -206,16 +206,16 @@ dnsbl_result(struct firedns_result *res)
   }
 
   /* Either an error, or a positive lookup */
-  if (fdns_errno == FDNS_ERR_NONE)
+  if (firedns_errno == FDNS_ERR_NONE)
     dnsbl_positive(ds->ss, ds->bl, (unsigned char)res->text[3]);
   else
   {
     log_printf("DNSBL -> Lookup error on %s: %s", res->lookup,
-               firedns_strerror(fdns_errno));
+               firedns_strerror(firedns_errno));
 
-    if (fdns_errno != FDNS_ERR_TIMEOUT)
+    if (firedns_errno != FDNS_ERR_TIMEOUT)
       irc_send_channels("DNSBL -> Lookup error on %s: %s", res->lookup,
-                        firedns_strerror(fdns_errno));
+                        firedns_strerror(firedns_errno));
   }
 
   /* Check if ss has any remaining scans */
index cb2163869d79a449e4b3f3ee238a27ddaaec4dea..ded6d70defc549b538fe01c6d04d48c937d97b4e 100644 (file)
@@ -45,12 +45,11 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 #include "dnsbl.h"
 
 #define FIREDNS_TRIES 3
-#define min(a,b) (a < b ? a : b)
 
-int fdns_errno = FDNS_ERR_NONE;
+int firedns_errno = FDNS_ERR_NONE;
 
 /* Variables local to this file */
-static unsigned int fdns_fdinuse;
+static unsigned int firedns_fdinuse;
 
 /* up to FDNS_MAX nameservers; populated by firedns_init() */
 static struct in_addr servers4[FDNS_MAX];
@@ -287,18 +286,18 @@ firedns_resolveip(int type, const char *const name)
 
     result = firedns_getresult(fd);
 
-    if (fdns_errno == FDNS_ERR_NONE)
+    if (firedns_errno == FDNS_ERR_NONE)
       /*
        * Return is from static memory in getresult, so there is no need to
        * copy it until the next call to firedns.
        */
       return result->text;
-    else if (fdns_errno == FDNS_ERR_NXDOMAIN)
+    else if (firedns_errno == FDNS_ERR_NXDOMAIN)
       return NULL;
   }
 
-  if (fdns_errno == FDNS_ERR_NONE)
-    fdns_errno = FDNS_ERR_TIMEOUT;
+  if (firedns_errno == FDNS_ERR_NONE)
+    firedns_errno = FDNS_ERR_TIMEOUT;
 
   return NULL;
 }
@@ -320,9 +319,9 @@ firedns_getip(int type, const char * const name, void *info)
   s->info = info;
   strlcpy(s->lookup, name, sizeof(s->lookup));
 
-  if (fdns_fdinuse >= OptionsItem->dns_fdlimit)
+  if (firedns_fdinuse >= OptionsItem->dns_fdlimit)
   {
-    fdns_errno = FDNS_ERR_FDLIMIT;
+    firedns_errno = FDNS_ERR_FDLIMIT;
 
     /* Don't add to queue if there is no info */
     if (info == NULL)
@@ -377,7 +376,7 @@ firedns_doquery(struct s_connection *s)
 
   if (len == -1)
   {
-    fdns_errno = FDNS_ERR_FORMAT;
+    firedns_errno = FDNS_ERR_FORMAT;
     return -1;
   }
 
@@ -514,7 +513,7 @@ firedns_send_requests(struct s_header *h, struct s_connection *s, int l)
 
     if (s->fd == -1)
     {
-      fdns_errno = FDNS_ERR_NETWORK;
+      firedns_errno = FDNS_ERR_NETWORK;
       return -1;
     }
   }
@@ -566,13 +565,13 @@ firedns_send_requests(struct s_header *h, struct s_connection *s, int l)
   {
     close(s->fd);
     s->fd = -1;
-    fdns_errno = FDNS_ERR_NETWORK;
+    firedns_errno = FDNS_ERR_NETWORK;
     return -1;
   }
 
   time(&s->start);
-  fdns_fdinuse++;
-  fdns_errno = FDNS_ERR_NONE;
+  firedns_fdinuse++;
+  firedns_errno = FDNS_ERR_NONE;
 
   return s->fd;
 }
@@ -590,7 +589,7 @@ firedns_getresult(const int fd)
   char *src, *dst;
   int bytes;
 
-  fdns_errno = FDNS_ERR_OTHER;
+  firedns_errno = FDNS_ERR_OTHER;
   result.info = NULL;
 
   memset(result.text, 0, sizeof(result.text));
@@ -617,7 +616,7 @@ firedns_getresult(const int fd)
 
   if (l == -1)
   {
-    fdns_errno = FDNS_ERR_NETWORK;
+    firedns_errno = FDNS_ERR_NETWORK;
     goto cleanup;
   }
 
@@ -639,7 +638,7 @@ firedns_getresult(const int fd)
 
   if ((h.flags2 & FLAGS2_MASK_RCODE) != 0)
   {
-    fdns_errno = (h.flags2 & FLAGS2_MASK_RCODE);
+    firedns_errno = (h.flags2 & FLAGS2_MASK_RCODE);
     goto cleanup;
   }
 
@@ -647,7 +646,7 @@ firedns_getresult(const int fd)
 
   if (h.ancount < 1)
   {
-    fdns_errno = FDNS_ERR_NXDOMAIN;
+    firedns_errno = FDNS_ERR_NXDOMAIN;
     /* no sense going on if we don't have any answers */
     goto cleanup;
   }
@@ -745,7 +744,7 @@ firedns_getresult(const int fd)
   if (rr->rdlength > 1023)
     goto cleanup;
 
-  fdns_errno = FDNS_ERR_NONE;
+  firedns_errno = FDNS_ERR_NONE;
   memcpy(result.text, &h.payload[i], rr->rdlength);
   result.text[rr->rdlength] = '\0';
 
@@ -754,7 +753,7 @@ cleanup:
   list_remove(CONNECTIONS, node);
   node_free(node);
   close(c->fd);
-  fdns_fdinuse--;
+  firedns_fdinuse--;
   MyFree(c);
 
   return &result;
@@ -801,10 +800,10 @@ firedns_cycle(void)
       strlcpy(new_result.lookup, p->lookup, sizeof(new_result.lookup));
 
       close(p->fd);
-      fdns_fdinuse--;
+      firedns_fdinuse--;
       MyFree(p);
 
-      fdns_errno = FDNS_ERR_TIMEOUT;
+      firedns_errno = FDNS_ERR_TIMEOUT;
 
       if (new_result.info)
         dnsbl_result(&new_result);
@@ -847,7 +846,7 @@ firedns_cycle(void)
         }
       }
     }
-    else if (fdns_fdinuse < OptionsItem->dns_fdlimit)
+    else if (firedns_fdinuse < OptionsItem->dns_fdlimit)
       firedns_doquery(p);
   }
 }
index 86caf1132215d536c9f792f459d56a3411977dfc..bd65d5b5aeb0f90edc4d5b897312458177a7103f 100644 (file)
@@ -63,7 +63,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 #define FDNS_ERR_OTHER       9
 
 /* Used with the above error values */
-extern int fdns_errno;
+extern int firedns_errno;
 
 struct firedns_result
 {
index 795fcc771d5c5f4c6c9e919043823fc59a668ff9..abeca40fb36d21db9bc8bb44386f635e8786421f 100644 (file)
--- a/src/irc.c
+++ b/src/irc.c
@@ -197,7 +197,7 @@ irc_init(void)
   else
   {
     log_printf("IRC -> firedns_resolveip(\"%s\"): %s", IRCItem->server,
-               firedns_strerror(fdns_errno));
+               firedns_strerror(firedns_errno));
     exit(EXIT_FAILURE);
   }
 
index 938edc468a3ff2973fac36a1f0de12c8483715bc..d0719f6443cbe8742463a111efa020f9c6471729 100644 (file)
@@ -892,7 +892,7 @@ scan_manual(char *param, const struct ChannelConf *target)
   if ((addr = firedns_resolveip4(ip)) == NULL)
   {
     irc_send("PRIVMSG %s :CHECK -> Error resolving host '%s': %s",
-             target->name, ip, firedns_strerror(fdns_errno));
+             target->name, ip, firedns_strerror(firedns_errno));
     return;
   }