* src/hash.c: Silence UBSAN for hash functions

This commit is contained in:
Tim Rühsen 2018-05-09 12:16:51 +02:00
parent cdaee00259
commit 3cbdc67c96

View File

@ -634,6 +634,9 @@ hash_table_count (const struct hash_table *ht)
this one seems to perform much better, both by being faster and by this one seems to perform much better, both by being faster and by
generating less collisions. */ generating less collisions. */
#ifdef __clang__
__attribute__((no_sanitize("integer")))
#endif
static unsigned long static unsigned long
hash_string (const void *key) hash_string (const void *key)
{ {
@ -672,6 +675,9 @@ make_string_hash_table (int items)
/* Like hash_string, but produce the same hash regardless of the case. */ /* Like hash_string, but produce the same hash regardless of the case. */
#ifdef __clang__
__attribute__((no_sanitize("integer")))
#endif
static unsigned long static unsigned long
hash_string_nocase (const void *key) hash_string_nocase (const void *key)
{ {
@ -710,6 +716,9 @@ make_nocase_string_hash_table (int items)
Knuth's multiplication hash, this function doesn't need to know the Knuth's multiplication hash, this function doesn't need to know the
hash table size to work. */ hash table size to work. */
#ifdef __clang__
__attribute__((no_sanitize("integer")))
#endif
unsigned long unsigned long
hash_pointer (const void *ptr) hash_pointer (const void *ptr)
{ {