From d1bfc4543e780a50694037bfb2a38fdca9178eae Mon Sep 17 00:00:00 2001 From: Roland Lutz Date: Tue, 11 Jul 2017 19:01:11 +0200 Subject: icemulti: Re-use images --- icemulti/icemulti.cc | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'icemulti') diff --git a/icemulti/icemulti.cc b/icemulti/icemulti.cc index 7bfe25e..65ae6b6 100644 --- a/icemulti/icemulti.cc +++ b/icemulti/icemulti.cc @@ -247,10 +247,18 @@ int main(int argc, char **argv) while (optind != argc) { if (header_count >= NUM_IMAGES) error("Too many images supplied\n"); - images[image_count].reset(new Image(argv[optind++])); + for (int i = 0; i < image_count; i++) + if (strcmp(argv[optind], images[i]->filename) == 0) { + header_images[header_count] = &*images[i]; + goto image_found; + } + images[image_count].reset(new Image(argv[optind])); header_images[header_count] = &*images[image_count]; - header_count++; image_count++; + + image_found: + header_count++; + optind++; } if (coldboot && por_image != 0) -- cgit v1.2.3