Re: [PATCH nft 5/5] src: expr: remove expr_ops from struct expr

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Feb 08, 2019 at 05:02:23PM +0100, Florian Westphal wrote:
> @@ -52,11 +59,11 @@ struct expr *expr_clone(const struct expr *expr)
>  {
>  	struct expr *new;
>  
> -	new = expr_alloc(&expr->location, expr->ops, expr->dtype,
> +	new = expr_alloc(&expr->location, expr->etype, expr->dtype,
>  			 expr->byteorder, expr->len);
>  	new->flags = expr->flags;
>  	new->op    = expr->op;
> -	expr->ops->clone(new, expr);
> +	expr_ops(expr)->clone(new, expr);
>  	return new;
>  }
>  
> @@ -70,7 +77,7 @@ static void expr_destroy(struct expr *e)
>  {
>  	const struct expr_ops *ops = expr_ops(e);
>  
> -	if (ops && ops->destroy)
> +	if (ops->destroy)

expr->ops should be always set, so I guess this is fine.

>  		ops->destroy(e);
>  }
>  
> @@ -81,7 +88,8 @@ void expr_free(struct expr *expr)
>  	if (--expr->refcnt > 0)
>  		return;
>  
> -	expr_destroy(expr);
> +	if (expr->etype != EXPR_INVALID)
> +		expr_destroy(expr);

Any way to skip this branch?

This is for compound expressions?



[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux