[01/13] lib: fwts_cpu: make found a boolean
diff mbox series

Message ID 20180814112435.22166-2-colin.king@canonical.com
State Accepted
Headers show
Series
  • lib: minor code clean up
Related show

Commit Message

Colin King Aug. 14, 2018, 11:24 a.m. UTC
From: Colin Ian King <colin.king@canonical.com>

Variable found should be a boolean rather than an int

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

Comments

Alex Hung Aug. 14, 2018, 7:14 p.m. UTC | #1
On 2018-08-14 04:24 AM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> Variable found should be a boolean rather than an int
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>   src/lib/src/fwts_cpu.c | 5 +++--
>   1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/src/lib/src/fwts_cpu.c b/src/lib/src/fwts_cpu.c
> index 6806418c..e79f5b0a 100644
> --- a/src/lib/src/fwts_cpu.c
> +++ b/src/lib/src/fwts_cpu.c
> @@ -107,7 +107,8 @@ fwts_cpuinfo_x86 *fwts_cpu_get_info(int which_cpu)
>   	FILE *fp;
>   	char buffer[1024];
>   	fwts_cpuinfo_x86 *cpu;
> -	int cpu_num = -1, found = 0;
> +	int cpu_num = -1;
> +	bool found = false;
>   
>   	if ((cpu = (fwts_cpuinfo_x86*)calloc(1, sizeof(fwts_cpuinfo_x86))) == NULL)
>   		return NULL;
> @@ -138,7 +139,7 @@ fwts_cpuinfo_x86 *fwts_cpu_get_info(int which_cpu)
>   				continue;
>   		}
>   
> -		found = 1;
> +		found = true;
>   
>   		if (!strncmp(buffer, "vendor_id", 9)) {
>   			cpu->vendor_id = strdup(ptr);
> 

Acked-by: Alex Hung <alex.hung@canonical.com>
ivanhu Aug. 16, 2018, 9:02 a.m. UTC | #2
On 08/14/2018 07:24 PM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> Variable found should be a boolean rather than an int
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  src/lib/src/fwts_cpu.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/src/lib/src/fwts_cpu.c b/src/lib/src/fwts_cpu.c
> index 6806418c..e79f5b0a 100644
> --- a/src/lib/src/fwts_cpu.c
> +++ b/src/lib/src/fwts_cpu.c
> @@ -107,7 +107,8 @@ fwts_cpuinfo_x86 *fwts_cpu_get_info(int which_cpu)
>  	FILE *fp;
>  	char buffer[1024];
>  	fwts_cpuinfo_x86 *cpu;
> -	int cpu_num = -1, found = 0;
> +	int cpu_num = -1;
> +	bool found = false;
>  
>  	if ((cpu = (fwts_cpuinfo_x86*)calloc(1, sizeof(fwts_cpuinfo_x86))) == NULL)
>  		return NULL;
> @@ -138,7 +139,7 @@ fwts_cpuinfo_x86 *fwts_cpu_get_info(int which_cpu)
>  				continue;
>  		}
>  
> -		found = 1;
> +		found = true;
>  
>  		if (!strncmp(buffer, "vendor_id", 9)) {
>  			cpu->vendor_id = strdup(ptr);

Acked-by: Ivan Hu <ivan.hu@canonical.com>

Patch
diff mbox series

diff --git a/src/lib/src/fwts_cpu.c b/src/lib/src/fwts_cpu.c
index 6806418c..e79f5b0a 100644
--- a/src/lib/src/fwts_cpu.c
+++ b/src/lib/src/fwts_cpu.c
@@ -107,7 +107,8 @@  fwts_cpuinfo_x86 *fwts_cpu_get_info(int which_cpu)
 	FILE *fp;
 	char buffer[1024];
 	fwts_cpuinfo_x86 *cpu;
-	int cpu_num = -1, found = 0;
+	int cpu_num = -1;
+	bool found = false;
 
 	if ((cpu = (fwts_cpuinfo_x86*)calloc(1, sizeof(fwts_cpuinfo_x86))) == NULL)
 		return NULL;
@@ -138,7 +139,7 @@  fwts_cpuinfo_x86 *fwts_cpu_get_info(int which_cpu)
 				continue;
 		}
 
-		found = 1;
+		found = true;
 
 		if (!strncmp(buffer, "vendor_id", 9)) {
 			cpu->vendor_id = strdup(ptr);