Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions include/ada/url_pattern-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,8 @@ url_pattern_component<regex_provider>::create_component_match_result(
// says we should start from 1. This case is handled by the
// std_regex_provider.
for (size_t index = 0; index < exec_result.size(); index++) {
result.groups.insert({
group_name_list[index],
std::move(exec_result[index]),
});
result.groups.emplace(group_name_list[index],
std::move(exec_result[index]));
}
return result;
}
Expand Down
8 changes: 3 additions & 5 deletions src/url_pattern_regex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,9 @@ std::optional<std::regex> std_regex_provider::create_instance(
std::optional<std::vector<std::optional<std::string>>>
std_regex_provider::regex_search(std::string_view input,
const std::regex& pattern) {
std::string input_str(
input.begin(),
input.end()); // Convert string_view to string for regex_search
std::smatch match_result;
if (!std::regex_search(input_str, match_result, pattern,
// Use iterator-based regex_search to avoid string allocation
std::match_results<std::string_view::const_iterator> match_result;
if (!std::regex_search(input.begin(), input.end(), match_result, pattern,
std::regex_constants::match_any)) {
return std::nullopt;
}
Expand Down
Loading