Skip to content

Commit

Permalink
[FOLD] noexcept comparisons
Browse files Browse the repository at this point in the history
  • Loading branch information
alandefreitas committed Aug 19, 2022
1 parent d04d8b9 commit 9ad001f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 25 deletions.
34 changes: 10 additions & 24 deletions include/boost/url/impl/url.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,12 @@ relative(
segments_view::iterator& first,
segments_view::iterator last)
{
if (*first == dotdot ||
*first == dot)
{
++first;
return true;
}
auto it = std::next(first);
std::size_t l = 1;
while (it != last)
Expand Down Expand Up @@ -241,37 +247,17 @@ relative(
it0 != last0 &&
it1 != last1)
{
if (consume_dots(it0, last0))
continue;
if (consume_dots(it1, last1))
continue;
if (*it0 == *it1)
{
++it0;
++it1;
}
else if (*it0 == dot)
{
++it0;
}
else if (*it1 == dot)
{
++it1;
}
else if (*it0 == dotdot)
{
++it0;
if (it1 != begin1)
--it1;
}
else if (*it1 == dotdot)
{
++it1;
if (it0 != begin0)
--it0;
}
else
{
if (consume_dots(it0, last0))
continue;
if (consume_dots(it1, last1))
continue;
break;
}
}
Expand Down
2 changes: 1 addition & 1 deletion test/unit/url.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2097,7 +2097,7 @@ class url_test
check("/a/path/././to/./somewhere/else", "/a/./path/./to/a", "../a");
// ".." should be normalized
check("/a/path/x/../to/y/../somewhere/else", "/b/../a/path/to/a", "../a");
// check("/../path/x/../to/y/../somewhere/else", "/a/../../path/to/a", "../a");
check("/../path/x/../to/y/../somewhere/else", "/a/../../path/to/a", "../a");
check("/a/path/to/somewhere/else", "/a/path/to/a/../b", "../b");
// same parent
check("/relative/file?some=query#hash", "/relative/path?blubber=1#hash1", "path?blubber=1#hash1");
Expand Down

0 comments on commit 9ad001f

Please sign in to comment.