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 <felixsinger@posteo.net>
Change-Id: I159d789112d7a778744b59b45133df3928b8445e
Original-Reviewed-on: https://review.coreboot.org/c/flashrom/+/66870
Original-Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
Original-Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-on: https://review.coreboot.org/c/flashrom-stable/+/72353
Reviewed-by: Nico Huber <nico.h@gmx.de>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
diff --git a/include/programmer.h b/include/programmer.h
index 8821f0e..537d139 100644
--- a/include/programmer.h
+++ b/include/programmer.h
@@ -20,6 +20,7 @@
#ifndef __PROGRAMMER_H__
#define __PROGRAMMER_H__ 1
+#include <stdbool.h>
#include <stdint.h>
#include "flash.h" /* for chipaddr and flashctx */
@@ -260,8 +261,8 @@
#if CONFIG_INTERNAL == 1
extern int is_laptop;
extern bool laptop_ok;
-extern int force_boardenable;
-extern int force_boardmismatch;
+extern bool force_boardenable;
+extern bool force_boardmismatch;
void probe_superio(void);
int register_superio(struct superio s);
extern enum chipbustype internal_buses_supported;
diff --git a/internal.c b/internal.c
index 59719d2..8d0b905 100644
--- a/internal.c
+++ b/internal.c
@@ -16,6 +16,7 @@
#include <strings.h>
#include <string.h>
+#include <stdbool.h>
#include <stdlib.h>
#include "flash.h"
#include "programmer.h"
@@ -26,8 +27,8 @@
#include "hwaccess_x86_io.h"
#endif
-int force_boardenable = 0;
-int force_boardmismatch = 0;
+bool force_boardenable = false;
+bool force_boardmismatch = false;
#if defined(__i386__) || defined(__x86_64__)
void probe_superio(void)
@@ -87,21 +88,21 @@
enum chipbustype internal_buses_supported = BUS_NONE;
-static int get_params(int *boardenable, int *boardmismatch,
- int *force_laptop, int *not_a_laptop,
+static int get_params(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("boardenable");
if (arg && !strcmp(arg,"force")) {
- *boardenable = 1;
+ *boardenable = true;
} else if (arg && !strlen(arg)) {
msg_perr("Missing argument for boardenable.\n");
free(arg);
@@ -115,7 +116,7 @@
arg = extract_programmer_param("boardmismatch");
if (arg && !strcmp(arg,"force")) {
- *boardmismatch = 1;
+ *boardmismatch = true;
} else if (arg && !strlen(arg)) {
msg_perr("Missing argument for boardmismatch.\n");
free(arg);
@@ -129,9 +130,9 @@
arg = extract_programmer_param("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);
@@ -162,8 +163,8 @@
static int internal_init(void)
{
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__)