#include <sys/types.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "hashtab.h"
Go to the source code of this file.
Defines | |
#define | EMPTY_ENTRY ((void *) 0) |
#define | DELETED_ENTRY ((void *) 1) |
Functions | |
static unsigned long | higher_prime_number (unsigned long) |
static hashval_t | hash_pointer (const void *) |
static int | eq_pointer (const void *, const void *) |
static int | htab_expand (htab_t) |
static void ** | find_empty_slot_for_expand (htab_t, hashval_t) |
static hashval_t | hash_pointer (void *p) const |
static int | eq_pointer (void *p1, const void *p2) const |
htab_t | htab_try_create (size_t size, htab_hash hash_f, htab_eq eq_f, htab_del del_f) |
void | htab_delete (htab_t htab) |
void | htab_empty (htab_t htab) |
void * | htab_find_with_hash (htab_t htab, const void *element, hashval_t hash) |
void * | htab_find (htab_t htab, const void *element) |
void ** | htab_find_slot_with_hash (htab_t htab, const void *element, hashval_t hash, enum insert_option insert) |
void ** | htab_find_slot (htab_t htab, const void *element, enum insert_option insert) |
void | htab_remove_elt (htab_t htab, void *element) |
void | htab_clear_slot (htab_t htab, void **slot) |
void | htab_traverse (htab_t htab, htab_trav callback, void *info) |
size_t | htab_size (htab_t htab) |
size_t | htab_elements (htab_t htab) |
double | htab_collisions (htab_t htab) |
Variables | |
htab_hash | htab_hash_pointer = hash_pointer |
htab_eq | htab_eq_pointer = eq_pointer |
#define DELETED_ENTRY ((void *) 1) |
Definition at line 47 of file hashtab.c.
Referenced by find_empty_slot_for_expand(), htab_clear_slot(), htab_delete(), htab_empty(), htab_expand(), htab_find_slot_with_hash(), htab_find_with_hash(), htab_remove_elt(), and htab_traverse().
#define EMPTY_ENTRY ((void *) 0) |
Definition at line 42 of file hashtab.c.
Referenced by find_empty_slot_for_expand(), htab_clear_slot(), htab_delete(), htab_empty(), htab_expand(), htab_find_slot_with_hash(), htab_find_with_hash(), htab_remove_elt(), and htab_traverse().
static int eq_pointer | ( | void * | p1, | |
const void * | p2 | |||
) | const [static] |
static int eq_pointer | ( | const void * | , | |
const void * | ||||
) | [static] |
Definition at line 224 of file hashtab.c.
References DELETED_ENTRY, EMPTY_ENTRY, and size.
Referenced by htab_expand().
static hashval_t hash_pointer | ( | const void * | ) | [static] |
static unsigned long higher_prime_number | ( | unsigned | long | ) | [static] |
void htab_clear_slot | ( | htab_t | htab, | |
void ** | slot | |||
) |
void htab_delete | ( | htab_t | htab | ) |
Definition at line 184 of file hashtab.c.
References DELETED_ENTRY, and EMPTY_ENTRY.
Referenced by read_abbrev().
void htab_empty | ( | htab_t | htab | ) |
static int htab_expand | ( | htab_t | ) | [static] |
Definition at line 256 of file hashtab.c.
References DELETED_ENTRY, EMPTY_ENTRY, find_empty_slot_for_expand(), higher_prime_number(), and nentries.
Referenced by htab_find_slot_with_hash().
void* htab_find | ( | htab_t | htab, | |
const void * | element | |||
) |
void** htab_find_slot | ( | htab_t | htab, | |
const void * | element, | |||
enum insert_option | insert | |||
) |
Definition at line 418 of file hashtab.c.
References htab_find_slot_with_hash().
Referenced by htab_remove_elt(), and read_abbrev().
void** htab_find_slot_with_hash | ( | htab_t | htab, | |
const void * | element, | |||
hashval_t | hash, | |||
enum insert_option | insert | |||
) |
Definition at line 358 of file hashtab.c.
References DELETED_ENTRY, EMPTY_ENTRY, htab_expand(), INSERT, NO_INSERT, and size.
Referenced by htab_find_slot().
Definition at line 303 of file hashtab.c.
References DELETED_ENTRY, EMPTY_ENTRY, and size.
Referenced by htab_find().
void htab_remove_elt | ( | htab_t | htab, | |
void * | element | |||
) |
Definition at line 432 of file hashtab.c.
References DELETED_ENTRY, EMPTY_ENTRY, htab_find_slot(), and NO_INSERT.
Definition at line 152 of file hashtab.c.
References htab::del_f, htab::entries, htab::eq_f, htab::hash_f, higher_prime_number(), htab::return_allocation_failure, and htab::size.
Referenced by read_abbrev().
htab_eq htab_eq_pointer = eq_pointer |
htab_hash htab_hash_pointer = hash_pointer |