* htable_get - find an entry in the hash table * @ht: the hashtable * @h: the hash value of the entry * @cmp: the comparison function * @ptr: the pointer to hand to the comparison function. * * Convenient inline wrapper for htable_firstval/htable_nextval loop. */
| 222 | * Convenient inline wrapper for htable_firstval/htable_nextval loop. |
| 223 | */ |
| 224 | static inline void *htable_get(const struct htable *ht, |
| 225 | size_t h, |
| 226 | bool (*cmp)(const void *candidate, void *ptr), |
| 227 | const void *ptr) |
| 228 | { |
| 229 | struct htable_iter i; |
| 230 | void *c; |
| 231 | |
| 232 | for (c = htable_firstval(ht,&i,h); c; c = htable_nextval(ht,&i,h)) { |
| 233 | if (cmp(c, (void *)ptr)) |
| 234 | return c; |
| 235 | } |
| 236 | return NULL; |
| 237 | } |
| 238 | |
| 239 | /** |
| 240 | * htable_first - find an entry in the hash table |