add cso_hash_contains() function
This commit is contained in:
parent
2a7dc79273
commit
4fe186f8dc
|
@ -431,3 +431,9 @@ struct cso_hash_iter cso_hash_erase(struct cso_hash *hash, struct cso_hash_iter
|
|||
--hash->data.d->size;
|
||||
return ret;
|
||||
}
|
||||
|
||||
boolean cso_hash_contains(struct cso_hash *hash, unsigned key)
|
||||
{
|
||||
struct cso_node **node = cso_hash_find_node(hash, key);
|
||||
return (*node != hash->data.e);
|
||||
}
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
#ifndef CSO_HASH_H
|
||||
#define CSO_HASH_H
|
||||
|
||||
#include "pipe/p_compiler.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -95,6 +96,11 @@ struct cso_hash_iter cso_hash_first_node(struct cso_hash *hash);
|
|||
*/
|
||||
struct cso_hash_iter cso_hash_find(struct cso_hash *hash, unsigned key);
|
||||
|
||||
/**
|
||||
* Returns true if a value with the given key exists in the hash
|
||||
*/
|
||||
boolean cso_hash_contains(struct cso_hash *hash, unsigned key);
|
||||
|
||||
|
||||
int cso_hash_iter_is_null(struct cso_hash_iter iter);
|
||||
unsigned cso_hash_iter_key(struct cso_hash_iter iter);
|
||||
|
|
Loading…
Reference in New Issue