Re: [libgpiod][PATCH 02/16] tests: avoid shadowing local variables with common names in macros

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

 



On Fri, Jan 13, 2023 at 10:51:56PM +0100, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bartosz.golaszewski@xxxxxxxxxx>
> 
> The name 'ret' if very common for local variables so change it to _ret
> in test helper macros to avoid potential shadowing.

Makes sense!
Reviewed-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>

> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@xxxxxxxxxx>
> ---
>  tests/gpiod-test-helpers.h | 16 ++++++++--------
>  1 file changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/tests/gpiod-test-helpers.h b/tests/gpiod-test-helpers.h
> index 2d86345..b40b820 100644
> --- a/tests/gpiod-test-helpers.h
> +++ b/tests/gpiod-test-helpers.h
> @@ -118,11 +118,11 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(struct_gpiod_edge_event_buffer,
>  #define gpiod_test_line_config_add_line_settings_or_fail(_line_cfg, _offsets, \
>  						_num_offsets, _settings) \
>  	do { \
> -		gint ret = gpiod_line_config_add_line_settings(_line_cfg, \
> -							       _offsets,  \
> -							       _num_offsets, \
> -							       _settings); \
> -		g_assert_cmpint(ret, ==, 0); \
> +		gint _ret = gpiod_line_config_add_line_settings(_line_cfg, \
> +								_offsets,  \
> +								_num_offsets, \
> +								_settings); \
> +		g_assert_cmpint(_ret, ==, 0); \
>  		gpiod_test_return_if_failed(); \
>  	} while (0)
>  
> @@ -147,9 +147,9 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(struct_gpiod_edge_event_buffer,
>  
>  #define gpiod_test_reconfigure_lines_or_fail(_request, _line_cfg) \
>  	do { \
> -		gint ret = gpiod_line_request_reconfigure_lines(_request, \
> -								_line_cfg); \
> -		g_assert_cmpint(ret, ==, 0); \
> +		gint _ret = gpiod_line_request_reconfigure_lines(_request, \
> +								 _line_cfg); \
> +		g_assert_cmpint(_ret, ==, 0); \
>  		gpiod_test_return_if_failed(); \
>  	} while (0)
>  
> -- 
> 2.37.2
> 

-- 
With Best Regards,
Andy Shevchenko





[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux