ACK: [PATCH 26/46] lib: fwts_backtrace: reduce scope of variables

Alex Hung alex.hung at canonical.com
Tue Jan 20 07:44:44 UTC 2015


On 01/14/2015 03:04 AM, Colin King wrote:
> From: Colin Ian King <colin.king at canonical.com>
> 
> cppcheck is picking up some minor style issues which can
> be easily fixed:
> 
> [src/lib/src/fwts_backtrace.c:44]:
> 	(style) The scope of the variable 'bt_strings' can be reduced.
> [src/lib/src/fwts_backtrace.c:45]:
> 	(style) The scope of the variable 'i' can be reduced.
> 
> Signed-off-by: Colin Ian King <colin.king at canonical.com>
> ---
>  src/lib/src/fwts_backtrace.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/src/lib/src/fwts_backtrace.c b/src/lib/src/fwts_backtrace.c
> index eb84b48..f8dd23f 100644
> --- a/src/lib/src/fwts_backtrace.c
> +++ b/src/lib/src/fwts_backtrace.c
> @@ -41,11 +41,11 @@ static size_t bt_size = 0;
>   */
>  void fwts_print_backtrace(void)
>  {
> -	char **bt_strings;
> -	size_t i;
> -
>  	fprintf(stderr, "Backtrace:\n");
>  	if (bt_size) {
> +		char **bt_strings;
> +		size_t i;
> +
>  		bt_strings = backtrace_symbols(bt_buff, bt_size);
>  
>  		for (i = 0; i < bt_size; i++) {
> 
Acked-by: Alex Hung <alex.hung at canonical.com>



More information about the fwts-devel mailing list