diff options
author | Mattias Andrée <maandree@operamail.com> | 2015-08-25 08:06:45 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2015-08-25 08:06:45 +0200 |
commit | dfbfa84d1df5452825ded5500a2e42f6ec64a724 (patch) | |
tree | 7268e6b3bd63230a9ecaa0963feae2157087128f /src/libmdsserver/hash-table.c | |
parent | libmds_connection: locking (diff) | |
download | mds-dfbfa84d1df5452825ded5500a2e42f6ec64a724.tar.gz mds-dfbfa84d1df5452825ded5500a2e42f6ec64a724.tar.bz2 mds-dfbfa84d1df5452825ded5500a2e42f6ec64a724.tar.xz |
m + attributes
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rw-r--r-- | src/libmdsserver/hash-table.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/libmdsserver/hash-table.c b/src/libmdsserver/hash-table.c index 1e637e0..4de2ac5 100644 --- a/src/libmdsserver/hash-table.c +++ b/src/libmdsserver/hash-table.c @@ -42,7 +42,8 @@ * @param key The key to hash * @return The hash of the key */ -static inline size_t __attribute__((const)) hash(const hash_table_t* restrict this, size_t key) +__attribute__((pure, nonnull)) +static inline size_t hash(const hash_table_t* restrict this, size_t key) { return this->hasher ? this->hasher(key) : key; } @@ -55,7 +56,8 @@ static inline size_t __attribute__((const)) hash(const hash_table_t* restrict th * @param key The key to hash * @return A non-negative value less the the table's capacity */ -static inline size_t __attribute__((pure)) truncate_hash(const hash_table_t* restrict this, size_t hash) +__attribute__((pure, nonnull)) +static inline size_t truncate_hash(const hash_table_t* restrict this, size_t hash) { return hash % this->capacity; } @@ -67,6 +69,7 @@ static inline size_t __attribute__((pure)) truncate_hash(const hash_table_t* res * @param this The hash table * @return Non-zero on error, `errno` will be set accordingly */ +__attribute__((nonnull)) static int rehash(hash_table_t* restrict this) { hash_entry_t** old_buckets = this->buckets; |