summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArthur Heymans <arthur@aheymans.xyz>2019-02-05 16:14:55 +0100
committerNico Huber <nico.h@gmx.de>2019-06-06 16:18:02 +0000
commit32b9f5c665f4fd65d9ba742e72ae8e762f33762f (patch)
tree40050630587b90d86f83e9d32e442d5e78b301ec
parent2e50cdc494bf4e44c01e9e331b82a3633b1d9ef2 (diff)
downloadflashrom-32b9f5c665f4fd65d9ba742e72ae8e762f33762f.tar.gz
flashrom-32b9f5c665f4fd65d9ba742e72ae8e762f33762f.tar.bz2
flashrom-32b9f5c665f4fd65d9ba742e72ae8e762f33762f.zip
layout.c: Use the libflashrom function for included arguments
Use the libflashrom function to determine whether included regions are present in the layout file. Change-Id: I5e9375baad763612e179262973413a7161acba8b Signed-off-by: Arthur Heymans <arthur@aheymans.xyz> Reviewed-on: https://review.coreboot.org/c/flashrom/+/31244 Tested-by: Nico Huber <nico.h@gmx.de> Reviewed-by: Nico Huber <nico.h@gmx.de>
-rw-r--r--layout.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/layout.c b/layout.c
index 5080e3ed7..f75778335 100644
--- a/layout.c
+++ b/layout.c
@@ -135,24 +135,19 @@ int register_include_arg(char *name)
return 0;
}
-/* returns the index of the entry (or a negative value if it is not found) */
+/* returns -1 if an entry is not found, 0 if found. */
static int find_romentry(struct flashrom_layout *const l, char *name)
{
- int i;
-
if (l->num_entries == 0)
return -1;
msg_gspew("Looking for region \"%s\"... ", name);
- for (i = 0; i < l->num_entries; i++) {
- if (!strcmp(l->entries[i].name, name)) {
- l->entries[i].included = 1;
- msg_gspew("found.\n");
- return i;
- }
+ if (flashrom_layout_include_region(l, name)) {
+ msg_gspew("not found.\n");
+ return -1;
}
- msg_gspew("not found.\n");
- return -1;
+ msg_gspew("found.\n");
+ return 0;
}
/* process -i arguments