Skip to content

Commit

Permalink
fix url_pattern_component constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
anonrig committed Dec 31, 2024
1 parent 5ced1da commit 674c0bb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions include/ada/url_pattern.h
Original file line number Diff line number Diff line change
Expand Up @@ -198,11 +198,11 @@ class url_pattern_component {

// This function explicitly takes a std::string because it is moved.
// To avoid unnecessary copy, move each value while calling the constructor.
url_pattern_component(std::string_view new_pattern, std::regex&& new_regexp,
url_pattern_component(std::string&& new_pattern, std::regex&& new_regexp,
std::regex_constants::syntax_option_type new_flags,
std::vector<std::string>&& new_group_name_list,
bool new_has_regexp_groups)
: regexp(new_regexp),
: regexp(std::move(new_regexp)),
pattern(std::move(new_pattern)),
flags(new_flags),
group_name_list(new_group_name_list),
Expand Down
5 changes: 3 additions & 2 deletions src/url_pattern.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -536,8 +536,9 @@ url_pattern_component::compile(std::string_view input, F encoding_callback,
// Return a new component whose pattern string is pattern string, regular
// expression is regular expression, group name list is name list, and has
// regexp groups is has regexp groups.
return url_pattern_component(pattern_string, std::move(regular_expression),
flags, std::move(name_list), has_regexp_groups);
return url_pattern_component(std::move(pattern_string),
std::move(regular_expression), flags,
std::move(name_list), has_regexp_groups);
}

namespace url_pattern_helpers {
Expand Down

0 comments on commit 674c0bb

Please sign in to comment.