From ce015954ea906e7f8cc7293ff7ac33db56493e44 Mon Sep 17 00:00:00 2001 From: tastytea Date: Tue, 25 May 2021 10:02:34 +0200 Subject: [PATCH] Only initialize search::options once. --- src/main.cpp | 54 ++++++++++++++++++++++++++-------------------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index c781ab0..8d4f966 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -76,39 +76,39 @@ int main(int argc, char *argv[]) } else { + search::options opts; + if (vm.count("basic-regexp") > 0) + { + opts.regex = search::regex_kind::basic; + } + if (vm.count("extended-regexp") > 0) + { + opts.regex = search::regex_kind::extended; + } + if (vm.count("perl-regexp") > 0) + { + opts.regex = search::regex_kind::perl; + } + if (vm.count("grep") > 0) + { + opts.grep_like = true; + } + if (vm.count("ignore-case") > 0) + { + opts.ignore_case = true; + } + if (vm.count("raw") > 0) + { + opts.raw = true; + } + opts.context = vm["context"].as(); + for (const auto &filepath : vm["input-file"].as>()) { for (const auto ®ex : vm["regexp"].as>()) { - search::options opts; - if (vm.count("basic-regexp") > 0) - { - opts.regex = search::regex_kind::basic; - } - if (vm.count("extended-regexp") > 0) - { - opts.regex = search::regex_kind::extended; - } - if (vm.count("perl-regexp") > 0) - { - opts.regex = search::regex_kind::perl; - } - if (vm.count("grep") > 0) - { - opts.grep_like = true; - } - if (vm.count("ignore-case") > 0) - { - opts.ignore_case = true; - } - if (vm.count("raw") > 0) - { - opts.raw = true; - } - opts.context = vm["context"].as(); - try { for (const auto &match :