INN commit: trunk (8 files)

INN Commit rra at isc.org
Thu Aug 4 19:52:13 UTC 2016


    Date: Thursday, August 4, 2016 @ 12:52:13
  Author: iulius
Revision: 10042

Fix gcc warnings

Modified:
  trunk/frontends/feedone.c
  trunk/frontends/sys2nf.c
  trunk/lib/memcmp.c
  trunk/lib/network.c
  trunk/lib/strcasecmp.c
  trunk/lib/strspn.c
  trunk/lib/strtok.c
  trunk/lib/symlink.c

---------------------+
 frontends/feedone.c |   19 +++++----------
 frontends/sys2nf.c  |   60 +++++++++++++++-----------------------------------
 lib/memcmp.c        |    2 -
 lib/network.c       |    6 ++---
 lib/strcasecmp.c    |   11 +--------
 lib/strspn.c        |   14 +----------
 lib/strtok.c        |   13 +---------
 lib/symlink.c       |    1 
 8 files changed, 36 insertions(+), 90 deletions(-)

Modified: frontends/feedone.c
===================================================================
--- frontends/feedone.c	2016-07-31 20:16:07 UTC (rev 10041)
+++ frontends/feedone.c	2016-08-04 19:52:13 UTC (rev 10042)
@@ -22,10 +22,7 @@
 **  Read a line from the server or die trying.
 */
 static void
-GetFromServer(buff, size, text)
-    char	*buff;
-    int		size;
-    char	*text;
+GetFromServer(char *buff, int size, const char *text)
 {
     if (fgets(buff, size, FromServer) == NULL)
         sysdie("%s", text);
@@ -38,8 +35,7 @@
 **  Flush a stdio FILE; exit if there are any errors.
 */
 static void
-SafeFlush(F)
-    FILE	*F;
+SafeFlush(FILE *F)
 {
     if (fflush(F) == EOF || ferror(F))
         sysdie("cannot send text to server");
@@ -47,8 +43,7 @@
 
 
 static void
-SendQuit(x)
-    int		x;
+SendQuit(int x)
 {
     char	buff[BUFSIZ];
 
@@ -62,7 +57,7 @@
 
 
 static void
-Usage()
+Usage(void)
 {
     fprintf(stderr, "Usage: feedone [-r|-m msgid] [-p] [-t] articlefile\n");
     exit(1);
@@ -70,9 +65,7 @@
 
 
 int
-main(ac, av)
-    int		ac;
-    char	*av[];
+main(int ac, char *av[])
 {
     static char	MESGIDHDR[] = "Message-ID:";
     int		i;
@@ -185,5 +178,7 @@
         sysdie("cannot send article to the server: %s", buff);
 
     SendQuit(0);
+
     /* NOTREACHED */
+    return 1;
 }

Modified: frontends/sys2nf.c
===================================================================
--- frontends/sys2nf.c	2016-07-31 20:16:07 UTC (rev 10041)
+++ frontends/sys2nf.c	2016-08-04 19:52:13 UTC (rev 10042)
@@ -21,13 +21,13 @@
 #define TEMPFILE	":tmp"
 static char		**Groups;
 
+char ** ReadSys(const char *);
 
 /*
 **  Fill in the Groups array with the names of all active newsgroups.
 */
 static void
-ReadActive(act)
-    char	*act;
+ReadActive(char *act)
 {
     FILE	*F;
     int		i;
@@ -60,8 +60,7 @@
 **  per continued line.
 */
 char **
-ReadSys(sys)
-    char		*sys;
+ReadSys(const char *sys)
 {
     char	*p;
     char	*to;
@@ -104,33 +103,11 @@
 
 
 /*
-**  Is this the name of a top-level group?  We want a simple name, "foo",
-**  and should find a "foo." in the group list.
-*/
-static bool
-Toplevel(p)
-    char	*p;
-{
-    char	**gp;
-    char	*g;
-    int		i;
-
-    if (strchr(p, '.') != NULL)
-	return false;
-    for (i = strlen(p) - 1, gp = Groups; (g = *gp++) != NULL; )
-	if (strncmp(p, g, i) == 0 && g[i + 1] == '.')
-	    return true;
-    return false;
-}
-
-
-/*
 **  Do we have a name that's a prefix for more then one newsgroup?
 **  For "foo.bar", we must find more then one "foo.bar" or "foo.bar."
 */
 static bool
-GroupPrefix(p)
-    char	*p;
+GroupPrefix(const char *p)
 {
     char	**gp;
     char	*g;
@@ -151,12 +128,10 @@
 **  turn.
 */
 static void
-DoSub(F, p)
-    FILE	*F;
-    char		*p;
+DoSub(FILE *F, char *p)
 {
-    char	*s;
-    int	len, i;
+    const char	*s;
+    size_t	len, i;
     bool matched;
     bool	SawBang;
     bool	SawAll;
@@ -238,9 +213,7 @@
 
 
 int
-main(ac, av)
-    int		 ac;
-    char	*av[];
+main(int ac, char *av[])
 {
     FILE	*F;
     FILE	*out;
@@ -253,9 +226,10 @@
     char	*site;
     char	buff[256];
     char	*act;
-    char	*dir;
-    char	*sys;
+    const char	*dir;
+    const char	*sys;
     int		i;
+    size_t j;
 
     if (!innconf_read(NULL))
         exit(1);
@@ -291,15 +265,15 @@
 	}
 	site = xstrdup(p);
 	if ((f2 = strchr(site, ':')) == NULL)
-	    f2 = "HELP";
+	    f2 = (char *) "HELP";
 	else
 	    *f2++ = '\0';
 	if ((f3 = strchr(f2, ':')) == NULL)
-	    f3 = "HELP";
+	    f3 = (char *) "HELP";
 	else
 	    *f3++ = '\0';
 	if ((f4 = strchr(f3, ':')) == NULL)
-	    f4 = "HELP";
+	    f4 = (char *) "HELP";
 	else
 	    *f4++ = '\0';
 
@@ -335,8 +309,8 @@
 	    perror(TEMPFILE), exit(1);
 	if ((out = xfopena(p)) == NULL)
 	    perror(p), exit(1);
-	while ((i = fread(buff, 1, sizeof buff, F)) > 0)
-	    if (fwrite(buff, 1, i, out) != i)
+	while ((j = fread(buff, 1, sizeof buff, F)) > 0)
+	    if (fwrite(buff, 1, j, out) != j)
 		perror(p), exit(1);
 	fclose(F);
 	if (fclose(out) == EOF)
@@ -347,5 +321,7 @@
     }
 
     exit(0);
+
     /* NOTREACHED */
+    return 1;
 }

Modified: lib/memcmp.c
===================================================================
--- lib/memcmp.c	2016-07-31 20:16:07 UTC (rev 10041)
+++ lib/memcmp.c	2016-08-04 19:52:13 UTC (rev 10042)
@@ -11,7 +11,7 @@
 */
 
 #include "config.h"
-#include <sys/types.h>
+#include "clibrary.h"
 
 /* If we're running the test suite, rename memcmp to avoid conflicts with
    the system version. */

Modified: lib/network.c
===================================================================
--- lib/network.c	2016-07-31 20:16:07 UTC (rev 10041)
+++ lib/network.c	2016-08-04 19:52:13 UTC (rev 10042)
@@ -91,7 +91,7 @@
  * on the same port immediately if the daemon dies unexpectedly).
  */
 void
-network_set_reuseaddr(socket_type fd)
+network_set_reuseaddr(socket_type fd UNUSED)
 {
 #ifdef SO_REUSEADDR
     int flag = 1;
@@ -107,7 +107,7 @@
  * consistent and easier to understand.
  */
 void
-network_set_v6only(socket_type fd)
+network_set_v6only(socket_type fd UNUSED)
 {
 #ifdef IPV6_V6ONLY
     int flag = 1;
@@ -123,7 +123,7 @@
  * IPv6 addresses that may not have been set up yet.
  */
 void
-network_set_freebind(socket_type fd)
+network_set_freebind(socket_type fd UNUSED)
 {
 #ifdef IP_FREEBIND
     int flag = 1;

Modified: lib/strcasecmp.c
===================================================================
--- lib/strcasecmp.c	2016-07-31 20:16:07 UTC (rev 10041)
+++ lib/strcasecmp.c	2016-08-04 19:52:13 UTC (rev 10042)
@@ -22,10 +22,6 @@
  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  */
 
-#if defined(LIBC_SCCS) && !defined(lint)
-static const char sccsid[] = "@(#)strcasecmp.c	5.9 (Berkeley) 6/1/90";
-#endif /* LIBC_SCCS and not lint */
-
 typedef unsigned char u_char;
 
 /*
@@ -69,8 +65,7 @@
 };
 
 int
-strcasecmp(s1, s2)
-	const char *s1, *s2;
+strcasecmp(const char *s1, const char *s2)
 {
 	const u_char *cm = charmap,
 			*us1 = (const u_char *)s1,
@@ -83,9 +78,7 @@
 }
 
 int
-strncasecmp(s1, s2, n)
-	const char *s1, *s2;
-	size_t n;
+strncasecmp(const char *s1, const char *s2, size_t n)
 {
 	if (n != 0) {
 		const u_char *cm = charmap,

Modified: lib/strspn.c
===================================================================
--- lib/strspn.c	2016-07-31 20:16:07 UTC (rev 10041)
+++ lib/strspn.c	2016-08-04 19:52:13 UTC (rev 10042)
@@ -27,22 +27,12 @@
  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  */
 
-#if 0
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)strspn.c	5.7 (Berkeley) 6/1/90";
-#endif /* LIBC_SCCS and not lint */
 
-#include <sys/stdc.h>
-#include <string.h>
-#endif
-
 /*
  * Span the string s2 (skip characters that are in s2).
- */
+ */ 
 size_t
-strspn(s1, s2)
-	const char *s1;
-	const char *s2;
+strspn(const char *s1, const char *s2)
 {
 	const char *p = s1, *spanp;
 	char c, sc;

Modified: lib/strtok.c
===================================================================
--- lib/strtok.c	2016-07-31 20:16:07 UTC (rev 10041)
+++ lib/strtok.c	2016-08-04 19:52:13 UTC (rev 10042)
@@ -27,20 +27,11 @@
  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  */
 
-#if 0
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)strtok.c	5.7 (Berkeley) 6/1/90";
-#endif /* LIBC_SCCS and not lint */
 
-#include <stddef.h>
-#include <string.h>
-#endif
-
 char *
-strtok(s, delim)
-	char *s, *delim;
+strtok(char *s, const char *delim)
 {
-	char *spanp;
+	const char *spanp;
 	int c, sc;
 	char *tok;
 	static char *last;

Modified: lib/symlink.c
===================================================================
--- lib/symlink.c	2016-07-31 20:16:07 UTC (rev 10041)
+++ lib/symlink.c	2016-08-04 19:52:13 UTC (rev 10042)
@@ -8,6 +8,7 @@
 */
 
 #include "config.h"
+#include "clibrary.h"
 #include <errno.h>
 
 int



More information about the inn-committers mailing list