summaryrefslogtreecommitdiff
path: root/apt-pkg/contrib/strutl.h
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/contrib/strutl.h
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/contrib/strutl.h')
-rw-r--r--apt-pkg/contrib/strutl.h5
1 files changed, 5 insertions, 0 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;