summaryrefslogtreecommitdiffstats
path: root/libiptc
diff options
context:
space:
mode:
authorJan Engelhardt <jengelh@medozas.de>2011-08-27 11:39:52 +0200
committerJan Engelhardt <jengelh@medozas.de>2011-09-11 17:31:35 +0200
commit1639fe86579f86f5f6a954a9b0adde2e16ad1980 (patch)
tree20e8008b2b19cebf1e58c8e2b1ba2c802f475c96 /libiptc
parent7e5e866a36a76c153e5903b8251f90cfe07a1d34 (diff)
libiptc: combine common types: _handle
No real API/ABI change incurred, since the definition of the structs' types is not visible anyhow. Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
Diffstat (limited to 'libiptc')
-rw-r--r--libiptc/libip4tc.c9
-rw-r--r--libiptc/libip6tc.c5
-rw-r--r--libiptc/libiptc.c5
3 files changed, 6 insertions, 13 deletions
diff --git a/libiptc/libip4tc.c b/libiptc/libip4tc.c
index b9e50c5e..cf292381 100644
--- a/libiptc/libip4tc.c
+++ b/libiptc/libip4tc.c
@@ -47,9 +47,6 @@ typedef unsigned int socklen_t;
#define STRUCT_STANDARD_TARGET struct ipt_standard_target
#define STRUCT_REPLACE struct ipt_replace
-#define STRUCT_TC_HANDLE struct iptc_handle
-#define xtc_handle iptc_handle
-
#define ENTRY_ITERATE IPT_ENTRY_ITERATE
#define TABLE_MAXNAMELEN IPT_TABLE_MAXNAMELEN
#define FUNCTION_MAXNAMELEN IPT_FUNCTION_MAXNAMELEN
@@ -123,7 +120,7 @@ typedef unsigned int socklen_t;
#define IP_PARTS(n) IP_PARTS_NATIVE(ntohl(n))
static int
-dump_entry(struct ipt_entry *e, struct iptc_handle *const handle)
+dump_entry(struct ipt_entry *e, struct xtc_handle *const handle)
{
size_t i;
STRUCT_ENTRY_TARGET *t;
@@ -238,7 +235,7 @@ check_match(const STRUCT_ENTRY_MATCH *m, unsigned int *off)
static inline int
check_entry(const STRUCT_ENTRY *e, unsigned int *i, unsigned int *off,
unsigned int user_offset, int *was_return,
- struct iptc_handle *h)
+ struct xtc_handle *h)
{
unsigned int toff;
STRUCT_STANDARD_TARGET *t;
@@ -314,7 +311,7 @@ check_entry(const STRUCT_ENTRY *e, unsigned int *i, unsigned int *off,
#ifdef IPTC_DEBUG
/* Do every conceivable sanity check on the handle */
static void
-do_check(struct iptc_handle *h, unsigned int line)
+do_check(struct xtc_handle *h, unsigned int line)
{
unsigned int i, n;
unsigned int user_offset; /* Offset of first user chain */
diff --git a/libiptc/libip6tc.c b/libiptc/libip6tc.c
index 93366e2d..636466f1 100644
--- a/libiptc/libip6tc.c
+++ b/libiptc/libip6tc.c
@@ -45,9 +45,6 @@ typedef unsigned int socklen_t;
#define STRUCT_STANDARD_TARGET struct ip6t_standard_target
#define STRUCT_REPLACE struct ip6t_replace
-#define STRUCT_TC_HANDLE struct ip6tc_handle
-#define xtc_handle ip6tc_handle
-
#define ENTRY_ITERATE IP6T_ENTRY_ITERATE
#define TABLE_MAXNAMELEN IP6T_TABLE_MAXNAMELEN
#define FUNCTION_MAXNAMELEN IP6T_FUNCTION_MAXNAMELEN
@@ -131,7 +128,7 @@ ipv6_prefix_length(const struct in6_addr *a)
}
static int
-dump_entry(struct ip6t_entry *e, struct ip6tc_handle *const handle)
+dump_entry(struct ip6t_entry *e, struct xtc_handle *const handle)
{
size_t i;
char buf[40];
diff --git a/libiptc/libiptc.c b/libiptc/libiptc.c
index 0a29a690..593c5de8 100644
--- a/libiptc/libiptc.c
+++ b/libiptc/libiptc.c
@@ -121,8 +121,7 @@ struct chain_head
unsigned int foot_offset; /* offset in rule blob */
};
-STRUCT_TC_HANDLE
-{
+struct xtc_handle {
int sockfd;
int changed; /* Have changes been made? */
@@ -1270,7 +1269,7 @@ alloc_handle(const char *tablename, unsigned int size, unsigned int num_rules)
{
struct xtc_handle *h;
- h = malloc(sizeof(STRUCT_TC_HANDLE));
+ h = malloc(sizeof(*h));
if (!h) {
errno = ENOMEM;
return NULL;