[PATCH v4 2/9] ipsec: replace unnecessary comma operator

Bruce Richardson bruce.richardson at intel.com
Mon Aug 18 18:34:28 CEST 2025


On Mon, Aug 18, 2025 at 09:18:07AM -0700, Stephen Hemminger wrote:
> Use of comma as statement separator is discouraged and
> reported as warning by clang with -Wcomma
> 
> Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
> Acked-by: Konstantin Ananyev <konstantin.ananyev at huawei.com>
> Acked-by: Chengwen Feng <fengchengwen at huawei.com>
> Acked-by: Morten Brørup <mb at smartsharesystems.com>
> ---
>  lib/ipsec/misc.h | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/lib/ipsec/misc.h b/lib/ipsec/misc.h
> index fd4d3f5256..eee3bb0c1f 100644
> --- a/lib/ipsec/misc.h
> +++ b/lib/ipsec/misc.h
> @@ -19,12 +19,9 @@ static inline void
>  move_bad_mbufs(struct rte_mbuf *mb[], const uint32_t bad_idx[], uint32_t nb_mb,
>  	uint32_t nb_bad)
>  {
> -	uint32_t i, j, k;
> +	uint32_t i, j = 0, k = 0;
>  	struct rte_mbuf *drb[nb_bad];
>  
> -	j = 0;
> -	k = 0;
> -
>  	/* copy bad ones into a temp place */
>  	for (i = 0; i != nb_mb; i++) {
>  		if (j != nb_bad && i == bad_idx[j])
> @@ -126,7 +123,8 @@ cpu_crypto_bulk(const struct rte_ipsec_session *ss,
>  
>  	const uint32_t vnum = RTE_DIM(vec);
>  
> -	j = 0, n = 0;
> +	j = 0;
> +	n = 0;

Nit: These can also be assigned at definition time.

>  	vofs = 0;
>  	for (i = 0; i != num; i++) {
>  
> -- 
> 2.47.2
> 


More information about the dev mailing list