flashrom.c: Retype appropriate variables with bool
Use the bool type instead of an integer for appropriate variables, since
this represents their purpose much better.
Signed-off-by: Felix Singer <felixsinger@posteo.net>
Change-Id: I6629f391284c8f1266e4ba66c9976f3df43955d4
Original-Reviewed-on: https://review.coreboot.org/c/flashrom/+/66883
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/+/71482
Reviewed-by: Nico Huber <nico.h@gmx.de>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
diff --git a/flashrom.c b/flashrom.c
index 1048164..88a7402 100644
--- a/flashrom.c
+++ b/flashrom.c
@@ -19,6 +19,7 @@
* GNU General Public License for more details.
*/
+#include <stdbool.h>
#include <stdio.h>
#include <sys/types.h>
#ifndef __LIBPAYLOAD__
@@ -67,7 +68,7 @@
/* Initialize to 0 to make sure nobody registers a shutdown function before
* programmer init.
*/
-static int may_register_shutdown = 0;
+static bool may_register_shutdown = false;
/* Did we change something or was every erase/write skipped (if any)? */
static bool all_skipped = true;
@@ -155,7 +156,7 @@
/* Default to top aligned flash at 4 GB. */
flashbase = 0;
/* Registering shutdown functions is now allowed. */
- may_register_shutdown = 1;
+ may_register_shutdown = true;
/* Default to allowing writes. Broken programmers set this to 0. */
programmer_may_write = 1;
@@ -191,7 +192,7 @@
int ret = 0;
/* Registering shutdown functions is no longer allowed. */
- may_register_shutdown = 0;
+ may_register_shutdown = false;
while (shutdown_fn_count > 0) {
int i = --shutdown_fn_count;
ret |= shutdown_fn[i].func(shutdown_fn[i].data);
@@ -543,7 +544,7 @@
unsigned int *first_start,
enum write_granularity gran)
{
- int need_write = 0;
+ bool need_write = false;
unsigned int rel_start = 0, first_len = 0;
unsigned int i, limit, stride;
@@ -588,7 +589,7 @@
if (memcmp(have + i * stride, want + i * stride, limit)) {
if (!need_write) {
/* First location where have and want differ. */
- need_write = 1;
+ need_write = true;
rel_start = i * stride;
}
} else {