summaryrefslogtreecommitdiff
path: root/apt-pkg/pkgcache.cc
diff options
context:
space:
mode:
authorJulian Andres Klode <jak@debian.org>2016-09-27 18:20:02 +0200
committerJulian Andres Klode <jak@debian.org>2016-11-22 22:58:18 +0100
commit7a3b00b10b6a5a740e07fc1b68a4f3fb3bcdac23 (patch)
tree4a46568d49227b6ae8c6d614d247b8f1ed582997 /apt-pkg/pkgcache.cc
parent1236419d67e119acc7c0df48f8b14a277e0b5683 (diff)
Introduce tolower_ascii_unsafe() and use it for hashing
This one has some obvious collisions for non-alphabetical characters, like some control characters also hashing to numbers, but we don't really have those, and these are hash functions which are not collision free to begin with.
Diffstat (limited to 'apt-pkg/pkgcache.cc')
-rw-r--r--apt-pkg/pkgcache.cc6
1 files changed, 3 insertions, 3 deletions
diff --git a/apt-pkg/pkgcache.cc b/apt-pkg/pkgcache.cc
index e7e417a5a..b0ba1597f 100644
--- a/apt-pkg/pkgcache.cc
+++ b/apt-pkg/pkgcache.cc
@@ -213,14 +213,14 @@ map_id_t pkgCache::sHash(StringView Str) const
{
uint32_t Hash = 5381;
for (auto I = Str.begin(); I != Str.end(); ++I)
- Hash = 33 * Hash + tolower_ascii(*I);
+ Hash = 33 * Hash + tolower_ascii_unsafe(*I);
return Hash % HeaderP->GetHashTableSize();
}
map_id_t pkgCache::sHash(const string &Str) const
{
uint32_t Hash = 5381;
for (string::const_iterator I = Str.begin(); I != Str.end(); ++I)
- Hash = 33 * Hash + tolower_ascii((signed char)*I);
+ Hash = 33 * Hash + tolower_ascii_unsafe((signed char)*I);
return Hash % HeaderP->GetHashTableSize();
}
@@ -228,7 +228,7 @@ map_id_t pkgCache::sHash(const char *Str) const
{
uint32_t Hash = 5381;
for (const char *I = Str; *I != 0; ++I)
- Hash = 33 * Hash + tolower_ascii((signed char)*I);
+ Hash = 33 * Hash + tolower_ascii_unsafe((signed char)*I);
return Hash % HeaderP->GetHashTableSize();
}