diff mbox

[32/46] lib: fwts_gpe: reduce scope of variables

Message ID 1421175905-17035-33-git-send-email-colin.king@canonical.com
State Accepted
Headers show

Commit Message

Colin Ian King Jan. 13, 2015, 7:04 p.m. UTC
From: Colin Ian King <colin.king@canonical.com>

cppcheck is picking up some minor style issues which can
be easily fixed:

[src/lib/src/fwts_gpe.c:35]:
	(style) The scope of the variable 'i' can be reduced.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 src/lib/src/fwts_gpe.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Ivan Hu Jan. 15, 2015, 7:36 a.m. UTC | #1
On 01/14/2015 03:04 AM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> cppcheck is picking up some minor style issues which can
> be easily fixed:
>
> [src/lib/src/fwts_gpe.c:35]:
> 	(style) The scope of the variable 'i' can be reduced.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>   src/lib/src/fwts_gpe.c | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/src/lib/src/fwts_gpe.c b/src/lib/src/fwts_gpe.c
> index a78c0d8..6ef759f 100644
> --- a/src/lib/src/fwts_gpe.c
> +++ b/src/lib/src/fwts_gpe.c
> @@ -32,10 +32,10 @@
>    */
>   void fwts_gpe_free(fwts_gpe *gpe, const int count)
>   {
> -	int i;
> -
>   	if (gpe) {
> -		for (i=0;i<count;i++) {
> +		int i;
> +
> +		for (i = 0; i < count; i++) {
>   			if (gpe[i].name)
>   				free(gpe[i].name);
>   		}
>

Acked-by: Ivan Hu <ivan.hu@canonical.com>
Alex Hung Jan. 20, 2015, 7:49 a.m. UTC | #2
On 01/14/2015 03:04 AM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> cppcheck is picking up some minor style issues which can
> be easily fixed:
> 
> [src/lib/src/fwts_gpe.c:35]:
> 	(style) The scope of the variable 'i' can be reduced.
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  src/lib/src/fwts_gpe.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/src/lib/src/fwts_gpe.c b/src/lib/src/fwts_gpe.c
> index a78c0d8..6ef759f 100644
> --- a/src/lib/src/fwts_gpe.c
> +++ b/src/lib/src/fwts_gpe.c
> @@ -32,10 +32,10 @@
>   */
>  void fwts_gpe_free(fwts_gpe *gpe, const int count)
>  {
> -	int i;
> -
>  	if (gpe) {
> -		for (i=0;i<count;i++) {
> +		int i;
> +
> +		for (i = 0; i < count; i++) {
>  			if (gpe[i].name)
>  				free(gpe[i].name);
>  		}
> 

Acked-by: Alex Hung <alex.hung@canonical.com>
diff mbox

Patch

diff --git a/src/lib/src/fwts_gpe.c b/src/lib/src/fwts_gpe.c
index a78c0d8..6ef759f 100644
--- a/src/lib/src/fwts_gpe.c
+++ b/src/lib/src/fwts_gpe.c
@@ -32,10 +32,10 @@ 
  */
 void fwts_gpe_free(fwts_gpe *gpe, const int count)
 {
-	int i;
-
 	if (gpe) {
-		for (i=0;i<count;i++) {
+		int i;
+
+		for (i = 0; i < count; i++) {
 			if (gpe[i].name)
 				free(gpe[i].name);
 		}