From 2757c51828c5f5399f3bfe2f0dce3134aa715d8d Mon Sep 17 00:00:00 2001 From: Dan Paulat Date: Sun, 10 Dec 2023 21:59:32 -0600 Subject: [PATCH] Migrate Warnings Provider from std::regex to RE2 --- wxdata/source/scwx/provider/warnings_provider.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/wxdata/source/scwx/provider/warnings_provider.cpp b/wxdata/source/scwx/provider/warnings_provider.cpp index 6dacc8ea..d187763a 100644 --- a/wxdata/source/scwx/provider/warnings_provider.cpp +++ b/wxdata/source/scwx/provider/warnings_provider.cpp @@ -3,7 +3,6 @@ #include #include -#include #include #if defined(_MSC_VER) @@ -13,6 +12,7 @@ #define LIBXML_HTML_ENABLED #include #include +#include #if !defined(_MSC_VER) # include @@ -77,7 +77,7 @@ WarningsProvider::ListFiles(std::chrono::system_clock::time_point newerThan) using namespace date; #endif - static const std::regex reWarningsFilename { + static constexpr LazyRE2 reWarningsFilename = { "warnings_[0-9]{8}_[0-9]{2}.txt"}; static const std::string dateTimeFormat {"warnings_%Y%m%d_%H.txt"}; @@ -101,7 +101,7 @@ WarningsProvider::ListFiles(std::chrono::system_clock::time_point newerThan) [](auto& record) { return record.type_ == std::filesystem::file_type::regular && - std::regex_match(record.filename_, reWarningsFilename); + RE2::FullMatch(record.filename_, *reWarningsFilename); }); std::unique_lock lock(p->filesMutex_);