From: Jay Freeman (saurik) Date: Wed, 31 Mar 2010 21:48:50 +0000 (+0000) Subject: Removed obsolete unique.diff optimization and added a missing /etc/apt/trusted.gpg.d. X-Git-Url: https://git.saurik.com/apt-legacy.git/commitdiff_plain/148029df3f936d8563e23277d0a71f77cffd13d2 Removed obsolete unique.diff optimization and added a missing /etc/apt/trusted.gpg.d. D unique.diff git-svn-id: http://svn.telesphoreo.org/trunk@712 514c082c-b64e-11dc-b46d-3d985efe055d --- diff --git a/apt-pkg/deb/deblistparser.cc b/apt-pkg/deb/deblistparser.cc index c55fd42..964e4a4 100644 --- a/apt-pkg/deb/deblistparser.cc +++ b/apt-pkg/deb/deblistparser.cc @@ -45,7 +45,7 @@ unsigned long debListParser::FindTagWrite(const char *Tag) const char *Stop; if (Section.Find(Tag,Start,Stop) == false) return 0; - return WriteString(srkString(Start,Stop - Start)); + return WriteString(Start,Stop - Start); } /*}}}*/ // ListParser::UniqFindTagWrite - Find the tag and write a unq string /*{{{*/ diff --git a/apt-pkg/pkgcachegen.cc b/apt-pkg/pkgcachegen.cc index 7e67733..48a7976 100644 --- a/apt-pkg/pkgcachegen.cc +++ b/apt-pkg/pkgcachegen.cc @@ -680,38 +680,21 @@ bool pkgCacheGenerator::SelectFile(const string &File,const string &Site, unsigned long pkgCacheGenerator::WriteUniqString(const char *S, unsigned int Size) { - return WriteString(srkString(S, Size), srkSeriouslyUnique); -} - -unsigned long pkgCacheGenerator::WriteString(const srkString &S, - enum srkLevel level) -{ - if (level == srkRunOfTheMillNormal) - return Map.WriteString(S.Start,S.Size); - /* We use a very small transient hash table here, this speeds up generation by a fair amount on slower machines */ - pkgCache::StringItem *&Bucket(level == srkReasonablySpecial ? SpecHash[(S[0]*5 + S[1]) % _count(SpecHash)] : UniqHash[(S[0]*5 + S[1]) % _count(UniqHash)]); + pkgCache::StringItem *&Bucket = UniqHash[(S[0]*5 + S[1]) % _count(UniqHash)]; if (Bucket != 0 && - stringcmp(S,Cache.StrP + Bucket->String) == 0) + stringcmp(S,S+Size,Cache.StrP + Bucket->String) == 0) return Bucket->String; - pkgCache::StringItem *I; - map_ptrloc *Last; - - if (level != srkSeriouslyUnique) { - I = NULL; - Last = NULL; - } else { - // Search for an insertion point - I = Cache.StringItemP + Cache.HeaderP->StringList; + pkgCache::StringItem *I = Cache.StringItemP + Cache.HeaderP->StringList; int Res = 1; - Last = &Cache.HeaderP->StringList; + map_ptrloc *Last = &Cache.HeaderP->StringList; for (; I != Cache.StringItemP; Last = &I->NextItem, I = Cache.StringItemP + I->NextItem) { - Res = stringcmp(S,Cache.StrP + I->String); + Res = stringcmp(S,S+Size,Cache.StrP + I->String); if (Res >= 0) break; } @@ -722,8 +705,6 @@ unsigned long pkgCacheGenerator::WriteString(const srkString &S, Bucket = I; return I->String; } - - } // Get a structure unsigned long Item = Map.Allocate(sizeof(pkgCache::StringItem)); @@ -733,9 +714,8 @@ unsigned long pkgCacheGenerator::WriteString(const srkString &S, // Fill in the structure pkgCache::StringItem *ItemP = Cache.StringItemP + Item; ItemP->NextItem = I - Cache.StringItemP; - if (Last != NULL) - *Last = Item; - ItemP->String = Map.WriteString(S.Start,S.Size); + *Last = Item; + ItemP->String = Map.WriteString(S,Size); if (ItemP->String == 0) return 0; diff --git a/apt-pkg/pkgcachegen.h b/apt-pkg/pkgcachegen.h index 7c523c7..306b117 100644 --- a/apt-pkg/pkgcachegen.h +++ b/apt-pkg/pkgcachegen.h @@ -32,16 +32,13 @@ class pkgCacheGenerator /*{{{*/ { private: - pkgCache::StringItem *UniqHash[24]; - pkgCache::StringItem *SpecHash[2]; + pkgCache::StringItem *UniqHash[26]; public: class ListParser; friend class ListParser; - enum srkLevel { srkRunOfTheMillNormal, srkReasonablySpecial, srkSeriouslyUnique }; - protected: DynamicMMap ⤅ @@ -66,7 +63,6 @@ class pkgCacheGenerator /*{{{*/ unsigned long WriteUniqString(const char *S,unsigned int Size); inline unsigned long WriteUniqString(const string &S) {return WriteUniqString(S.c_str(),S.length());}; - unsigned long WriteString(const srkString &S, enum srkLevel level); void DropProgress() {Progress = 0;}; bool SelectFile(const string &File,const string &Site,pkgIndexFile const &Index, @@ -102,7 +98,7 @@ class pkgCacheGenerator::ListParser inline unsigned long WriteUniqString(const char *S,unsigned int Size) {return Owner->WriteUniqString(S,Size);}; inline unsigned long WriteString(const string &S) {return Owner->Map.WriteString(S);}; inline unsigned long WriteString(const char *S,unsigned int Size) {return Owner->Map.WriteString(S,Size);}; - inline unsigned long WriteString(const srkString &S) {return Owner->WriteString(S, srkReasonablySpecial);}; + inline unsigned long WriteString(const srkString &S) {return Owner->Map.WriteString(S.Start,S.Size);}; bool NewDepends(pkgCache::VerIterator Ver,const string &Package, const string &Version,unsigned int Op, unsigned int Type);