]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
Moves common fw_malloc() and fw_calloc() to xtables.c
authorYasuyuki KOZAKAI <yasuyuki@netfilter.org>
Tue, 24 Jul 2007 05:45:33 +0000 (05:45 +0000)
committerYasuyuki KOZAKAI <yasuyuki@netfilter.org>
Tue, 24 Jul 2007 05:45:33 +0000 (05:45 +0000)
include/xtables.h
ip6tables.c
iptables.c
xtables.c

index eed1dffc914baaa11f0e5d6f08cd151ce1144be8..6ef13fe18b693d42237efbffc8be048b8300db2f 100644 (file)
@@ -1,4 +1,7 @@
 #ifndef _XTABLES_H
 #define _XTABLES_H
 
+extern void *fw_calloc(size_t count, size_t size);
+extern void *fw_malloc(size_t size);
+
 #endif /* _XTABLES_H */
index 6b2766b7de494e30d2a284920ee9bf3db341a9f2..a096b7952fad962e3a9fbdc3ccbdd8a1954ea352 100644 (file)
@@ -36,6 +36,7 @@
 #include <stdarg.h>
 #include <limits.h>
 #include <ip6tables.h>
+#include <xtables.h>
 #include <arpa/inet.h>
 #include <unistd.h>
 #include <fcntl.h>
@@ -494,30 +495,6 @@ check_inverse(const char option[], int *invert, int *optind, int argc)
        return FALSE;
 }
 
-static void *
-fw_calloc(size_t count, size_t size)
-{
-       void *p;
-
-       if ((p = calloc(count, size)) == NULL) {
-               perror("ip6tables: calloc failed");
-               exit(1);
-       }
-       return p;
-}
-
-static void *
-fw_malloc(size_t size)
-{
-       void *p;
-
-       if ((p = malloc(size)) == NULL) {
-               perror("ip6tables: malloc failed");
-               exit(1);
-       }
-       return p;
-}
-
 static char *
 addr_to_numeric(const struct in6_addr *addrp)
 {
index 83b0c820a4868c67f9331e854900586c4dc49131..166016e35e611ae23462ec3f60d344e0fceaf077 100644 (file)
@@ -37,6 +37,7 @@
 #include <limits.h>
 #include <unistd.h>
 #include <iptables.h>
+#include <xtables.h>
 #include <fcntl.h>
 #include <sys/wait.h>
 #include <sys/utsname.h>
@@ -579,30 +580,6 @@ check_inverse(const char option[], int *invert, int *optind, int argc)
        return FALSE;
 }
 
-static void *
-fw_calloc(size_t count, size_t size)
-{
-       void *p;
-
-       if ((p = calloc(count, size)) == NULL) {
-               perror("iptables: calloc failed");
-               exit(1);
-       }
-       return p;
-}
-
-static void *
-fw_malloc(size_t size)
-{
-       void *p;
-
-       if ((p = malloc(size)) == NULL) {
-               perror("iptables: malloc failed");
-               exit(1);
-       }
-       return p;
-}
-
 static struct in_addr *
 host_to_addr(const char *name, unsigned int *naddr)
 {
index cc4d21849043c546fa2f9e98adb43045a7c48c44..667656a00b88bc54b01d51e9bd62742afea720ef 100644 (file)
--- a/xtables.c
+++ b/xtables.c
  *     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
+
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <iptables_common.h>
 #include <xtables.h>
+
+void *fw_calloc(size_t count, size_t size)
+{
+       void *p;
+
+       if ((p = calloc(count, size)) == NULL) {
+               perror("ip[6]tables: calloc failed");
+               exit(1);
+       }
+
+       return p;
+}
+
+void *fw_malloc(size_t size)
+{
+       void *p;
+
+       if ((p = malloc(size)) == NULL) {
+               perror("ip[6]tables: malloc failed");
+               exit(1);
+       }
+
+       return p;
+}