diff mbox

[24/46] hpet: hpet_check: reduce scope of variables

Message ID 1421175905-17035-25-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/hpet/hpet_check/hpet_check.c:40]:
	(style) The scope of the variable 'idx' can be reduced.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 src/hpet/hpet_check/hpet_check.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Ivan Hu Jan. 15, 2015, 7:34 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/hpet/hpet_check/hpet_check.c:40]:
> 	(style) The scope of the variable 'idx' can be reduced.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>   src/hpet/hpet_check/hpet_check.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/src/hpet/hpet_check/hpet_check.c b/src/hpet/hpet_check/hpet_check.c
> index 3a985e6..41b57bf 100644
> --- a/src/hpet/hpet_check/hpet_check.c
> +++ b/src/hpet/hpet_check/hpet_check.c
> @@ -37,11 +37,11 @@ static void     *hpet_base_v = 0;
>   static void hpet_parse_check_base(fwts_framework *fw,
>   	const char *table, fwts_list_link *item)
>   {
> -	char *val, *idx;
> +	char *val;
>
>   	if ((val = strstr(fwts_text_list_text(item), "0x")) != NULL) {
>   		uint64_t address_base;
> -		idx = index(val, ',');
> +		char *idx = index(val, ',');
>   		if (idx)
>   			*idx = '\0';
>
>

Acked-by: Ivan Hu <ivan.hu@canonical.com>
Alex Hung Jan. 20, 2015, 7:43 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/hpet/hpet_check/hpet_check.c:40]:
> 	(style) The scope of the variable 'idx' can be reduced.
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  src/hpet/hpet_check/hpet_check.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/hpet/hpet_check/hpet_check.c b/src/hpet/hpet_check/hpet_check.c
> index 3a985e6..41b57bf 100644
> --- a/src/hpet/hpet_check/hpet_check.c
> +++ b/src/hpet/hpet_check/hpet_check.c
> @@ -37,11 +37,11 @@ static void     *hpet_base_v = 0;
>  static void hpet_parse_check_base(fwts_framework *fw,
>  	const char *table, fwts_list_link *item)
>  {
> -	char *val, *idx;
> +	char *val;
>  
>  	if ((val = strstr(fwts_text_list_text(item), "0x")) != NULL) {
>  		uint64_t address_base;
> -		idx = index(val, ',');
> +		char *idx = index(val, ',');
>  		if (idx)
>  			*idx = '\0';
>  
> 

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

Patch

diff --git a/src/hpet/hpet_check/hpet_check.c b/src/hpet/hpet_check/hpet_check.c
index 3a985e6..41b57bf 100644
--- a/src/hpet/hpet_check/hpet_check.c
+++ b/src/hpet/hpet_check/hpet_check.c
@@ -37,11 +37,11 @@  static void     *hpet_base_v = 0;
 static void hpet_parse_check_base(fwts_framework *fw,
 	const char *table, fwts_list_link *item)
 {
-	char *val, *idx;
+	char *val;
 
 	if ((val = strstr(fwts_text_list_text(item), "0x")) != NULL) {
 		uint64_t address_base;
-		idx = index(val, ',');
+		char *idx = index(val, ',');
 		if (idx)
 			*idx = '\0';