From 83f54129163bffefd55fddca8499f034fb020678 Mon Sep 17 00:00:00 2001 From: Arthur O'Dwyer Date: Sat, 11 Apr 2020 15:21:18 -0400 Subject: [PATCH] Use callhandlers() instead of manual loop in commandline.cpp. NFCI. --- commandline.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/commandline.cpp b/commandline.cpp index 427b0e6f..286fc0c5 100644 --- a/commandline.cpp +++ b/commandline.cpp @@ -357,12 +357,13 @@ namespace arg { curphase = phase; callhooks(hooks_config); while(pos < isize(argument)) { - for(auto& h: *hooks_args) { - int r = h.second(); if(r == 2) return; if(r == 0) { lshift(); goto cont; } + int r = callhandlers(1, hooks_args); + switch (r) { + case 0: lshift(); break; + case 1: printf("Unknown option: %s\n", argcs()); exit(3); break; + case 2: return; + default: assert(false); } - printf("Unknown option: %s\n", argcs()); - exit(3); - cont: ; } } }