diff options
author | 2013-10-26 15:27:39 -0700 | |
---|---|---|
committer | 2013-10-26 15:27:39 -0700 | |
commit | cf766b55cca979745f6c218d78f9cdcc297b3f20 (patch) | |
tree | d5c31f6aaa56aaa4ac7c967c91d6e822d0f8d27d /path.cpp | |
parent | 03c65d7a96c9cadc9feff339ca0af7f43eb7391e (diff) |
Fix formatting
Diffstat (limited to 'path.cpp')
-rw-r--r-- | path.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
@@ -400,7 +400,7 @@ void path_make_canonical(wcstring &path) path.at(trailing++) = c; } prev_was_slash = is_slash; - } + } assert(trailing <= len); if (trailing < len) path.resize(trailing); @@ -410,32 +410,32 @@ bool paths_are_equivalent(const wcstring &p1, const wcstring &p2) { if (p1 == p2) return true; - + size_t len1 = p1.size(), len2 = p2.size(); - + // Ignore trailing slashes after the first character while (len1 > 1 && p1.at(len1 - 1) == L'/') len1--; while (len2 > 1 && p2.at(len2 - 1) == L'/') len2--; - + // Start walking size_t idx1 = 0, idx2 = 0; while (idx1 < len1 && idx2 < len2) { wchar_t c1 = p1.at(idx1), c2 = p2.at(idx2); - + // If the characters are different, the strings are not equivalent if (c1 != c2) break; - + idx1++; idx2++; - + // If the character was a slash, walk forwards until we hit the end of the string, or a non-slash // Note the first condition is invariant within the loop while (c1 == L'/' && idx1 < len1 && p1.at(idx1) == L'/') idx1++; while (c2 == L'/' && idx2 < len2 && p2.at(idx2) == L'/') idx2++; } - + // We matched if we consumed all of the characters in both strings return idx1 == len1 && idx2 == len2; } |