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

yasuyuki at netfilter.org yasuyuki at netfilter.org
Tue Jul 24 07:45:34 CEST 2007


Author: yasuyuki at netfilter.org
Date: 2007-07-24 07:45:33 +0200 (Tue, 24 Jul 2007)
New Revision: 6918

Modified:
   trunk/iptables/include/xtables.h
   trunk/iptables/ip6tables.c
   trunk/iptables/iptables.c
   trunk/iptables/xtables.c
Log:
Moves common fw_malloc() and fw_calloc() to xtables.c



Modified: trunk/iptables/include/xtables.h
===================================================================
--- trunk/iptables/include/xtables.h	2007-07-24 05:44:11 UTC (rev 6917)
+++ trunk/iptables/include/xtables.h	2007-07-24 05:45:33 UTC (rev 6918)
@@ -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 */

Modified: trunk/iptables/ip6tables.c
===================================================================
--- trunk/iptables/ip6tables.c	2007-07-24 05:44:11 UTC (rev 6917)
+++ trunk/iptables/ip6tables.c	2007-07-24 05:45:33 UTC (rev 6918)
@@ -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 @@
 	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)
 {

Modified: trunk/iptables/iptables.c
===================================================================
--- trunk/iptables/iptables.c	2007-07-24 05:44:11 UTC (rev 6917)
+++ trunk/iptables/iptables.c	2007-07-24 05:45:33 UTC (rev 6918)
@@ -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 @@
 	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)
 {

Modified: trunk/iptables/xtables.c
===================================================================
--- trunk/iptables/xtables.c	2007-07-24 05:44:11 UTC (rev 6917)
+++ trunk/iptables/xtables.c	2007-07-24 05:45:33 UTC (rev 6918)
@@ -16,4 +16,34 @@
  *	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;
+}




More information about the netfilter-cvslog mailing list