From 0418506e9f67ca705d53cc70d9a29d2cc8dccb40 Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Tue, 11 Mar 2014 00:54:31 +0000 Subject: [PATCH] Don't call set_best before setting m and n. Fixes obvious goof if you run 'main 12 7 -b 2.9' - you get an immediate termination quoting n_max_frags and m_max_frags as -1. --- main.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/main.c b/main.c index 25dbb11..3ee58c5 100644 --- a/main.c +++ b/main.c @@ -733,10 +733,11 @@ static void report(void) { int main(int argc, char **argv) { int opt; + double best_to_set = -1.0; /* means 'don't' */ while ((opt = getopt(argc,argv,"j:b:")) >= 0) { switch (opt) { case 'j': ncpus = atoi(optarg); break; - case 'b': set_best(atof(optarg)); break; + case 'b': best_to_set = atof(optarg); break; case '+': assert(!"bad option"); default: abort(); } @@ -747,6 +748,7 @@ int main(int argc, char **argv) { n = atoi(argv[1]); m = atoi(argv[2]); assert(n > m); + if (best_to_set > 0) set_best(best_to_set); prep(); -- 2.30.2