ACK: [PATCH 37/46] reduce scope of variables

Alex Hung alex.hung at canonical.com
Tue Jan 20 07:54:57 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_summary.c:184]:
> 	(style) The scope of the variable 'sorted' can be reduced.
> [src/lib/src/fwts_summary.c:185]:
> 	(style) The scope of the variable 'item' can be reduced.
> 
> Signed-off-by: Colin Ian King <colin.king at canonical.com>
> ---
>  src/lib/src/fwts_summary.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/src/lib/src/fwts_summary.c b/src/lib/src/fwts_summary.c
> index e55b840..2a8ef1d 100644
> --- a/src/lib/src/fwts_summary.c
> +++ b/src/lib/src/fwts_summary.c
> @@ -181,8 +181,6 @@ static void fwts_summary_format_field(
>  int fwts_summary_report(fwts_framework *fw, fwts_list *test_list)
>  {
>  	int i;
> -	fwts_list      *sorted;
> -	fwts_list_link *item;
>  
>  	fwts_log_summary(fw, "Test Failure Summary");
>  	fwts_log_underline(fw->results, '=');
> @@ -223,7 +221,9 @@ int fwts_summary_report(fwts_framework *fw, fwts_list *test_list)
>  
>  	if ((fw->log_type & (LOG_TYPE_PLAINTEXT| LOG_TYPE_HTML)) &&
>  	     fw->total_run > 0) {
> -		sorted = fwts_list_new();
> +		fwts_list_link *item;
> +		fwts_list *sorted = fwts_list_new();
> +
>  		fwts_list_foreach(item, test_list)
>  			fwts_list_add_ordered(sorted, fwts_list_data(fwts_framework_test *,item), fwts_framework_compare_test_name);
>  
> 
Acked-by: Alex Hung <alex.hung at canonical.com>



More information about the fwts-devel mailing list