From 46439a3e8d6635a1461ff4c43665fb1425cadd1d Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Sat, 13 Jul 2013 21:56:06 +0200 Subject: expr: add nft_expr_data to replace explicit casting to obtain expression data Signed-off-by: Pablo Neira Ayuso --- src/expr/limit.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/expr/limit.c') diff --git a/src/expr/limit.c b/src/expr/limit.c index cce74ce..f2f7703 100644 --- a/src/expr/limit.c +++ b/src/expr/limit.c @@ -32,7 +32,7 @@ static int nft_rule_expr_limit_set(struct nft_rule_expr *e, uint16_t type, const void *data, size_t data_len) { - struct nft_expr_limit *limit = (struct nft_expr_limit *)e->data; + struct nft_expr_limit *limit = nft_expr_data(e); switch(type) { case NFT_EXPR_LIMIT_RATE: @@ -51,7 +51,7 @@ static const void * nft_rule_expr_limit_get(const struct nft_rule_expr *e, uint16_t type, size_t *data_len) { - struct nft_expr_limit *limit = (struct nft_expr_limit *)e->data; + struct nft_expr_limit *limit = nft_expr_data(e); switch(type) { case NFT_EXPR_LIMIT_RATE: @@ -97,7 +97,7 @@ static int nft_rule_expr_limit_cb(const struct nlattr *attr, void *data) static void nft_rule_expr_limit_build(struct nlmsghdr *nlh, struct nft_rule_expr *e) { - struct nft_expr_limit *limit = (struct nft_expr_limit *)e->data; + struct nft_expr_limit *limit = nft_expr_data(e); if (e->flags & (1 << NFT_EXPR_LIMIT_RATE)) mnl_attr_put_u64(nlh, NFTA_LIMIT_RATE, htobe64(limit->rate)); @@ -108,7 +108,7 @@ nft_rule_expr_limit_build(struct nlmsghdr *nlh, struct nft_rule_expr *e) static int nft_rule_expr_limit_parse(struct nft_rule_expr *e, struct nlattr *attr) { - struct nft_expr_limit *limit = (struct nft_expr_limit *)e->data; + struct nft_expr_limit *limit = nft_expr_data(e); struct nlattr *tb[NFTA_LIMIT_MAX+1] = {}; if (mnl_attr_parse_nested(attr, nft_rule_expr_limit_cb, tb) < 0) @@ -129,7 +129,7 @@ nft_rule_expr_limit_parse(struct nft_rule_expr *e, struct nlattr *attr) static int nft_rule_expr_limit_xml_parse(struct nft_rule_expr *e, mxml_node_t *tree) { #ifdef XML_PARSING - struct nft_expr_limit *limit = (struct nft_expr_limit *)e->data; + struct nft_expr_limit *limit = nft_expr_data(e); mxml_node_t *node = NULL; uint64_t tmp; char *endptr; @@ -172,7 +172,7 @@ static int nft_rule_expr_limit_snprintf(char *buf, size_t len, uint32_t type, uint32_t flags, struct nft_rule_expr *e) { - struct nft_expr_limit *limit = (struct nft_expr_limit *)e->data; + struct nft_expr_limit *limit = nft_expr_data(e); switch(type) { case NFT_RULE_O_DEFAULT: -- cgit v1.2.3