summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
authorAdrian Wielgosik <adrian.wielgosik@gmail.com>2016-04-29 10:38:02 +0200
committerAdrian Wielgosik <adrian.wielgosik@gmail.com>2016-05-01 12:18:20 +0200
commitc1f961ecbb1119b9ba6b5a67930d50490f8b0fb5 (patch)
treea665a092273f80371816c405a3dbf10b3eb18575 /apt-pkg
parent79fe74283ca8c941806085a3ae1bacfac2287d1c (diff)
Don't copy strings in Startswith, Endswith
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/contrib/strutl.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/apt-pkg/contrib/strutl.cc b/apt-pkg/contrib/strutl.cc
index d388cbda3..24fca5174 100644
--- a/apt-pkg/contrib/strutl.cc
+++ b/apt-pkg/contrib/strutl.cc
@@ -71,14 +71,14 @@ bool Endswith(const std::string &s, const std::string &end)
{
if (end.size() > s.size())
return false;
- return (s.substr(s.size() - end.size(), s.size()) == end);
+ return (s.compare(s.size() - end.size(), end.size(), end) == 0);
}
bool Startswith(const std::string &s, const std::string &start)
{
if (start.size() > s.size())
return false;
- return (s.substr(0, start.size()) == start);
+ return (s.compare(0, start.size(), start) == 0);
}
}