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;
}
Bucket = I;
return I->String;
}
-
- }
// Get a structure
unsigned long Item = Map.Allocate(sizeof(pkgCache::StringItem));
// 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;
{
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 ⤅
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,
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);