[RFC PATCH v3 04/14] print_fields.h: add PRINT_FIELD_LEN macro

Dmitry V. Levin ldv at altlinux.org
Sat Jun 13 13:22:08 UTC 2020


On Sat, Jun 13, 2020 at 01:25:26PM +0200, Ákos Uzonyi wrote:
[...]
> diff --git a/print_fields.h b/print_fields.h
> index 02c56bf9..f5f26b46 100644
> --- a/print_fields.h
> +++ b/print_fields.h
> @@ -277,4 +277,18 @@
>  			       (size_), (hwtype_));			\
>  	} while (0)
>  
> +# define PRINT_FIELD_LEN(prefix_, where_, field_, 			\
> +			len_, print_func_, args...)			\
> +	do {								\
> +		unsigned int start = offsetof(typeof(where_), field_);	\
> +		unsigned int end = start + sizeof(where_.field_);	\
> +		if (len_ >= end) {					\
> +			print_func_(prefix_, where_, field_, ##args);	\

In other places we use ##__VA_ARGS__, let's use it here instead of ##args,
too.


-- 
ldv


More information about the Strace-devel mailing list