]> git.ipfire.org Git - thirdparty/ipset.git/commitdiff
libipset: remove redundant casts
authorJan Engelhardt <jengelh@medozas.de>
Sun, 19 Dec 2010 02:09:09 +0000 (03:09 +0100)
committerJan Engelhardt <jengelh@medozas.de>
Sun, 19 Dec 2010 05:12:19 +0000 (06:12 +0100)
lib/data.c
lib/parse.c
lib/session.c

index 2719b8412e2faeefdb36db561ab1f624d8d94c00..022e4b4effdf83330383a0ffe993a89c877903a2 100644 (file)
@@ -79,9 +79,9 @@ static void
 copy_addr(uint8_t family, union nf_inet_addr *ip, const void *value)
 {
        if (family == AF_INET)
-               in4cpy(&ip->in, (const struct in_addr *)value);
+               in4cpy(&ip->in, value);
        else
-               in6cpy(&ip->in6, (const struct in6_addr *)value);
+               in6cpy(&ip->in6, value);
 }
 
 /**
index 01b0ccf56afbd6df832e7e51fcb6b47bf9b42774..437ff61c556e6f0d2d849ca917ce758ff3acbdcc 100644 (file)
@@ -48,7 +48,7 @@ ipset_strchr(const char *str, const char *sep)
        assert(sep);
        
        for (; *sep != '\0'; sep++)
-               if ((match = strchr(str, (int)sep[0])) != NULL
+               if ((match = strchr(str, sep[0])) != NULL
                    && str[0] != sep[0]
                    && str[strlen(str)-1] != sep[0])
                        return match;
@@ -103,7 +103,7 @@ string_to_u8(struct ipset_session *session,
        unsigned long long num = 0;
 
        err = string_to_number_ll(session, str, 0, 255, &num);
-       *ret = (uint8_t) num;
+       *ret = num;
 
        return err;
 }
@@ -129,7 +129,7 @@ string_to_u16(struct ipset_session *session,
        unsigned long long num = 0;
 
        err = string_to_number_ll(session, str, 0, USHRT_MAX, &num);
-       *ret = (uint16_t) num;
+       *ret = num;
 
        return err;
 }
@@ -142,7 +142,7 @@ string_to_u32(struct ipset_session *session,
        unsigned long long num = 0;
 
        err = string_to_number_ll(session, str, 0, UINT_MAX, &num);
-       *ret = (uint32_t) num;
+       *ret = num;
 
        return err;
 }
index babd881e890ba544e746b8de5ce9296cfe95278b..d04380693c856c86cd843f580231a7e79687f6a7 100644 (file)
@@ -468,7 +468,7 @@ static int
 generic_data_attr_cb(const struct nlattr *attr, void *data,
                     int attr_max, const struct ipset_attr_policy *policy)
 {
-       const struct nlattr **tb = (const struct nlattr **)data;
+       const struct nlattr **tb = data;
        int type = mnl_attr_get_type(attr);
        
        D("attr type: %u, len %u", type, attr->nla_len);
@@ -1464,7 +1464,7 @@ static int
 build_send_private_msg(struct ipset_session *session, enum ipset_cmd cmd)
 {
        char buffer[PRIVATE_MSG_BUFLEN] __attribute__ ((aligned));
-       struct nlmsghdr *nlh = (struct nlmsghdr *) (void *) buffer;
+       struct nlmsghdr *nlh = (void *)buffer;
        struct ipset_data *data = session->data;
        int len = PRIVATE_MSG_BUFLEN, ret;
        enum ipset_cmd saved = session->cmd;
@@ -1521,7 +1521,7 @@ may_aggregate_ad(struct ipset_session *session, struct ipset_data *data,
 static int
 build_msg(struct ipset_session *session, bool aggregate)
 {
-       struct nlmsghdr *nlh = (struct nlmsghdr *) session->buffer;
+       struct nlmsghdr *nlh = session->buffer;
        struct ipset_data *data = session->data;
 
        /* Public commands */
@@ -1678,7 +1678,7 @@ ipset_commit(struct ipset_session *session)
 
        assert(session);
 
-       nlh = (struct nlmsghdr *) session->buffer;
+       nlh = session->buffer;
        D("send buffer: len %u, cmd %s", nlh->nlmsg_len, cmd2name[session->cmd]);
        if (nlh->nlmsg_len == 0)
                /* Nothing to do */