INN commit: branches/2.6 (8 files)

INN Commit rra at isc.org
Thu May 5 12:41:10 UTC 2016


    Date: Thursday, May 5, 2016 @ 05:41:10
  Author: iulius
Revision: 10012

Remove redundant or useless code (reported by cppcheck)

Modified:
  branches/2.6/backends/buffchan.c
  branches/2.6/expire/expire.c
  branches/2.6/innd/rc.c
  branches/2.6/lib/conffile.c
  branches/2.6/lib/getfqdn.c
  branches/2.6/nnrpd/newnews.c
  branches/2.6/nnrpd/post.c
  branches/2.6/storage/expire.c

---------------------+
 backends/buffchan.c |    4 +---
 expire/expire.c     |   11 +----------
 innd/rc.c           |    2 +-
 lib/conffile.c      |    2 +-
 lib/getfqdn.c       |    5 ++++-
 nnrpd/newnews.c     |    2 +-
 nnrpd/post.c        |    3 +--
 storage/expire.c    |    5 +----
 8 files changed, 11 insertions(+), 23 deletions(-)

Modified: backends/buffchan.c
===================================================================
--- backends/buffchan.c	2016-05-05 12:40:29 UTC (rev 10011)
+++ backends/buffchan.c	2016-05-05 12:41:10 UTC (rev 10012)
@@ -122,10 +122,8 @@
 */
 static void SITEopen(SITE *sp)
 {
-    int			e;
-
     if ((sp->F = xfopena(sp->Filename)) == NULL
-     && ((e = errno) != EACCES || chmod(sp->Filename, 0644) < 0
+     && (errno != EACCES || chmod(sp->Filename, 0644) < 0
       || (sp->F = xfopena(sp->Filename)) == NULL)) {
         syswarn("%s cannot fopen %s", sp->Name, sp->Filename);
 	if ((sp->F = fopen("/dev/null", "w")) == NULL)

Modified: expire/expire.c
===================================================================
--- expire/expire.c	2016-05-05 12:40:29 UTC (rev 10011)
+++ expire/expire.c	2016-05-05 12:41:10 UTC (rev 10012)
@@ -98,18 +98,9 @@
     while (*p == sep)
       ++p;
 
-    if (!*p)
+    if (*p == '\0')
       return 0;
 
-    if (!p)
-      return 0;
-
-    while (*p == sep)
-      ++p;
-
-    if (!*p)
-      return 0;
-
     for (i = 1, *argv++ = p; *p; )
 	if (*p++ == sep) {
 	    p[-1] = '\0';

Modified: innd/rc.c
===================================================================
--- innd/rc.c	2016-05-05 12:40:29 UTC (rev 10011)
+++ innd/rc.c	2016-05-05 12:41:10 UTC (rev 10012)
@@ -694,7 +694,7 @@
   if (*p == '"') { /* double quoted string ? */
     p++;
     do {
-      for (t = p; (*t != '"' || (*t == '"' && *(t - 1) == '\\')) &&
+      for (t = p; (*t != '"' || *(t - 1) == '\\') &&
 	     *t != '\0'; t++);
       if (*t == '\0') {
 	*t++ = '\n';

Modified: lib/conffile.c
===================================================================
--- lib/conffile.c	2016-05-05 12:40:29 UTC (rev 10011)
+++ lib/conffile.c	2016-05-05 12:41:10 UTC (rev 10012)
@@ -70,7 +70,7 @@
   if (*p == '"') { /* double quoted string ? */
     p++;
     do {
-      for (t = p; (*t != '"' || (*t == '"' && *(t - 1) == '\\')) &&
+      for (t = p; (*t != '"' || *(t - 1) == '\\') &&
              *t != '\0'; t++);
       if (*t == '\0') {
         if (strlen(F->buf) >= F->sbuf - 2)

Modified: lib/getfqdn.c
===================================================================
--- lib/getfqdn.c	2016-05-05 12:40:29 UTC (rev 10011)
+++ lib/getfqdn.c	2016-05-05 12:41:10 UTC (rev 10012)
@@ -49,10 +49,13 @@
         strlcat(temp, ".", sizeof(temp));
 	hp = gethostbyname(temp);
     }
+    if (hp == NULL) {
+        return NULL;
+    }
 #endif	/* 0 */
 
     /* First, see if the main name is a FQDN.  It should be. */
-    if (hp != NULL && strchr(hp->h_name, '.') != NULL) {
+    if (strchr(hp->h_name, '.') != NULL) {
 	if (strlen(hp->h_name) < sizeof buff - 1) {
 	    strlcpy(buff, hp->h_name, sizeof(buff));
             return buff;

Modified: nnrpd/newnews.c
===================================================================
--- nnrpd/newnews.c	2016-05-05 12:40:29 UTC (rev 10011)
+++ nnrpd/newnews.c	2016-05-05 12:41:10 UTC (rev 10012)
@@ -117,7 +117,7 @@
   list[1] = NULL;
   for ( ; *xrefs; xrefs++) {
     list[0] = *xrefs;
-    if ((!AllGroups && PERMmatch(groups, list)) && (!PERMspecified || (PERMspecified && PERMmatch(PERMreadlist, list)))) {
+    if ((!AllGroups && PERMmatch(groups, list)) && (!PERMspecified || PERMmatch(PERMreadlist, list))) {
       if (!strcmp(*xrefs, group))
 	return false;
       else

Modified: nnrpd/post.c
===================================================================
--- nnrpd/post.c	2016-05-05 12:40:29 UTC (rev 10011)
+++ nnrpd/post.c	2016-05-05 12:41:10 UTC (rev 10012)
@@ -689,7 +689,6 @@
     int		i;
     char	*address;
     char	buff[SMBUF];
-    char	*mta;
 
     /* Try to get the address first. */
     if ((address = GetModeratorAddress(NULL, NULL, group, PERMaccessconf->moderatormailer)) == NULL) {
@@ -702,7 +701,7 @@
 
     /* Now build up the command (ignore format/argument mismatch errors,
      * in case %s isn't in inconf->mta) and send the headers. */
-    if ((mta = innconf->mta) == NULL)
+    if (innconf->mta == NULL)
 	return "Can't start mailer -- mta not set";
 #pragma GCC diagnostic ignored "-Wformat-nonliteral"
     snprintf(buff, sizeof(buff), innconf->mta, address);

Modified: storage/expire.c
===================================================================
--- storage/expire.c	2016-05-05 12:40:29 UTC (rev 10011)
+++ storage/expire.c	2016-05-05 12:41:10 UTC (rev 10012)
@@ -151,12 +151,9 @@
     while (*p == sep)
       ++p;
 
-    if (!*p)
+    if (*p == '\0')
       return 0;
 
-    if (!p)
-      return 0;
-
     for (i = 1, *argv++ = p; *p; )
         if (*p++ == sep) {
             p[-1] = '\0';



More information about the inn-committers mailing list