fs/Traits: use StringAfterPrefix() in Relative()
This commit is contained in:
parent
607c2c5ba2
commit
38e86af75c
@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "Traits.hxx"
|
#include "Traits.hxx"
|
||||||
|
#include "util/StringUtil.hxx"
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
@ -92,12 +93,11 @@ RelativePathImpl(typename Traits::const_pointer base,
|
|||||||
assert(base != nullptr);
|
assert(base != nullptr);
|
||||||
assert(other != nullptr);
|
assert(other != nullptr);
|
||||||
|
|
||||||
const auto base_length = Traits::GetLength(base);
|
other = StringAfterPrefix(other, base);
|
||||||
if (memcmp(base, other, base_length * sizeof(*base)) != 0)
|
if (other == nullptr)
|
||||||
/* mismatch */
|
/* mismatch */
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
other += base_length;
|
|
||||||
if (*other != 0) {
|
if (*other != 0) {
|
||||||
if (!Traits::IsSeparator(*other))
|
if (!Traits::IsSeparator(*other))
|
||||||
/* mismatch */
|
/* mismatch */
|
||||||
|
Loading…
Reference in New Issue
Block a user