diff options
author | Arthur Heymans <arthur@aheymans.xyz> | 2019-02-05 17:35:05 +0100 |
---|---|---|
committer | Nico Huber <nico.h@gmx.de> | 2019-06-17 08:03:12 +0000 |
commit | b04fef91c100d815265bc1948e61a62f284c42ef (patch) | |
tree | 9446fe01e60f38fde4dd777602a1e8dab2cce8cd /cli_classic.c | |
parent | ee13d0c8fa365455002b109ded7f94f990be8347 (diff) | |
download | flashrom-b04fef91c100d815265bc1948e61a62f284c42ef.tar.gz flashrom-b04fef91c100d815265bc1948e61a62f284c42ef.tar.bz2 flashrom-b04fef91c100d815265bc1948e61a62f284c42ef.zip |
layout.c: Don't use global variables for included regions
This removes the use of global variables for included region arguments
and also uses a linked list to store the arguments.
Change-Id: I6534cc58b8dcc6256c2730c809286d8083669a6c
Signed-off-by: Arthur Heymans <arthur@aheymans.xyz>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/31247
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Nico Huber <nico.h@gmx.de>
Diffstat (limited to 'cli_classic.c')
-rw-r--r-- | cli_classic.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/cli_classic.c b/cli_classic.c index ced08c6c3..2e07612b9 100644 --- a/cli_classic.c +++ b/cli_classic.c @@ -151,6 +151,7 @@ int main(int argc, char *argv[]) #endif /* !STANDALONE */ char *tempstr = NULL; char *pparam = NULL; + struct layout_include_args *include_args = NULL; flashrom_set_log_callback((flashrom_log_callback *)&flashrom_print_cb); @@ -290,7 +291,7 @@ int main(int argc, char *argv[]) break; case 'i': tempstr = strdup(optarg); - if (register_include_arg(tempstr)) { + if (register_include_arg(&include_args, tempstr)) { free(tempstr); cli_classic_abort_usage(); } @@ -452,7 +453,7 @@ int main(int argc, char *argv[]) goto out; } - if (!ifd && !fmap && process_include_args(get_global_layout())) { + if (!ifd && !fmap && process_include_args(get_global_layout(), include_args)) { ret = 1; goto out; } @@ -608,7 +609,7 @@ int main(int argc, char *argv[]) if (layoutfile) { layout = get_global_layout(); } else if (ifd && (flashrom_layout_read_from_ifd(&layout, fill_flash, NULL, 0) || - process_include_args(layout))) { + process_include_args(layout, include_args))) { ret = 1; goto out_shutdown; } else if (fmap && fmapfile) { @@ -633,14 +634,14 @@ int main(int argc, char *argv[]) } if (flashrom_layout_read_fmap_from_buffer(&layout, fill_flash, fmapfile_buffer, fmapfile_size) || - process_include_args(layout)) { + process_include_args(layout, include_args)) { ret = 1; free(fmapfile_buffer); goto out_shutdown; } free(fmapfile_buffer); } else if (fmap && (flashrom_layout_read_fmap_from_rom(&layout, fill_flash, 0, - fill_flash->chip->total_size * 1024) || process_include_args(layout))) { + fill_flash->chip->total_size * 1024) || process_include_args(layout, include_args))) { ret = 1; goto out_shutdown; } @@ -675,7 +676,7 @@ out: for (i = 0; i < chipcount; i++) free(flashes[i].chip); - layout_cleanup(); + layout_cleanup(&include_args); free(filename); free(fmapfile); free(referencefile); |