From cda07189480495445619784dccfd515e8ea5af7d Mon Sep 17 00:00:00 2001 From: Daniel Lemire Date: Mon, 20 Jan 2025 15:56:04 -0500 Subject: [PATCH] lint --- include/ada/url_pattern_regex.h | 4 ++-- src/url_pattern_regex.cpp | 19 ++++++++++--------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/include/ada/url_pattern_regex.h b/include/ada/url_pattern_regex.h index eb6b1cd60..0400a002c 100644 --- a/include/ada/url_pattern_regex.h +++ b/include/ada/url_pattern_regex.h @@ -44,8 +44,8 @@ class std_regex_provider { using regex_type = std::regex; static std::optional create_instance(std::string_view pattern, bool ignore_case); - std::vector regex_search( - std::string_view input, const regex_type& pattern); + std::vector regex_search(std::string_view input, + const regex_type& pattern); bool regex_match(std::string_view input, const regex_type& pattern); }; diff --git a/src/url_pattern_regex.cpp b/src/url_pattern_regex.cpp index 37c009930..697ff406d 100644 --- a/src/url_pattern_regex.cpp +++ b/src/url_pattern_regex.cpp @@ -21,16 +21,17 @@ std::optional std_regex_provider::create_instance( std::vector std_regex_provider::regex_search( std::string_view input, const std::regex& pattern) { + std::vector matches; + std::string input_str( + input.begin(), + input.end()); // Convert string_view to string for regex_search + std::smatch match_result; - std::vector matches; - std::string input_str(input.begin(), input.end()); // Convert string_view to string for regex_search - std::smatch match_result; - - while (std::regex_search(input_str, match_result, pattern)) { - matches.push_back(match_result.str()); - input_str = match_result.suffix().str(); - } - return matches; + while (std::regex_search(input_str, match_result, pattern)) { + matches.push_back(match_result.str()); + input_str = match_result.suffix().str(); + } + return matches; } bool std_regex_provider::regex_match(std::string_view input,