From 5fe7f4f6d18990b9d5fd336fef16b3a09cfbc8b1 Mon Sep 17 00:00:00 2001 From: Felix Singer Date: Fri, 19 Aug 2022 00:19:26 +0200 Subject: internal.c: Retype appropriate variables with bool Use the bool type instead of an integer for the variables `force_laptop`, `not_a_laptop`, `force_boardenable` and `force_boardmismatch` since this represents their purpose much better. Signed-off-by: Felix Singer Change-Id: I159d789112d7a778744b59b45133df3928b8445e Reviewed-on: https://review.coreboot.org/c/flashrom/+/66870 Tested-by: build bot (Jenkins) Reviewed-by: Anastasia Klimchuk Reviewed-by: Angel Pons --- internal.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'internal.c') diff --git a/internal.c b/internal.c index 426730fd..ce1debeb 100644 --- a/internal.c +++ b/internal.c @@ -16,6 +16,7 @@ #include #include +#include #include #include "flash.h" #include "programmer.h" @@ -29,8 +30,8 @@ int is_laptop = 0; int laptop_ok = 0; -int force_boardenable = 0; -int force_boardmismatch = 0; +bool force_boardenable = false; +bool force_boardmismatch = false; enum chipbustype internal_buses_supported = BUS_NONE; @@ -117,21 +118,21 @@ static const struct par_master par_master_internal = { }; static int get_params(const struct programmer_cfg *cfg, - int *boardenable, int *boardmismatch, - int *force_laptop, int *not_a_laptop, + bool *boardenable, bool *boardmismatch, + bool *force_laptop, bool *not_a_laptop, char **board_vendor, char **board_model) { char *arg; /* default values. */ - *force_laptop = 0; - *not_a_laptop = 0; + *force_laptop = false; + *not_a_laptop = false; *board_vendor = NULL; *board_model = NULL; arg = extract_programmer_param_str(cfg, "boardenable"); if (arg && !strcmp(arg,"force")) { - *boardenable = 1; + *boardenable = true; } else if (arg && !strlen(arg)) { msg_perr("Missing argument for boardenable.\n"); free(arg); @@ -145,7 +146,7 @@ static int get_params(const struct programmer_cfg *cfg, arg = extract_programmer_param_str(cfg, "boardmismatch"); if (arg && !strcmp(arg,"force")) { - *boardmismatch = 1; + *boardmismatch = true; } else if (arg && !strlen(arg)) { msg_perr("Missing argument for boardmismatch.\n"); free(arg); @@ -159,9 +160,9 @@ static int get_params(const struct programmer_cfg *cfg, arg = extract_programmer_param_str(cfg, "laptop"); if (arg && !strcmp(arg, "force_I_want_a_brick")) - *force_laptop = 1; + *force_laptop = true; else if (arg && !strcmp(arg, "this_is_not_a_laptop")) - *not_a_laptop = 1; + *not_a_laptop = true; else if (arg && !strlen(arg)) { msg_perr("Missing argument for laptop.\n"); free(arg); @@ -192,8 +193,8 @@ static int get_params(const struct programmer_cfg *cfg, static int internal_init(const struct programmer_cfg *cfg) { int ret = 0; - int force_laptop; - int not_a_laptop; + bool force_laptop; + bool not_a_laptop; char *board_vendor; char *board_model; #if defined(__i386__) || defined(__x86_64__) -- cgit v1.2.3