#include "setup.h"#include <string.h>#include <stdlib.h>#include "hash.h"#include "llist.h"#include "memory.h"#include "memdebug.h"Go to the source code of this file.
Defines | |
| #define | FETCH_LIST(x, y, z) x->table[x->hash_func(y, z, x->slots)] |
Functions | |
| static void | hash_element_dtor (void *user, void *element) |
| int | Curl_hash_init (struct curl_hash *h, int slots, hash_function hfunc, comp_function comparator, curl_hash_dtor dtor) |
| struct curl_hash * | Curl_hash_alloc (int slots, hash_function hfunc, comp_function comparator, curl_hash_dtor dtor) |
| static struct curl_hash_element * | mk_hash_element (void *key, size_t key_len, const void *p) |
| void * | Curl_hash_add (struct curl_hash *h, void *key, size_t key_len, void *p) |
| int | Curl_hash_delete (struct curl_hash *h, void *key, size_t key_len) |
| void * | Curl_hash_pick (struct curl_hash *h, void *key, size_t key_len) |
| void | Curl_hash_clean (struct curl_hash *h) |
| void | Curl_hash_clean_with_criterium (struct curl_hash *h, void *user, int(*comp)(void *, void *)) |
| void | Curl_hash_destroy (struct curl_hash *h) |
| size_t | Curl_hash_str (void *key, size_t key_length, size_t slots_num) |
| size_t | Curl_str_key_compare (void *k1, size_t key1_len, void *k2, size_t key2_len) |
| #define FETCH_LIST | ( | x, | |||
| y, | |||||
| z | ) | x->table[x->hash_func(y, z, x->slots)] |
Definition at line 138 of file hash.c.
Referenced by Curl_hash_add(), Curl_hash_delete(), and Curl_hash_pick().
| void* Curl_hash_add | ( | struct curl_hash * | h, | |
| void * | key, | |||
| size_t | key_len, | |||
| void * | p | |||
| ) |
Definition at line 143 of file hash.c.
References curl_hash::comp_func, Curl_llist_insert_next(), curl_hash::dtor, FETCH_LIST, free, curl_llist::head, if(), curl_hash_element::key, curl_hash_element::key_len, l, mk_hash_element(), curl_llist_element::next, NULL, curl_hash_element::ptr, curl_llist_element::ptr, curl_hash::size, and curl_llist::tail.
Referenced by Curl_cache_addr(), and sh_addentry().
| struct curl_hash* Curl_hash_alloc | ( | int | slots, | |
| hash_function | hfunc, | |||
| comp_function | comparator, | |||
| curl_hash_dtor | dtor | |||
| ) | [read] |
Definition at line 88 of file hash.c.
References Curl_hash_init(), free, simple_client::h, malloc, and NULL.
Referenced by Curl_mk_dnscache(), and sh_init().
| void Curl_hash_clean | ( | struct curl_hash * | h | ) |
Definition at line 230 of file hash.c.
References Curl_llist_destroy(), free, curl_hash::slots, and curl_hash::table.
Referenced by Curl_global_host_cache_dtor(), and Curl_hash_destroy().
| void Curl_hash_clean_with_criterium | ( | struct curl_hash * | h, | |
| void * | user, | |||
| int(*)(void *, void *) | comp | |||
| ) |
Definition at line 242 of file hash.c.
References Curl_llist_remove(), curl_llist::head, curl_llist_element::next, curl_hash_element::ptr, curl_llist_element::ptr, curl_hash::slots, and curl_hash::table.
Referenced by hostcache_prune(), and remove_entry_if_stale().
| int Curl_hash_delete | ( | struct curl_hash * | h, | |
| void * | key, | |||
| size_t | key_len | |||
| ) |
Definition at line 177 of file hash.c.
References curl_hash::comp_func, Curl_llist_remove(), FETCH_LIST, curl_llist::head, curl_hash_element::key, curl_hash_element::key_len, l, curl_llist_element::next, and curl_llist_element::ptr.
Referenced by sh_delentry().
| void Curl_hash_destroy | ( | struct curl_hash * | h | ) |
Definition at line 267 of file hash.c.
References Curl_hash_clean(), and free.
Referenced by Curl_close(), curl_easy_perform(), curl_multi_add_handle(), curl_multi_cleanup(), curl_multi_init(), Curl_setopt(), curl_share_cleanup(), and curl_share_setopt().
| int Curl_hash_init | ( | struct curl_hash * | h, | |
| int | slots, | |||
| hash_function | hfunc, | |||
| comp_function | comparator, | |||
| curl_hash_dtor | dtor | |||
| ) |
Definition at line 52 of file hash.c.
References curl_hash::comp_func, Curl_llist_alloc(), Curl_llist_destroy(), curl_hash::dtor, free, hash_element_dtor(), curl_hash::hash_func, malloc, NULL, curl_hash::size, curl_hash::slots, and curl_hash::table.
Referenced by Curl_global_host_cache_init(), and Curl_hash_alloc().
| void* Curl_hash_pick | ( | struct curl_hash * | h, | |
| void * | key, | |||
| size_t | key_len | |||
| ) |
Definition at line 194 of file hash.c.
References curl_hash::comp_func, FETCH_LIST, curl_llist::head, curl_hash_element::key, curl_hash_element::key_len, l, curl_llist_element::next, NULL, curl_hash_element::ptr, and curl_llist_element::ptr.
Referenced by curl_multi_assign(), Curl_resolv(), multi_socket(), sh_addentry(), sh_delentry(), and singlesocket().
| size_t Curl_hash_str | ( | void * | key, | |
| size_t | key_length, | |||
| size_t | slots_num | |||
| ) |
Definition at line 276 of file hash.c.
Referenced by Curl_global_host_cache_init(), and Curl_mk_dnscache().
| size_t Curl_str_key_compare | ( | void * | k1, | |
| size_t | key1_len, | |||
| void * | k2, | |||
| size_t | key2_len | |||
| ) |
Definition at line 290 of file hash.c.
Referenced by Curl_global_host_cache_init(), and Curl_mk_dnscache().
| static void hash_element_dtor | ( | void * | user, | |
| void * | element | |||
| ) | [static] |
Definition at line 37 of file hash.c.
References curl_hash::dtor, simple_client::e, free, simple_client::h, curl_hash_element::key, and curl_hash_element::ptr.
Referenced by Curl_hash_init().
| static struct curl_hash_element* mk_hash_element | ( | void * | key, | |
| size_t | key_len, | |||
| const void * | p | |||
| ) | [static, read] |
Definition at line 114 of file hash.c.
References free, curl_hash_element::key, curl_hash_element::key_len, malloc, NULL, and curl_hash_element::ptr.
Referenced by Curl_hash_add().
1.5.6