1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-04-29 16:03:47 +02:00

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
Reviewed-on: https://review.coreboot.org/c/flashrom/+/66883
Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
This commit is contained in:
Felix Singer 2022-08-19 02:44:28 +02:00 committed by Anastasia Klimchuk
parent a715893e02
commit bf85c62a8d

View File

@ -19,6 +19,7 @@
* GNU General Public License for more details. * GNU General Public License for more details.
*/ */
#include <stdbool.h>
#include <stdio.h> #include <stdio.h>
#include <sys/types.h> #include <sys/types.h>
#include <string.h> #include <string.h>
@ -61,7 +62,7 @@ static struct shutdown_func_data {
/* Initialize to 0 to make sure nobody registers a shutdown function before /* Initialize to 0 to make sure nobody registers a shutdown function before
* programmer init. * 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)? */ /* Did we change something or was every erase/write skipped (if any)? */
static bool all_skipped = true; static bool all_skipped = true;
@ -145,7 +146,7 @@ int programmer_init(const struct programmer_entry *prog, const char *param)
/* Default to top aligned flash at 4 GB. */ /* Default to top aligned flash at 4 GB. */
flashbase = 0; flashbase = 0;
/* Registering shutdown functions is now allowed. */ /* Registering shutdown functions is now allowed. */
may_register_shutdown = 1; may_register_shutdown = true;
/* Default to allowing writes. Broken programmers set this to 0. */ /* Default to allowing writes. Broken programmers set this to 0. */
programmer_may_write = 1; programmer_may_write = 1;
@ -181,7 +182,7 @@ int programmer_shutdown(void)
int ret = 0; int ret = 0;
/* Registering shutdown functions is no longer allowed. */ /* Registering shutdown functions is no longer allowed. */
may_register_shutdown = 0; may_register_shutdown = false;
while (shutdown_fn_count > 0) { while (shutdown_fn_count > 0) {
int i = --shutdown_fn_count; int i = --shutdown_fn_count;
ret |= shutdown_fn[i].func(shutdown_fn[i].data); ret |= shutdown_fn[i].func(shutdown_fn[i].data);
@ -517,7 +518,7 @@ static unsigned int get_next_write(const uint8_t *have, const uint8_t *want, uns
unsigned int *first_start, unsigned int *first_start,
enum write_granularity gran) enum write_granularity gran)
{ {
int need_write = 0; bool need_write = false;
unsigned int rel_start = 0, first_len = 0; unsigned int rel_start = 0, first_len = 0;
unsigned int i, limit, stride; unsigned int i, limit, stride;
@ -562,7 +563,7 @@ static unsigned int get_next_write(const uint8_t *have, const uint8_t *want, uns
if (memcmp(have + i * stride, want + i * stride, limit)) { if (memcmp(have + i * stride, want + i * stride, limit)) {
if (!need_write) { if (!need_write) {
/* First location where have and want differ. */ /* First location where have and want differ. */
need_write = 1; need_write = true;
rel_start = i * stride; rel_start = i * stride;
} }
} else { } else {