mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-25 00:50:22 +00:00
LexicalPath: Simplify a loop
No behavior change.
This commit is contained in:
parent
c8b496162d
commit
59596ff816
Notes:
sideshowbarker
2024-07-19 04:47:44 +09:00
Author: https://github.com/nico Commit: https://github.com/SerenityOS/serenity/commit/59596ff8165 Pull-request: https://github.com/SerenityOS/serenity/pull/2813
1 changed files with 2 additions and 6 deletions
|
@ -89,12 +89,8 @@ void LexicalPath::canonicalize()
|
|||
m_dirname = dirname_builder.to_string();
|
||||
|
||||
m_basename = canonical_parts.last();
|
||||
String dot { "." };
|
||||
Optional<size_t> last_dot, end = m_basename.index_of(dot);
|
||||
while (end.has_value()) {
|
||||
last_dot = end;
|
||||
end = m_basename.index_of(dot, end.value() + 1);
|
||||
}
|
||||
|
||||
Optional<size_t> last_dot = StringView(m_basename).find_last_of('.');
|
||||
if (last_dot.has_value()) {
|
||||
m_title = m_basename.substring(0, last_dot.value());
|
||||
m_extension = m_basename.substring(last_dot.value() + 1, m_basename.length() - last_dot.value() - 1);
|
||||
|
|
Loading…
Reference in a new issue