From dfbfa84d1df5452825ded5500a2e42f6ec64a724 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Tue, 25 Aug 2015 08:06:45 +0200 Subject: m + attributes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/libmdsserver/hash-table.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/libmdsserver/hash-table.c') 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; -- cgit v1.2.3-70-g09d2