Thomas Heijligen has uploaded this change for review. ( https://review.coreboot.org/c/flashrom/+/55117 )
Change subject: programmer_table: replace PROGRAMMER_INVALID to programmer_table_size in itterations ......................................................................
programmer_table: replace PROGRAMMER_INVALID to programmer_table_size in itterations
Change-Id: Icaaeefe001de604df9d7fdd06f05a5ed39fdbd84 Signed-off-by: Thomas Heijligen thomas.heijligen@secunet.de --- M cli_classic.c M flashrom.c M libflashrom.c M print.c M print_wiki.c 5 files changed, 14 insertions(+), 14 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/17/55117/1
diff --git a/cli_classic.c b/cli_classic.c index bc2d40d..f3ae123 100644 --- a/cli_classic.c +++ b/cli_classic.c @@ -406,7 +406,7 @@ "with ",". Please see the man page " "for details.\n"); } - for (prog = 0; prog < PROGRAMMER_INVALID; prog++) { + for (prog = 0; prog < programmer_table_size; prog++) { name = programmer_table[prog]->name; namelen = strlen(name); if (strncmp(optarg, name, namelen) == 0) { diff --git a/flashrom.c b/flashrom.c index d6b35c6..bb4dd31 100644 --- a/flashrom.c +++ b/flashrom.c @@ -134,7 +134,7 @@ { int ret;
- if (prog >= PROGRAMMER_INVALID) { + if (prog >= programmer_table_size) { msg_perr("Invalid programmer specified!\n"); return -1; } @@ -1585,7 +1585,7 @@ enum programmer p; int i;
- for (p = 0; p < PROGRAMMER_INVALID; p++) { + for (p = 0; p < programmer_table_size; p++) { pname = programmer_table[p]->name; pnamelen = strlen(pname); if (remaining - pnamelen - 2 < 0) { @@ -1606,7 +1606,7 @@ } msg_ginfo("%s", pname); remaining -= pnamelen; - if (p < PROGRAMMER_INVALID - 1) { + if (p < programmer_table_size - 1) { msg_ginfo(","); remaining--; } else { @@ -1717,7 +1717,7 @@ msg_gerr("Programmer table miscompilation!\n"); ret = 1; } - for (i = 0; i < PROGRAMMER_INVALID; i++) { + for (i = 0; i < programmer_table_size; i++) { const struct programmer_entry *p = programmer_table[i]; if (p->name == NULL) { msg_gerr("All programmers need a valid name, but the one with index %d does not!\n", i); diff --git a/libflashrom.c b/libflashrom.c index 09a4e4d..2685433 100644 --- a/libflashrom.c +++ b/libflashrom.c @@ -120,10 +120,10 @@ const char **flashrom_supported_programmers(void) { enum programmer p = 0; - const char **supported_programmers = malloc((PROGRAMMER_INVALID + 1) * sizeof(char*)); + const char **supported_programmers = malloc((programmer_table_size + 1) * sizeof(char*));
if (supported_programmers != NULL) { - for (; p < PROGRAMMER_INVALID; ++p) { + for (; p < programmer_table_size; ++p) { supported_programmers[p] = programmer_table[p]->name; } } else { @@ -278,11 +278,11 @@ { unsigned prog;
- for (prog = 0; prog < PROGRAMMER_INVALID; prog++) { + for (prog = 0; prog < programmer_table_size; prog++) { if (strcmp(prog_name, programmer_table[prog]->name) == 0) break; } - if (prog >= PROGRAMMER_INVALID) { + if (prog >= programmer_table_size) { msg_ginfo("Error: Unknown programmer "%s". Valid choices are:\n", prog_name); list_programmers_linebreak(0, 80, 0); return 1; diff --git a/print.c b/print.c index fbf4882..49c1aa1 100644 --- a/print.c +++ b/print.c @@ -482,7 +482,7 @@ msg_ginfo("\n"); print_supported_boards_helper(laptops_known, "mobile devices"); #endif - for (i = 0; i < PROGRAMMER_INVALID; i++) { + for (i = 0; i < programmer_table_size; i++) { const struct programmer_entry *prog = programmer_table[i]; switch (prog->type) { case USB: diff --git a/print_wiki.c b/print_wiki.c index 4088d9f..8ca0e1e 100644 --- a/print_wiki.c +++ b/print_wiki.c @@ -380,7 +380,7 @@ unsigned int usb_count = 0; unsigned int i;
- for (i = 0; i < PROGRAMMER_INVALID; i++) { + for (i = 0; i < programmer_table_size; i++) { const struct programmer_entry *prog = programmer_table[i]; switch (prog->type) { case USB: @@ -399,7 +399,7 @@ "Total amount of supported PCI devices flashrom can use as a programmer: '''%d'''\n\n" "{%s%s", pci_count, th_start, programmer_th);
- for (i = 0; i < PROGRAMMER_INVALID; i++) { + for (i = 0; i < programmer_table_size; i++) { const struct programmer_entry *prog = programmer_table[i]; if (prog->type == PCI) { print_supported_devs_wiki_helper(prog); @@ -411,7 +411,7 @@ "Total amount of supported USB devices flashrom can use as a programmer: '''%d'''\n\n" "{%s%s", usb_count, th_start, programmer_th);
- for (i = 0; i < PROGRAMMER_INVALID; i++) { + for (i = 0; i < programmer_table_size; i++) { const struct programmer_entry *prog = programmer_table[i]; if (prog->type == USB) { print_supported_devs_wiki_helper(prog); @@ -424,7 +424,7 @@ printf("! align="left" | Programmer\n" "! align="left" | Note\n\n");
- for (i = 0; i < PROGRAMMER_INVALID; i++) { + for (i = 0; i < programmer_table_size; i++) { static int c = 0; const struct programmer_entry *prog = programmer_table[i]; if (prog->type == OTHER && prog->devs.note != NULL) {