]> git.ipfire.org Git - thirdparty/xtables-addons.git/commitdiff
geoip: remove redundant casts
authorJan Engelhardt <jengelh@computergmbh.de>
Mon, 17 Mar 2008 12:26:11 +0000 (13:26 +0100)
committerJan Engelhardt <jengelh@computergmbh.de>
Sat, 22 Mar 2008 02:59:44 +0000 (03:59 +0100)
extensions/libxt_geoip.c
extensions/xt_geoip.c

index 82e3375673e170d565ec9e5597b8d23cd6b5ffe3..1d3a1bbf4cbfc0b4e4dfdee8f6190c9972349bdb 100644 (file)
@@ -80,7 +80,7 @@ get_country_subnets(u_int16_t cc, u_int32_t *count)
    
    stat("/var/geoip/geoipdb.idx", &buf);
    idxsz = buf.st_size/sizeof(struct geoip_index);
-   index = (struct geoip_index *)malloc(buf.st_size);
+   index = malloc(buf.st_size);
 
    fread(index, buf.st_size, 1, ixfd);
 
@@ -110,7 +110,7 @@ get_country_subnets(u_int16_t cc, u_int32_t *count)
             
    fread(&db_nsubnets, sizeof(u_int16_t), 1, dbfd);
 
-   subnets = (struct geoip_subnet*)malloc(db_nsubnets * sizeof(struct geoip_subnet));
+   subnets = malloc(db_nsubnets * sizeof(struct geoip_subnet));
 
    if (!subnets)
       exit_error(OTHER_PROBLEM,
index 61084dbdd84fa3602ef2712a56a580332ed62aa0..953dede605f909ba5bce0d5a1c9661c7d5ff2dc6 100644 (file)
@@ -32,15 +32,14 @@ static spinlock_t geoip_lock = SPIN_LOCK_UNLOCKED;
 
 static struct geoip_info *add_node(struct geoip_info *memcpy)
 {
-   struct geoip_info *p =
-      (struct geoip_info *)kmalloc(sizeof(struct geoip_info), GFP_KERNEL);
+   struct geoip_info *p = kmalloc(sizeof(struct geoip_info), GFP_KERNEL);
 
    struct geoip_subnet *s;
    
    if ((p == NULL) || (copy_from_user(p, memcpy, sizeof(struct geoip_info)) != 0))
       return NULL;
 
-   s = (struct geoip_subnet *)kmalloc(p->count * sizeof(struct geoip_subnet), GFP_KERNEL);
+   s = kmalloc(p->count * sizeof(struct geoip_subnet), GFP_KERNEL);
    if ((s == NULL) || (copy_from_user(s, p->subnets, p->count * sizeof(struct geoip_subnet)) != 0))
       return NULL;
   
@@ -109,7 +108,7 @@ static bool xt_geoip_mt(const struct sk_buff *skb,
                       unsigned int protoff,
                       bool *hotdrop)
 {
-   const struct xt_geoip_match_info *info = (void*)matchinfo;
+   const struct xt_geoip_match_info *info = matchinfo;
    const struct geoip_info *node; /* This keeps the code sexy */
    const struct iphdr *iph = ip_hdr(skb);
    u_int32_t ip, i, j;
@@ -146,7 +145,7 @@ static bool xt_geoip_mt_checkentry(const char *tablename,
                                  unsigned int hook_mas)
 {
    
-   struct xt_geoip_match_info *info = (void *)matchinfo;
+   struct xt_geoip_match_info *info = matchinfo;
    struct geoip_info *node;
    u_int8_t i;
 
@@ -176,7 +175,7 @@ static bool xt_geoip_mt_checkentry(const char *tablename,
 static void xt_geoip_mt_destroy(const struct xt_match *matcn,
                                void *matchinfo)
 {
-   struct xt_geoip_match_info *info = (void *)matchinfo;
+   struct xt_geoip_match_info *info = matchinfo;
    struct geoip_info *node; /* this keeps the code sexy */
    u_int8_t i;