From 7b8b8addd669eaa8d98bd33cc7a155066dd693ae Mon Sep 17 00:00:00 2001 From: Username404-59 Date: Fri, 15 Oct 2021 13:02:46 +0200 Subject: [PATCH] Remove the isNPOS boolean and assign lastSlash to position1 when it isn't equal to string_view::npos --- src/main.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index fcbdef7..6300b0c 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -50,15 +50,11 @@ int main(int argc, char* argv[]) { } catch (const Yerbacon::Exception& error) { unsigned long lastSlash = 0; const unsigned long position1 = fileName.find_last_of('/'); - const bool isNPOS = cmp_equal(position1, string_view::npos); - if constexpr(filesystem::path::preferred_separator == '/') { - if (not isNPOS) { - lastSlash = position1; - } - } else { + if (cmp_not_equal(position1, string_view::npos)) lastSlash = position1; + if constexpr(filesystem::path::preferred_separator != '/') { const unsigned long position2 = fileName.find_last_of(filesystem::path::preferred_separator); if (cmp_not_equal(position2, string_view::npos)) { - lastSlash = (isNPOS) ? position2 : max(position1, position2); + lastSlash = max(lastSlash, position2); } } resultingPair.first = fileName.substr(lastSlash + 1);