Lines Matching full:k
13 static size_t hash_fn(const void *k, void *ctx) in hash_fn() argument
15 return (long)k; in hash_fn()
56 const void *oldk, *k = (const void *)(long)i; in test_hashmap_generic() local
59 err = hashmap__update(map, k, v, &oldk, &oldv); in test_hashmap_generic()
65 err = hashmap__add(map, k, v); in test_hashmap_generic()
67 err = hashmap__set(map, k, v, &oldk, &oldv); in test_hashmap_generic()
69 "unexpected k/v: %p=%p\n", oldk, oldv)) in test_hashmap_generic()
73 if (CHECK(err, "elem_add", "failed to add k/v %ld = %ld: %d\n", in test_hashmap_generic()
74 (long)k, (long)v, err)) in test_hashmap_generic()
77 if (CHECK(!hashmap__find(map, k, &oldv), "elem_find", in test_hashmap_generic()
78 "failed to find key %ld\n", (long)k)) in test_hashmap_generic()
95 long k = (long)entry->key; in test_hashmap_generic() local
98 found_msk |= 1ULL << k; in test_hashmap_generic()
99 if (CHECK(v - k != 1024, "check_kv", in test_hashmap_generic()
100 "invalid k/v pair: %ld = %ld\n", k, v)) in test_hashmap_generic()
108 const void *oldk, *k = (const void *)(long)i; in test_hashmap_generic() local
111 err = hashmap__add(map, k, v); in test_hashmap_generic()
117 err = hashmap__update(map, k, v, &oldk, &oldv); in test_hashmap_generic()
119 err = hashmap__set(map, k, v, &oldk, &oldv); in test_hashmap_generic()
122 "failed to update k/v %ld = %ld: %d\n", in test_hashmap_generic()
123 (long)k, (long)v, err)) in test_hashmap_generic()
125 if (CHECK(!hashmap__find(map, k, &oldv), "elem_find", in test_hashmap_generic()
126 "failed to find key %ld\n", (long)k)) in test_hashmap_generic()
143 long k = (long)entry->key; in test_hashmap_generic() local
146 found_msk |= 1ULL << k; in test_hashmap_generic()
147 if (CHECK(v - k != 256, "elem_check", in test_hashmap_generic()
148 "invalid updated k/v pair: %ld = %ld\n", k, v)) in test_hashmap_generic()
166 const void *oldk, *k; in test_hashmap_generic() local
169 k = entry->key; in test_hashmap_generic()
173 found_msk |= 1ULL << (long)k; in test_hashmap_generic()
175 if (CHECK(!hashmap__delete(map, k, &oldk, &oldv), "elem_del", in test_hashmap_generic()
176 "failed to delete k/v %ld = %ld\n", in test_hashmap_generic()
177 (long)k, (long)v)) in test_hashmap_generic()
179 if (CHECK(oldk != k || oldv != v, "check_old", in test_hashmap_generic()
180 "invalid deleted k/v: expected %ld = %ld, got %ld = %ld\n", in test_hashmap_generic()
181 (long)k, (long)v, (long)oldk, (long)oldv)) in test_hashmap_generic()
183 if (CHECK(hashmap__delete(map, k, &oldk, &oldv), "elem_del", in test_hashmap_generic()
184 "unexpectedly deleted k/v %ld = %ld\n", in test_hashmap_generic()
202 const void *oldk, *k; in test_hashmap_generic() local
205 k = entry->key; in test_hashmap_generic()
209 found_msk |= 1ULL << (long)k; in test_hashmap_generic()
211 if (CHECK(!hashmap__delete(map, k, &oldk, &oldv), "elem_del", in test_hashmap_generic()
212 "failed to delete k/v %ld = %ld\n", in test_hashmap_generic()
213 (long)k, (long)v)) in test_hashmap_generic()
215 if (CHECK(oldk != k || oldv != v, "elem_check", in test_hashmap_generic()
216 "invalid old k/v: expect %ld = %ld, got %ld = %ld\n", in test_hashmap_generic()
217 (long)k, (long)v, (long)oldk, (long)oldv)) in test_hashmap_generic()
219 if (CHECK(hashmap__delete(map, k, &oldk, &oldv), "elem_del", in test_hashmap_generic()
220 "unexpectedly deleted k/v %ld = %ld\n", in test_hashmap_generic()
221 (long)k, (long)v)) in test_hashmap_generic()
255 static size_t collision_hash_fn(const void *k, void *ctx) in collision_hash_fn() argument
279 if (CHECK(err, "elem_add", "failed to add k/v: %d\n", err)) in test_hashmap_multimap()
282 if (CHECK(err, "elem_add", "failed to add k/v: %d\n", err)) in test_hashmap_multimap()
285 if (CHECK(err, "elem_add", "failed to add k/v: %d\n", err)) in test_hashmap_multimap()
289 if (CHECK(err, "elem_add", "failed to add k/v: %d\n", err)) in test_hashmap_multimap()
292 if (CHECK(err, "elem_add", "failed to add k/v: %d\n", err)) in test_hashmap_multimap()
295 if (CHECK(err, "elem_add", "failed to add k/v: %d\n", err)) in test_hashmap_multimap()
338 void *k = (void *)0; in test_hashmap_empty() local
352 if (CHECK(hashmap__find(map, k, NULL), "elem_find", in test_hashmap_empty()
355 if (CHECK(hashmap__delete(map, k, NULL, NULL), "elem_del", in test_hashmap_empty()
363 hashmap__for_each_key_entry(map, entry, k) { in test_hashmap_empty()