summaryrefslogtreecommitdiff
path: root/util/qht.c
diff options
context:
space:
mode:
authorEmilio G. Cota <cota@braap.org>2018-09-10 13:40:07 -0400
committerRichard Henderson <richard.henderson@linaro.org>2018-09-26 08:55:54 -0700
commite6c58299502fb94e329b7a35a12feacde6c1cbc6 (patch)
tree0b4cb5d1c8d651181307a637a45e04d947f64a74 /util/qht.c
parent9650ad3e9924ec98a42c6448292e2442e0c58457 (diff)
qht: constify qht_lookup
seqlock_read_begin takes a const param since c04649eeea ("seqlock: constify seqlock_read_begin", 2018-08-23), so we can constify the entire lookup. Signed-off-by: Emilio G. Cota <cota@braap.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'util/qht.c')
-rw-r--r--util/qht.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/util/qht.c b/util/qht.c
index 3564a7e20f..020dfe6912 100644
--- a/util/qht.c
+++ b/util/qht.c
@@ -236,7 +236,7 @@ static inline void qht_head_init(struct qht_bucket *b)
}
static inline
-struct qht_bucket *qht_map_to_bucket(struct qht_map *map, uint32_t hash)
+struct qht_bucket *qht_map_to_bucket(const struct qht_map *map, uint32_t hash)
{
return &map->buckets[hash & (map->n_buckets - 1)];
}
@@ -482,10 +482,10 @@ bool qht_reset_size(struct qht *ht, size_t n_elems)
}
static inline
-void *qht_do_lookup(struct qht_bucket *head, qht_lookup_func_t func,
+void *qht_do_lookup(const struct qht_bucket *head, qht_lookup_func_t func,
const void *userp, uint32_t hash)
{
- struct qht_bucket *b = head;
+ const struct qht_bucket *b = head;
int i;
do {
@@ -509,7 +509,7 @@ void *qht_do_lookup(struct qht_bucket *head, qht_lookup_func_t func,
}
static __attribute__((noinline))
-void *qht_lookup__slowpath(struct qht_bucket *b, qht_lookup_func_t func,
+void *qht_lookup__slowpath(const struct qht_bucket *b, qht_lookup_func_t func,
const void *userp, uint32_t hash)
{
unsigned int version;
@@ -522,11 +522,11 @@ void *qht_lookup__slowpath(struct qht_bucket *b, qht_lookup_func_t func,
return ret;
}
-void *qht_lookup_custom(struct qht *ht, const void *userp, uint32_t hash,
+void *qht_lookup_custom(const struct qht *ht, const void *userp, uint32_t hash,
qht_lookup_func_t func)
{
- struct qht_bucket *b;
- struct qht_map *map;
+ const struct qht_bucket *b;
+ const struct qht_map *map;
unsigned int version;
void *ret;
@@ -545,7 +545,7 @@ void *qht_lookup_custom(struct qht *ht, const void *userp, uint32_t hash,
return qht_lookup__slowpath(b, func, userp, hash);
}
-void *qht_lookup(struct qht *ht, const void *userp, uint32_t hash)
+void *qht_lookup(const struct qht *ht, const void *userp, uint32_t hash)
{
return qht_lookup_custom(ht, userp, hash, ht->cmp);
}