summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/contrib/strutl.h5
-rw-r--r--apt-pkg/deb/deblistparser.cc2
-rw-r--r--apt-pkg/pkgcache.cc6
3 files changed, 9 insertions, 4 deletions
diff --git a/apt-pkg/contrib/strutl.h b/apt-pkg/contrib/strutl.h
index f3591d65f..918ac89c7 100644
--- a/apt-pkg/contrib/strutl.h
+++ b/apt-pkg/contrib/strutl.h
@@ -141,6 +141,11 @@ bool CheckDomainList(const std::string &Host, const std::string &List);
#define isspace_ascii isspace_ascii_inline
APT_CONST APT_HOT
+static inline int tolower_ascii_unsafe(int const c)
+{
+ return c | 0x20;
+}
+APT_CONST APT_HOT
static inline int tolower_ascii_inline(int const c)
{
return (c >= 'A' && c <= 'Z') ? c + 32 : c;
diff --git a/apt-pkg/deb/deblistparser.cc b/apt-pkg/deb/deblistparser.cc
index 43fc4aa3a..549e75952 100644
--- a/apt-pkg/deb/deblistparser.cc
+++ b/apt-pkg/deb/deblistparser.cc
@@ -369,7 +369,7 @@ unsigned short debListParser::VersionHash()
{
if (isspace_ascii(*Start) != 0)
continue;
- *J++ = tolower_ascii(*Start);
+ *J++ = tolower_ascii_unsafe(*Start);
/* Normalize <= to < and >= to >. This is the wrong way around, but
* more efficient that the right way. And since we're only hashing
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();
}