]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
Fix more sparse warnings: non-C99 array declaration, incorrect function prototypes
authorPatrick McHardy <kaber@trash.net>
Sat, 8 Sep 2007 16:00:01 +0000 (16:00 +0000)
committerPatrick McHardy <kaber@trash.net>
Sat, 8 Sep 2007 16:00:01 +0000 (16:00 +0000)
include/xtables.h
ip6tables.c
iptables.c
libiptc/libiptc.c

index 5f0caea3185809e41d9d9747a577d9608cd3ad31..de5ecb13132e05a3990ec100475c052c86f415ad 100644 (file)
@@ -220,8 +220,6 @@ enum exittype {
 /* 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)));
index d43029ebdbbd7a1cf076512f8d4ec0450d236632..3a54c86f81d5aee98235db0394f23037b0ae2c8d 100644 (file)
@@ -267,27 +267,7 @@ static void free_opts(int reset_offset)
        }
 }
 
-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_tryhelp(int status)
        exit(status);
 }
 
-void
+static void
 exit_printhelp(struct ip6tables_rule_match *matches)
 {
        struct ip6tables_rule_match *matchp = NULL;
@@ -380,6 +360,26 @@ exit_printhelp(struct ip6tables_rule_match *matches)
        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)
 {
index 549c6cd035d08b3c233df621d6ebd4f45e2d781f..900e8fc1126e6fe8b5cef782f36cde3732ab04db 100644 (file)
@@ -99,38 +99,38 @@ static const char optflags[NUMBER_OF_OPT]
 = { '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' },
-       { }
+       { "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 @@ static void free_opts(int reset_offset)
        }
 }
 
-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_tryhelp(int status)
        exit(status);
 }
 
-void
+static void
 exit_printhelp(struct iptables_rule_match *matches)
 {
        struct iptables_rule_match *matchp = NULL;
@@ -464,6 +444,26 @@ exit_printhelp(struct iptables_rule_match *matches)
        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)
 {
index 574cc0abf7b21dde38c6739424ec56c11d335253..9e4571ce0afd2e2b8882993d674c68772603dd2d 100644 (file)
@@ -48,14 +48,14 @@ static int sockfd = -1;
 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 @@ out_zero:
 
 /* Get raw socket. */
 int
-TC_GET_RAW_SOCKET()
+TC_GET_RAW_SOCKET(void)
 {
        return sockfd;
 }