Skip to content

Commit

Permalink
Further optimize
Browse files Browse the repository at this point in the history
  • Loading branch information
Mis1eader-dev committed Apr 5, 2024
1 parent f8af65e commit 65b3d69
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions lib/src/HostRedirector.cc
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,11 @@ void HostRedirector::lookup(string &host, string &path) const
if (isWildcard)
{
const string &toPath = to->path;
const auto len = path.size();
auto start = len - lastWildcardPathViewLen;
start += toPath.back() == '/' && path[start] == '/';

path.reserve(toPath.size() + (len - start));
path.replace(0, start, toPath);
const auto start = path.size() - lastWildcardPathViewLen;
path.replace(0,
start +
(toPath.back() == '/' && path[start] == '/'),
toPath);
}
else
path = to->path;
Expand Down

0 comments on commit 65b3d69

Please sign in to comment.