summaryrefslogtreecommitdiff
path: root/apt-pkg/deb/debversion.cc
diff options
context:
space:
mode:
authorDavid Kalnischkies <kalnischkies@gmail.com>2013-04-03 19:43:03 +0200
committerDavid Kalnischkies <kalnischkies@gmail.com>2013-04-03 19:43:03 +0200
commit885594fc8831d1be5a254557385e3dbefb564fbf (patch)
treeeb13cda9db652c8ddae0783354d4382bc3a20b35 /apt-pkg/deb/debversion.cc
parent887c6940d2afc9e3110f226e4d95fc72640e3ad6 (diff)
share version strings between same versions (of different architectures)
to save some space and allow quick comparisions later on
Diffstat (limited to 'apt-pkg/deb/debversion.cc')
-rw-r--r--apt-pkg/deb/debversion.cc12
1 files changed, 4 insertions, 8 deletions
diff --git a/apt-pkg/deb/debversion.cc b/apt-pkg/deb/debversion.cc
index 94d357846..140561262 100644
--- a/apt-pkg/deb/debversion.cc
+++ b/apt-pkg/deb/debversion.cc
@@ -217,16 +217,12 @@ bool debVersioningSystem::CheckDep(const char *PkgVer,
return false;
Op &= 0x0F;
- size_t const lenPkgVer = strlen(PkgVer);
- size_t const lenDepVer = strlen(DepVer);
-
- // take a shortcut for equals which are string-equal as well
- if (Op == pkgCache::Dep::Equals && lenPkgVer == lenDepVer &&
- memcmp(PkgVer, DepVer, lenPkgVer) == 0)
- return true;
+ // fast track for (equal) strings [by location] which are by definition equal versions
+ if (PkgVer == DepVer)
+ return Op == pkgCache::Dep::Equals || Op == pkgCache::Dep::LessEq || Op == pkgCache::Dep::GreaterEq;
// Perform the actual comparision.
- int const Res = DoCmpVersion(PkgVer, PkgVer + lenPkgVer, DepVer, DepVer + lenDepVer);
+ int const Res = CmpVersion(PkgVer, DepVer);
switch (Op)
{
case pkgCache::Dep::LessEq: