summaryrefslogtreecommitdiffstats
path: root/include/raul/Path.hpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2020-12-19 11:58:34 +0100
committerDavid Robillard <d@drobilla.net>2020-12-19 12:02:24 +0100
commit2a09c19703b242aaf693e5b52a70c1ad65332119 (patch)
treefcaf9fdffa4dcb80a74fc4e1b2c90e81e7e20fb6 /include/raul/Path.hpp
parent5680e5900f6fb89ec66af6480a7d125fc8960552 (diff)
downloadraul-2a09c19703b242aaf693e5b52a70c1ad65332119.tar.gz
raul-2a09c19703b242aaf693e5b52a70c1ad65332119.tar.bz2
raul-2a09c19703b242aaf693e5b52a70c1ad65332119.zip
Avoid "else" after "return"
Diffstat (limited to 'include/raul/Path.hpp')
-rw-r--r--include/raul/Path.hpp21
1 files changed, 12 insertions, 9 deletions
diff --git a/include/raul/Path.hpp b/include/raul/Path.hpp
index f0168b7..4fb3da1 100644
--- a/include/raul/Path.hpp
+++ b/include/raul/Path.hpp
@@ -95,10 +95,14 @@ public:
for (size_t i = 1; i < str.length(); ++i) {
if (!is_valid_char(str[i])) {
return false; // All characters must be /, _, a-z, A-Z, 0-9
- } else if (str[i - 1] == '/') {
+ }
+
+ if (str[i - 1] == '/') {
if (str[i] == '/') {
return false; // Must not contain "//"
- } else if (!Symbol::is_valid_start_char(str[i])) {
+ }
+
+ if (!Symbol::is_valid_start_char(str[i])) {
return false; // Invalid symbol start character (digit)
}
}
@@ -145,12 +149,11 @@ public:
inline Path parent() const {
if (is_root()) {
return *this;
- } else {
- const size_t first_sep = find('/');
- const size_t last_sep = find_last_of('/');
- return (first_sep == last_sep)
- ? Path("/") : Path(substr(0, last_sep));
}
+
+ const size_t first_sep = find('/');
+ const size_t last_sep = find_last_of('/');
+ return (first_sep == last_sep) ? Path("/") : Path(substr(0, last_sep));
}
/** Return a child Path of this path. */
@@ -171,9 +174,9 @@ public:
inline std::string base() const {
if (is_root()) {
return *this;
- } else {
- return *this + '/';
}
+
+ return *this + '/';
}
/** Return the lowest common ancestor of a and b. */