From b80818e87a5778300c71c57184746ef3e7990e5e Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 5 Sep 2019 12:02:57 +0200 Subject: Minor improvement to path_traits::compare() --- libbutl/path.mxx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libbutl/path.mxx b/libbutl/path.mxx index ca034c9..4f3a028 100644 --- a/libbutl/path.mxx +++ b/libbutl/path.mxx @@ -386,9 +386,12 @@ LIBBUTL_MODEXPORT namespace butl } static int - compare (string_type const& l, string_type const& r) + compare (string_type const& l, + string_type const& r, + size_type n = string_type::npos) { - return compare (l.c_str (), l.size (), r.c_str (), r.size ()); + return compare (l.c_str (), n < l.size () ? n : l.size (), + r.c_str (), n < r.size () ? n : r.size ()); } // @@ Currently for case-insensitive filesystems (Windows) compare() -- cgit v1.1