[PATCH v3 04/14] test: cryptodev use rte_pktmbuf_mtod_offset

Ferruh Yigit ferruh.yigit at amd.com
Fri Jul 7 14:46:07 CEST 2023


On 7/6/2023 6:59 PM, Stephen Hemminger wrote:
> Based off patch generated by cocci/mtod-offset.cocci.
> With some cleanup to shorten lines by using conditional
> with omitted operand.
> 
> Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>

<...>

> @@ -5163,9 +5169,9 @@ test_snow3g_auth_cipher(const struct snow3g_test_data *tdata,
>  		debug_hexdump(stdout, "ciphertext expected:",
>  			tdata->ciphertext.data, tdata->ciphertext.len >> 3);
>  
> -		ut_params->digest = rte_pktmbuf_mtod(ut_params->obuf, uint8_t *)
> -			+ (tdata->digest.offset_bytes == 0 ?
> -		plaintext_pad_len : tdata->digest.offset_bytes);
> +		ut_params->digest = rte_pktmbuf_mtod_offset(ut_params->obuf,
> +					uint8_t *,
> +					tdata->digest.offset_bytes ? : plaintext_pad_len);
>  

As far as I know "x ?: y" support is gcc extention, what about sticking
to standard syntax?


More information about the dev mailing list