#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include "list.h"
Go to the source code of this file.
Data Structures | |
struct | hash_elem |
struct | hash |
struct | hash_iterator |
Defines | |
#define | hash_entry(HASH_ELEM, STRUCT, MEMBER) |
Typedefs | |
typedef unsigned | hash_hash_func (const struct hash_elem *e, void *aux) |
typedef bool | hash_less_func (const struct hash_elem *a, const struct hash_elem *b, void *aux) |
typedef void | hash_action_func (struct hash_elem *e, void *aux) |
Functions | |
bool | hash_init (struct hash *, hash_hash_func *, hash_less_func *, void *aux) |
void | hash_clear (struct hash *, hash_action_func *) |
void | hash_destroy (struct hash *, hash_action_func *) |
struct hash_elem * | hash_insert (struct hash *, struct hash_elem *) |
struct hash_elem * | hash_replace (struct hash *, struct hash_elem *) |
struct hash_elem * | hash_find (struct hash *, struct hash_elem *) |
struct hash_elem * | hash_delete (struct hash *, struct hash_elem *) |
void | hash_apply (struct hash *, hash_action_func *) |
void | hash_first (struct hash_iterator *, struct hash *) |
struct hash_elem * | hash_next (struct hash_iterator *) |
struct hash_elem * | hash_cur (struct hash_iterator *) |
size_t | hash_size (struct hash *) |
bool | hash_empty (struct hash *) |
unsigned | hash_bytes (const void *, size_t) |
unsigned | hash_string (const char *) |
unsigned | hash_int (int) |
#define hash_entry | ( | HASH_ELEM, | |||
STRUCT, | |||||
MEMBER | ) |
typedef void hash_action_func(struct hash_elem *e, void *aux) |
typedef unsigned hash_hash_func(const struct hash_elem *e, void *aux) |
typedef bool hash_less_func(const struct hash_elem *a, const struct hash_elem *b, void *aux) |
void hash_apply | ( | struct hash * | , | |
hash_action_func * | ||||
) |
Definition at line 163 of file hash.c.
References ASSERT, hash::aux, hash::bucket_cnt, hash::buckets, list_begin(), list_elem_to_hash_elem, list_end(), list_next(), next(), and NULL.
unsigned hash_bytes | ( | const void * | , | |
size_t | ||||
) |
Definition at line 266 of file hash.c.
References ASSERT, buf, FNV_32_BASIS, FNV_32_PRIME, and NULL.
Referenced by hash_int().
void hash_clear | ( | struct hash * | , | |
hash_action_func * | ||||
) |
Definition at line 54 of file hash.c.
References hash::aux, hash::bucket_cnt, hash::buckets, hash::elem_cnt, list_elem_to_hash_elem, list_empty(), list_init(), list_pop_front(), and NULL.
Referenced by hash_destroy(), and hash_init().
struct hash_elem* hash_cur | ( | struct hash_iterator * | ) | [read] |
Definition at line 145 of file hash.c.
References find_bucket(), find_elem(), NULL, rehash(), and remove_elem().
void hash_destroy | ( | struct hash * | , | |
hash_action_func * | ||||
) |
bool hash_empty | ( | struct hash * | ) |
void hash_first | ( | struct hash_iterator * | , | |
struct hash * | ||||
) |
Definition at line 200 of file hash.c.
References ASSERT, hash_iterator::bucket, hash::buckets, hash_iterator::elem, hash_iterator::hash, list_elem_to_hash_elem, list_head(), and NULL.
bool hash_init | ( | struct hash * | , | |
hash_hash_func * | , | |||
hash_less_func * | , | |||
void * | aux | |||
) |
Definition at line 25 of file hash.c.
References hash::aux, hash::bucket_cnt, hash::buckets, hash::elem_cnt, hash::hash, hash_clear(), hash::less, malloc(), and NULL.
Definition at line 99 of file hash.c.
References find_bucket(), find_elem(), insert_elem(), NULL, and rehash().
unsigned hash_int | ( | int | ) |
struct hash_elem* hash_next | ( | struct hash_iterator * | ) | [read] |
Definition at line 219 of file hash.c.
References ASSERT, hash_iterator::bucket, hash::bucket_cnt, hash::buckets, hash_iterator::elem, hash_iterator::hash, list_begin(), hash_elem::list_elem, list_elem_to_hash_elem, list_end(), list_next(), and NULL.
Definition at line 115 of file hash.c.
References find_bucket(), find_elem(), insert_elem(), NULL, rehash(), and remove_elem().
unsigned hash_string | ( | const char * | ) |