]> git.saurik.com Git - apt.git/commitdiff
Replace compare() == 0 checks with this == other checks
authorJulian Andres Klode <jak@debian.org>
Thu, 7 Jan 2016 23:52:29 +0000 (00:52 +0100)
committerJulian Andres Klode <jak@debian.org>
Thu, 7 Jan 2016 23:52:29 +0000 (00:52 +0100)
This improves performance, as we now can ignore unequal strings
based on their length already.

Gbp-Dch: ignore

apt-pkg/deb/deblistparser.cc
apt-pkg/pkgcachegen.cc

index 6ab0d0393ca610d0f49b5766d1133339a6efd16f..bcfbcccc2a9fb336ca63fec90305f6543a4530a8 100644 (file)
@@ -591,9 +591,9 @@ const char *debListParser::ParseDepends(const char *Start,const char *Stop,
       string const arch = _config->Find("APT::Architecture");
       size_t const found = Package.rfind(':');
       if (found != StringView::npos &&
-         (Package.compare(found, Package.size(), ":any") == 0 ||
-          Package.compare(found, Package.size(), ":native") == 0||
-          Package.compare(found +1, Package.size(), arch) == 0))
+         (Package.substr(found) == ":any" ||
+          Package.substr(found) == ":native" ||
+          Package.substr(found +1) == arch))
         Package = Package.substr(0,found);
    }
 
@@ -827,7 +827,7 @@ bool debListParser::ParseDepends(pkgCache::VerIterator &Ver,
         if (NewDepends(Ver,Package,pkgArch,Version,Op,Type) == false)
            return false;
       }
-      else if (Package.compare(found, Package.npos, ":any") == 0)
+      else if (Package.substr(found) == ":any")
       {
         if (NewDepends(Ver,Package,"any",Version,Op,Type) == false)
            return false;
index 654c5f279c654d8f1b68481e0d2c6bafd205b95a..577a6e47422e1e112903893f0b7b2fc4c0b71ece 100644 (file)
@@ -1014,7 +1014,7 @@ bool pkgCacheListParser::NewDepends(pkgCache::VerIterator &Ver,
    {
       int const CmpOp = Op & 0x0F;
       // =-deps are used (79:1) for lockstep on same-source packages (e.g. data-packages)
-      if (CmpOp == pkgCache::Dep::Equals && Version.compare(Ver.VerStr()) == 0)
+      if (CmpOp == pkgCache::Dep::Equals && Version == Ver.VerStr())
         idxVersion = Ver->VerStr;
 
       if (idxVersion == 0)