]> git.saurik.com Git - apt-legacy.git/blobdiff - apt-pkg/deb/deblistparser.cc
Figured out a much simpler fix for the cache rebuild performance.
[apt-legacy.git] / apt-pkg / deb / deblistparser.cc
index afc91633555ba2a23440566e82603447e8d414b6..de565d030a1aa84fd83d86ed1cda26279c2dbb93 100644 (file)
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/crc-16.h>
 #include <apt-pkg/md5.h>
+#include <apt-pkg/macros.h>
 
 #include <ctype.h>
-
-#include <system.h>
                                                                        /*}}}*/
 
 static debListParser::WordList PrioList[] = {{"important",pkgCache::State::Important},
@@ -40,6 +39,18 @@ debListParser::debListParser(FileFd *File) : Tags(File)
 // ListParser::UniqFindTagWrite - Find the tag and write a unq string  /*{{{*/
 // ---------------------------------------------------------------------
 /* */
+unsigned long debListParser::FindTagWrite(const char *Tag)
+{
+   const char *Start;
+   const char *Stop;
+   if (Section.Find(Tag,Start,Stop) == false)
+      return 0;
+   return WriteString(Start,Stop - Start);
+}
+                                                                       /*}}}*/
+// ListParser::UniqFindTagWrite - Find the tag and write a unq string  /*{{{*/
+// ---------------------------------------------------------------------
+/* */
 unsigned long debListParser::UniqFindTagWrite(const char *Tag)
 {
    const char *Start;
@@ -75,9 +86,9 @@ string debListParser::Version()
 /* */
 bool debListParser::NewVersion(pkgCache::VerIterator Ver)
 {
-   Ver->Display = UniqFindTagWrite("Name");
+   Ver->Display = FindTagWrite("Name");
    if (Ver->Display == 0)
-      Ver->Display = UniqFindTagWrite("Maemo-Display-Name");
+      Ver->Display = FindTagWrite("Maemo-Display-Name");
 
    // Parse the section
    Ver->Section = UniqFindTagWrite("Section");
@@ -113,6 +124,8 @@ bool debListParser::NewVersion(pkgCache::VerIterator Ver)
       return false;
    if (ParseDepends(Ver,"Replaces",pkgCache::Dep::Replaces) == false)
       return false;
+   if (ParseDepends(Ver,"Enhances",pkgCache::Dep::Enhances) == false)
+      return false;
 
    // Obsolete.
    if (ParseDepends(Ver,"Optional",pkgCache::Dep::Suggests) == false)
@@ -174,9 +187,9 @@ bool debListParser::UsePackage(pkgCache::PkgIterator Pkg,
                               pkgCache::VerIterator Ver)
 {
    if (Pkg->Display == 0)
-      Pkg->Display = UniqFindTagWrite("Name");
+      Pkg->Display = FindTagWrite("Name");
    if (Pkg->Display == 0)
-      Pkg->Display = UniqFindTagWrite("Maemo-Display-Name");
+      Pkg->Display = FindTagWrite("Maemo-Display-Name");
    if (Pkg->Section == 0)
       Pkg->Section = UniqFindTagWrite("Section");
    if (Section.FindFlag("Essential",Pkg->Flags,pkgCache::Flag::Essential) == false)
@@ -226,7 +239,7 @@ unsigned short debListParser::VersionHash()
       for (; Start != End; Start++)
       {
         if (isspace(*Start) == 0)
-           *I++ = tolower(*Start);
+           *I++ = tolower_ascii(*Start);
         if (*Start == '<' && Start[1] != '<' && Start[1] != '=')
            *I++ = '=';
         if (*Start == '>' && Start[1] != '>' && Start[1] != '=')