Various compilation error fixes
cover Various compilation error fixes
Hi,
Here are 4 patches fixing build issues, on gcc-4.7 (though the 2 first issues could be found on earlier version of gcc)
Please review,
Tomasz Bursztyka (4):
netlink: Use the right datatype for verdict
evaluate: Remove useless variable in expr_evaluate_bitwise()
erec: Handle returned value properly in erec_print
expression: Differentiate expr among anonymous structures in struct
expr
include/expression.h | 4 ++-- src/erec.c | 7 ++++--- src/evaluate.c | 23 +++++++++++------------ src/expression.c | 20 ++++++++++---------- src/netlink.c | 2 +- src/netlink_delinearize.c | 2 +- src/netlink_linearize.c | 2 +- src/segtree.c | 4 ++-- 8 files changed, 32 insertions(+), 32 deletions(-)
Signature · 1 line
1.7.8.6
PATCH 1/4 netlink: Use the right datatype for verdict
--- src/netlink.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
src/netlink.c +1 -1
@@ -898,7 +898,7 @@ static void list_setelem_cb(struct nl_object *obj, void *arg) nld =nfnl_nft_setelem_get_data (nlse); data =netlink_alloc_data (&internal_location, nld, - set->datatype->type ==EXPR_VERDICT ? + set->datatype->type ==TYPE_VERDICT ?NFT_REG_VERDICT :NFT_REG_1 ); data->dtype = set->datatype;
Signature · 1 line
1.7.8.6
PATCH 2/4 evaluate: Remove useless variable in expr_evaluate_bitwise()
In reply to Tomasz Bursztyka--- src/evaluate.c | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-)
src/evaluate.c +1 -2
@@ -493,11 +493,10 @@ static int expr_evaluate_shift(struct eval_ctx *ctx, struct expr **expr)static int expr_evaluate_bitwise (struct eval_ctx *ctx,struct expr **expr) { -struct expr *op = *expr, *left = op->left, *right = op->right; +struct expr *op = *expr, *left = op->left;if (byteorder_conversion (ctx, &op->right, left->byteorder) <0 )return -1 ; - right = op->right; op->dtype = left->dtype; op->byteorder = left->byteorder;
Signature · 1 line
1.7.8.6
PATCH 3/4 erec: Handle returned value properly in erec_print
In reply to Tomasz Bursztyka--- src/erec.c | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-)
src/erec.c +4 -3
@@ -78,7 +78,7 @@ void erec_print(FILE *f, const struct error_record *erec)const char *line =NULL ;/* silence gcc */ char buf[1024 ];unsigned int i, end; -int l; +int l, ret;switch (indesc->type) {case INDESC_BUFFER :
@@ -88,8 +88,9 @@ void erec_print(FILE *f, const struct error_record *erec)case INDESC_FILE :memset (buf,0 ,sizeof (buf));lseek (indesc->fd, loc->line_offset,SEEK_SET ); -read (indesc->fd, buf,sizeof (buf) -1 ); - *strchrnul (buf,'\n' ) ='\0' ; + ret =read (indesc->fd, buf,sizeof (buf) -1 ); +if (ret >0 ) + *strchrnul (buf,'\n' ) ='\0' ; line = buf;break ;case INDESC_INTERNAL :
Signature · 1 line
1.7.8.6
PATCH 4/4 expression: Differentiate expr among anonymous structures in struct expr
In reply to Tomasz Bursztyka--- include/expression.h | 4 ++-- src/evaluate.c | 20 ++++++++++---------- src/expression.c | 20 ++++++++++---------- src/netlink_delinearize.c | 2 +- src/netlink_linearize.c | 2 +- src/segtree.c | 4 ++-- 6 files changed, 26 insertions(+), 26 deletions(-)
include/expression.h +2 -2
@@ -195,7 +195,7 @@ struct expr { };struct {/* EXPR_PREFIX */ -struct expr *expr; +struct expr *prefix;unsigned int prefix_len; };struct {
@@ -219,7 +219,7 @@ struct expr { };struct {/* EXPR_MAP */ -struct expr *expr; +struct expr *map;struct expr *mappings; };
src/evaluate.c +10 -10
@@ -291,9 +291,9 @@ static int expr_evaluate_prefix(struct eval_ctx *ctx, struct expr **expr) {struct expr *prefix = *expr, *base, *and, *mask; -if (expr_evaluate (ctx, &prefix->expr) <0 ) +if (expr_evaluate (ctx, &prefix->prefix) <0 )return -1 ; - base = prefix->expr; + base = prefix->prefix;if (!expr_is_constant (base)) return expr_error(ctx, prefix,
@@ -317,10 +317,10 @@ static int expr_evaluate_prefix(struct eval_ctx *ctx, struct expr **expr)mpz_prefixmask (mask->value, base->len, prefix->prefix_len); and =binop_expr_alloc (&prefix->location,OP_AND , base, mask); - prefix->expr = and; -if (expr_evaluate (ctx, &prefix->expr) <0 ) + prefix->prefix = and; +if (expr_evaluate (ctx, &prefix->prefix) <0 )return -1 ; - base = prefix->expr; + base = prefix->prefix;assert (expr_is_constant (base)); prefix->dtype = base->dtype;
@@ -656,10 +656,10 @@ static int expr_evaluate_map(struct eval_ctx *ctx, struct expr **expr)struct expr_ctx ectx = ctx->ectx;struct expr *map = *expr, *mappings; -if (expr_evaluate (ctx, &map->expr) <0 ) +if (expr_evaluate (ctx, &map->map) <0 )return -1 ; -if (expr_is_constant (map->expr)) -return expr_error (ctx, map->expr, +if (expr_is_constant (map->map)) +return expr_error (ctx, map->map,"Map expression can not be constant" ); mappings = map->mappings;
@@ -695,7 +695,7 @@ static int expr_evaluate_map(struct eval_ctx *ctx, struct expr **expr)/* Data for range lookups needs to be in big endian order */ if (map->mappings->set_flags &SET_F_INTERVAL && -byteorder_conversion (ctx, &map->expr,BYTEORDER_BIG_ENDIAN ) <0 ) +byteorder_conversion (ctx, &map->map,BYTEORDER_BIG_ENDIAN ) <0 )return -1 ;return 0 ;
@@ -895,7 +895,7 @@ static int expr_evaluate_relational(struct eval_ctx *ctx, struct expr **expr)case EXPR_RANGE : goto range;case EXPR_PREFIX : -if (byteorder_conversion (ctx, &right->expr, left->byteorder) <0 ) +if (byteorder_conversion (ctx, &right->prefix, left->byteorder) <0 )return -1 ;break ;case EXPR_VALUE :
src/expression.c +10 -10
@@ -302,7 +302,7 @@ struct expr *constant_expr_splice(struct expr *expr, unsigned int len)static void prefix_expr_print (const struct expr *expr) { -expr_print (expr->expr); +expr_print (expr->prefix);printf ("/%u" , expr->prefix_len); }
@@ -310,18 +310,18 @@ static void prefix_expr_set_type(const struct expr *expr,const struct datatype *type, enum byteorder byteorder) { - expr_set_type(expr->expr, type, byteorder); + expr_set_type(expr->prefix, type, byteorder); }static void prefix_expr_clone (struct expr *new,const struct expr *expr) { - new->expr =expr_clone (expr->expr); + new->prefix =expr_clone (expr->prefix); new->prefix_len = expr->prefix_len; }static void prefix_expr_destroy (struct expr *expr) { -expr_free (expr->expr); +expr_free (expr->prefix); } static const struct expr_ops prefix_expr_ops = {
@@ -340,7 +340,7 @@ struct expr *prefix_expr_alloc(const struct location *loc, prefix =expr_alloc (loc, &prefix_expr_ops, &invalid_type,BYTEORDER_INVALID ,0 ); - prefix->expr = expr; + prefix->prefix = expr; prefix->prefix_len = prefix_len;return prefix; }
@@ -374,7 +374,7 @@ static void unary_expr_print(const struct expr *expr)static void unary_expr_clone (struct expr *new,const struct expr *expr) { - new->arg =expr_clone (expr->expr); + new->arg =expr_clone (expr->arg); }static void unary_expr_destroy (struct expr *expr)
@@ -680,20 +680,20 @@ struct expr *mapping_expr_alloc(const struct location *loc,static void map_expr_print (const struct expr *expr) { -expr_print (expr->expr); +expr_print (expr->map);printf (" map " );expr_print (expr->mappings); }static void map_expr_clone (struct expr *new,const struct expr *expr) { - new->expr =expr_clone (expr->expr); + new->map =expr_clone (expr->map); new->mappings =expr_clone (expr->mappings); }static void map_expr_destroy (struct expr *expr) { -expr_free (expr->expr); +expr_free (expr->map);expr_free (expr->mappings); }
@@ -711,7 +711,7 @@ struct expr *map_expr_alloc(const struct location *loc, struct expr *arg,struct expr *expr; expr =expr_alloc (loc, &map_expr_ops, &invalid_type,BYTEORDER_INVALID ,0 ); - expr->expr = arg; + expr->map = arg; expr->mappings = mappings;return expr; }
src/netlink_delinearize.c +1 -1
@@ -533,7 +533,7 @@ static void expr_postprocess(struct rule_pp_ctx *ctx,switch (expr->ops->type) {case EXPR_MAP : -expr_postprocess (ctx, stmt, &expr->expr); +expr_postprocess (ctx, stmt, &expr->map);expr_postprocess (ctx, stmt, &expr->mappings);break ;case EXPR_MAPPING :
src/netlink_linearize.c +1 -1
@@ -114,7 +114,7 @@ static void netlink_gen_map(struct netlink_linearize_ctx *ctx,else sreg = dreg; -netlink_gen_expr (ctx, expr->expr, sreg); +netlink_gen_expr (ctx, expr->map, sreg); nle =alloc_nft_expr (nfnl_nft_lookup_init);nfnl_nft_lookup_set_sreg (nle, sreg);
src/segtree.c +2 -2
@@ -240,7 +240,7 @@ static void range_low(mpz_t rop, struct expr *expr)case EXPR_VALUE :return mpz_set (rop, expr->value);case EXPR_PREFIX : -return range_low (rop, expr->expr); +return range_low (rop, expr->prefix);case EXPR_RANGE :return range_low (rop, expr->left);case EXPR_MAPPING :
@@ -258,7 +258,7 @@ static void range_high(mpz_t rop, const struct expr *expr)case EXPR_VALUE :return mpz_set (rop, expr->value);case EXPR_PREFIX : -range_low (rop, expr->expr); +range_low (rop, expr->prefix);mpz_init_bitmask (tmp, expr->len - expr->prefix_len);mpz_add (rop, rop, tmp);mpz_clear (tmp);
Signature · 1 line
1.7.8.6
Pablo Neira Ayuso
maintainerQuoted 5 lines · Tomasz Bursztyka
Hi,
Here are 4 patches fixing build issues, on gcc-4.7 (though the 2 first issues could be found on earlier version of gcc)
Quoted 7 lines
Please review,
Tomasz Bursztyka (4):
netlink: Use the right datatype for verdict
evaluate: Remove useless variable inexpr_evaluate_bitwise()
erec: Handle returned value properly inerec_print
expression: Differentiate expr among anonymous structures in struct expr
All applied, thanks Thomasz.