]> git.saurik.com Git - apt-legacy.git/blobdiff - apt-pkg/pkgcache.cc
Remove code that isn't being used with Apple http.
[apt-legacy.git] / apt-pkg / pkgcache.cc
index fd6bbd32ad6187bb4a571844a971f1878ef34acd..c0e2e37dc6b7eddaf360667a1195dbf81b74cf3e 100644 (file)
@@ -176,17 +176,30 @@ unsigned long pkgCache::sHash(const char *Str) const
    return Hash % _count(HeaderP->HashTable);
 }
 
+unsigned long pkgCache::sHash(const srkString &Str) const
+{
+   unsigned long Hash = 0;
+   for (const char *I = Str.Start, *E = I + Str.Size; I != E; I++)
+      Hash = 5*Hash + tolower_ascii(*I);
+   return Hash % _count(HeaderP->HashTable);
+}
+
                                                                        /*}}}*/
 // Cache::FindPkg - Locate a package by name                           /*{{{*/
 // ---------------------------------------------------------------------
 /* Returns 0 on error, pointer to the package otherwise */
 pkgCache::PkgIterator pkgCache::FindPkg(const string &Name)
+{
+   return FindPkg(srkString(Name));
+}
+
+pkgCache::PkgIterator pkgCache::FindPkg(const srkString &Name)
 {
    // Look at the hash bucket
    Package *Pkg = PkgP + HeaderP->HashTable[Hash(Name)];
    for (; Pkg != PkgP; Pkg = PkgP + Pkg->NextPackage)
    {
-      if (Pkg->Name != 0 && StrP[Pkg->Name] == Name[0] &&
+      if (Pkg->Name != 0 &&
          stringcasecmp(Name,StrP + Pkg->Name) == 0)
         return PkgIterator(*this,Pkg);
    }