[netfilter-cvslog] r7039 - in trunk/iptables: . include libiptc

kaber at trash.net kaber at trash.net
Sat Sep 8 18:00:01 CEST 2007


Author: kaber at trash.net
Date: 2007-09-08 18:00:01 +0200 (Sat, 08 Sep 2007)
New Revision: 7039

Modified:
   trunk/iptables/include/xtables.h
   trunk/iptables/ip6tables.c
   trunk/iptables/iptables.c
   trunk/iptables/libiptc/libiptc.c
Log:
Fix more sparse warnings: non-C99 array declaration, incorrect function prototypes


Modified: trunk/iptables/include/xtables.h
===================================================================
--- trunk/iptables/include/xtables.h	2007-09-08 15:59:04 UTC (rev 7038)
+++ trunk/iptables/include/xtables.h	2007-09-08 16:00:01 UTC (rev 7039)
@@ -220,8 +220,6 @@
 /* this is a special 64bit data type that is 8-byte aligned */
 #define aligned_u64 u_int64_t __attribute__((aligned(8)))
 
-extern void exit_printhelp() __attribute__((noreturn));
-extern void exit_tryhelp(int) __attribute__((noreturn));
 int check_inverse(const char option[], int *invert, int *optind, int argc);
 void exit_error(enum exittype, const char *, ...)__attribute__((noreturn,
 							  format(printf,2,3)));

Modified: trunk/iptables/ip6tables.c
===================================================================
--- trunk/iptables/ip6tables.c	2007-09-08 15:59:04 UTC (rev 7038)
+++ trunk/iptables/ip6tables.c	2007-09-08 16:00:01 UTC (rev 7039)
@@ -267,27 +267,7 @@
 	}
 }
 
-void
-exit_error(enum exittype status, const char *msg, ...)
-{
-	va_list args;
-
-	va_start(args, msg);
-	fprintf(stderr, "%s v%s: ", program_name, program_version);
-	vfprintf(stderr, msg, args);
-	va_end(args);
-	fprintf(stderr, "\n");
-	if (status == PARAMETER_PROBLEM)
-		exit_tryhelp(status);
-	if (status == VERSION_PROBLEM)
-		fprintf(stderr,
-			"Perhaps ip6tables or your kernel needs to be upgraded.\n");
-	/* On error paths, make sure that we don't leak memory */
-	free_opts(1);
-	exit(status);
-}
-
-void
+static void
 exit_tryhelp(int status)
 {
 	if (line != -1)
@@ -298,7 +278,7 @@
 	exit(status);
 }
 
-void
+static void
 exit_printhelp(struct ip6tables_rule_match *matches)
 {
 	struct ip6tables_rule_match *matchp = NULL;
@@ -380,6 +360,26 @@
 	exit(0);
 }
 
+void
+exit_error(enum exittype status, const char *msg, ...)
+{
+	va_list args;
+
+	va_start(args, msg);
+	fprintf(stderr, "%s v%s: ", program_name, program_version);
+	vfprintf(stderr, msg, args);
+	va_end(args);
+	fprintf(stderr, "\n");
+	if (status == PARAMETER_PROBLEM)
+		exit_tryhelp(status);
+	if (status == VERSION_PROBLEM)
+		fprintf(stderr,
+			"Perhaps ip6tables or your kernel needs to be upgraded.\n");
+	/* On error paths, make sure that we don't leak memory */
+	free_opts(1);
+	exit(status);
+}
+
 static void
 generic_opt_check(int command, int options)
 {

Modified: trunk/iptables/iptables.c
===================================================================
--- trunk/iptables/iptables.c	2007-09-08 15:59:04 UTC (rev 7038)
+++ trunk/iptables/iptables.c	2007-09-08 16:00:01 UTC (rev 7039)
@@ -99,38 +99,38 @@
 = { 'n', 's', 'd', 'p', 'j', 'v', 'x', 'i', 'o', 'f', '0', 'c'};
 
 static struct option original_opts[] = {
-	{ "append", 1, 0, 'A' },
-	{ "delete", 1, 0,  'D' },
-	{ "insert", 1, 0,  'I' },
-	{ "replace", 1, 0,  'R' },
-	{ "list", 2, 0,  'L' },
-	{ "flush", 2, 0,  'F' },
-	{ "zero", 2, 0,  'Z' },
-	{ "new-chain", 1, 0,  'N' },
-	{ "delete-chain", 2, 0,  'X' },
-	{ "rename-chain", 1, 0,  'E' },
-	{ "policy", 1, 0,  'P' },
-	{ "source", 1, 0, 's' },
-	{ "destination", 1, 0,  'd' },
-	{ "src", 1, 0,  's' }, /* synonym */
-	{ "dst", 1, 0,  'd' }, /* synonym */
-	{ "protocol", 1, 0,  'p' },
-	{ "in-interface", 1, 0, 'i' },
-	{ "jump", 1, 0, 'j' },
-	{ "table", 1, 0, 't' },
-	{ "match", 1, 0, 'm' },
-	{ "numeric", 0, 0, 'n' },
-	{ "out-interface", 1, 0, 'o' },
-	{ "verbose", 0, 0, 'v' },
-	{ "exact", 0, 0, 'x' },
-	{ "fragments", 0, 0, 'f' },
-	{ "version", 0, 0, 'V' },
-	{ "help", 2, 0, 'h' },
-	{ "line-numbers", 0, 0, '0' },
-	{ "modprobe", 1, 0, 'M' },
-	{ "set-counters", 1, 0, 'c' },
-	{ "goto", 1, 0, 'g' },
-	{ 0 }
+	{ "append", 1, NULL, 'A' },
+	{ "delete", 1, NULL,  'D' },
+	{ "insert", 1, NULL,  'I' },
+	{ "replace", 1, NULL,  'R' },
+	{ "list", 2, NULL,  'L' },
+	{ "flush", 2, NULL,  'F' },
+	{ "zero", 2, NULL,  'Z' },
+	{ "new-chain", 1, NULL,  'N' },
+	{ "delete-chain", 2, NULL,  'X' },
+	{ "rename-chain", 1, NULL,  'E' },
+	{ "policy", 1, NULL,  'P' },
+	{ "source", 1, NULL, 's' },
+	{ "destination", 1, NULL,  'd' },
+	{ "src", 1, NULL,  's' }, /* synonym */
+	{ "dst", 1, NULL,  'd' }, /* synonym */
+	{ "protocol", 1, NULL,  'p' },
+	{ "in-interface", 1, NULL, 'i' },
+	{ "jump", 1, NULL, 'j' },
+	{ "table", 1, NULL, 't' },
+	{ "match", 1, NULL, 'm' },
+	{ "numeric", 0, NULL, 'n' },
+	{ "out-interface", 1, NULL, 'o' },
+	{ "verbose", 0, NULL, 'v' },
+	{ "exact", 0, NULL, 'x' },
+	{ "fragments", 0, NULL, 'f' },
+	{ "version", 0, NULL, 'V' },
+	{ "help", 2, NULL, 'h' },
+	{ "line-numbers", 0, NULL, '0' },
+	{ "modprobe", 1, NULL, 'M' },
+	{ "set-counters", 1, NULL, 'c' },
+	{ "goto", 1, NULL, 'g' },
+	{ }
 };
 
 /* we need this for iptables-restore.  iptables-restore.c sets line to the
@@ -347,27 +347,7 @@
 	}
 }
 
-void
-exit_error(enum exittype status, const char *msg, ...)
-{
-	va_list args;
-
-	va_start(args, msg);
-	fprintf(stderr, "%s v%s: ", program_name, program_version);
-	vfprintf(stderr, msg, args);
-	va_end(args);
-	fprintf(stderr, "\n");
-	if (status == PARAMETER_PROBLEM)
-		exit_tryhelp(status);
-	if (status == VERSION_PROBLEM)
-		fprintf(stderr,
-			"Perhaps iptables or your kernel needs to be upgraded.\n");
-	/* On error paths, make sure that we don't leak memory */
-	free_opts(1);
-	exit(status);
-}
-
-void
+static void
 exit_tryhelp(int status)
 {
 	if (line != -1)
@@ -378,7 +358,7 @@
 	exit(status);
 }
 
-void
+static void
 exit_printhelp(struct iptables_rule_match *matches)
 {
 	struct iptables_rule_match *matchp = NULL;
@@ -464,6 +444,26 @@
 	exit(0);
 }
 
+void
+exit_error(enum exittype status, const char *msg, ...)
+{
+	va_list args;
+
+	va_start(args, msg);
+	fprintf(stderr, "%s v%s: ", program_name, program_version);
+	vfprintf(stderr, msg, args);
+	va_end(args);
+	fprintf(stderr, "\n");
+	if (status == PARAMETER_PROBLEM)
+		exit_tryhelp(status);
+	if (status == VERSION_PROBLEM)
+		fprintf(stderr,
+			"Perhaps iptables or your kernel needs to be upgraded.\n");
+	/* On error paths, make sure that we don't leak memory */
+	free_opts(1);
+	exit(status);
+}
+
 static void
 generic_opt_check(int command, int options)
 {

Modified: trunk/iptables/libiptc/libiptc.c
===================================================================
--- trunk/iptables/libiptc/libiptc.c	2007-09-08 15:59:04 UTC (rev 7038)
+++ trunk/iptables/libiptc/libiptc.c	2007-09-08 16:00:01 UTC (rev 7039)
@@ -48,14 +48,14 @@
 static int sockfd_use = 0;
 static void *iptc_fn = NULL;
 
-static const char *hooknames[]
-= { [HOOK_PRE_ROUTING]  "PREROUTING",
-    [HOOK_LOCAL_IN]     "INPUT",
-    [HOOK_FORWARD]      "FORWARD",
-    [HOOK_LOCAL_OUT]    "OUTPUT",
-    [HOOK_POST_ROUTING] "POSTROUTING",
+static const char *hooknames[] = {
+	[HOOK_PRE_ROUTING]	= "PREROUTING",
+	[HOOK_LOCAL_IN]		= "INPUT",
+	[HOOK_FORWARD]		= "FORWARD",
+	[HOOK_LOCAL_OUT]	= "OUTPUT",
+	[HOOK_POST_ROUTING]	= "POSTROUTING",
 #ifdef HOOK_DROPPING
-    [HOOK_DROPPING]	"DROPPING"
+	[HOOK_DROPPING]		= "DROPPING"
 #endif
 };
 
@@ -2206,7 +2206,7 @@
 
 /* Get raw socket. */
 int
-TC_GET_RAW_SOCKET()
+TC_GET_RAW_SOCKET(void)
 {
 	return sockfd;
 }




More information about the netfilter-cvslog mailing list