Nico Huber submitted this change.

View Change

Approvals: build bot (Jenkins): Verified Nico Huber: Looks good to me, approved Edward O'Callaghan: Looks good to me, approved Anastasia Klimchuk: Looks good to me, but someone else must approve
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>
---
M flashrom.c
M programmer.h
2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/flashrom.c b/flashrom.c
index 65f7e73..43a5599 100644
--- a/flashrom.c
+++ b/flashrom.c
@@ -534,6 +534,8 @@
#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 @@
/* 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 a0ff6bc..945d0a7 100644
--- a/programmer.h
+++ b/programmer.h
@@ -176,6 +176,7 @@
};

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);

To view, visit change 55116. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: Idacb4b7b0dd98af8bc7cbecf567d33daafb4b24d
Gerrit-Change-Number: 55116
Gerrit-PatchSet: 5
Gerrit-Owner: Thomas Heijligen <src@posteo.de>
Gerrit-Reviewer: Anastasia Klimchuk <aklm@chromium.org>
Gerrit-Reviewer: Angel Pons <th3fanbus@gmail.com>
Gerrit-Reviewer: Edward O'Callaghan <quasisec@chromium.org>
Gerrit-Reviewer: Nico Huber <nico.h@gmx.de>
Gerrit-Reviewer: build bot (Jenkins) <no-reply@coreboot.org>
Gerrit-CC: Paul Menzel <paulepanter@mailbox.org>
Gerrit-CC: Xiang W <wxjstz@126.com>
Gerrit-MessageType: merged