From 38e86af75c02cf75e8dc372ef71cc8c3010d0313 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 19 Oct 2015 10:56:13 +0200 Subject: fs/Traits: use StringAfterPrefix() in Relative() --- src/fs/Traits.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/fs/Traits.cxx b/src/fs/Traits.cxx index e434a779c..7eba0916a 100644 --- a/src/fs/Traits.cxx +++ b/src/fs/Traits.cxx @@ -19,6 +19,7 @@ #include "config.h" #include "Traits.hxx" +#include "util/StringUtil.hxx" #include @@ -92,12 +93,11 @@ RelativePathImpl(typename Traits::const_pointer base, assert(base != nullptr); assert(other != nullptr); - const auto base_length = Traits::GetLength(base); - if (memcmp(base, other, base_length * sizeof(*base)) != 0) + other = StringAfterPrefix(other, base); + if (other == nullptr) /* mismatch */ return nullptr; - other += base_length; if (*other != 0) { if (!Traits::IsSeparator(*other)) /* mismatch */ -- cgit v1.2.3