summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Heijligen <thomas.heijligen@secunet.de>2021-05-19 13:53:34 +0200
committerNico Huber <nico.h@gmx.de>2021-06-09 15:44:33 +0000
commit113f3bca1eeb6692574c53d1244bc64cb6f6e116 (patch)
treed48c0561b1c5b8c88981843f51fdb7b38ff3ab96
parent9cf3f8925b0a8029bad68717865c11211d3938dd (diff)
downloadflashrom-113f3bca1eeb6692574c53d1244bc64cb6f6e116.tar.gz
flashrom-113f3bca1eeb6692574c53d1244bc64cb6f6e116.tar.bz2
flashrom-113f3bca1eeb6692574c53d1244bc64cb6f6e116.zip
programmer_table: add table size constant
Makes the array size known to other compilation units. Change-Id: Idacb4b7b0dd98af8bc7cbecf567d33daafb4b24d Signed-off-by: Thomas Heijligen <thomas.heijligen@secunet.de> Reviewed-on: https://review.coreboot.org/c/flashrom/+/55116 Reviewed-by: Nico Huber <nico.h@gmx.de> Reviewed-by: Edward O'Callaghan <quasisec@chromium.org> Reviewed-by: Anastasia Klimchuk <aklm@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
-rw-r--r--flashrom.c4
-rw-r--r--programmer.h1
2 files changed, 4 insertions, 1 deletions
diff --git a/flashrom.c b/flashrom.c
index 65f7e73b2..43a5599b0 100644
--- a/flashrom.c
+++ b/flashrom.c
@@ -534,6 +534,8 @@ const struct programmer_entry programmer_table[] = {
#endif
};
+const size_t programmer_table_size = ARRAY_SIZE(programmer_table);
+
#define SHUTDOWN_MAXFN 32
static int shutdown_fn_count = 0;
/** @private */
@@ -2189,7 +2191,7 @@ int selfcheck(void)
/* Safety check. Instead of aborting after the first error, check
* if more errors exist.
*/
- if (ARRAY_SIZE(programmer_table) != PROGRAMMER_INVALID) {
+ if (programmer_table_size != PROGRAMMER_INVALID) {
msg_gerr("Programmer table miscompilation!\n");
ret = 1;
}
diff --git a/programmer.h b/programmer.h
index a0ff6bc63..945d0a7ff 100644
--- a/programmer.h
+++ b/programmer.h
@@ -176,6 +176,7 @@ struct programmer_entry {
};
extern const struct programmer_entry programmer_table[];
+extern const size_t programmer_table_size;
int programmer_init(enum programmer prog, const char *param);
int programmer_shutdown(void);