aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2019-09-05 12:02:57 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2019-09-05 12:02:57 +0200
commitb80818e87a5778300c71c57184746ef3e7990e5e (patch)
tree350799fa01a5af9bc0c7fd1bc815e80b9a6182d8
parent4b9494f8e8afc4a46a1780cb88090888b9b0b874 (diff)
Minor improvement to path_traits::compare()
-rw-r--r--libbutl/path.mxx7
1 files 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()