tools/hashtab.c File Reference

#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 Documentation

#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().


Function Documentation

static int eq_pointer ( void *  p1,
const void *  p2 
) const [static]

Definition at line 139 of file hashtab.c.

static int eq_pointer ( const void *  ,
const void *   
) [static]

static void ** find_empty_slot_for_expand ( htab_t  ,
hashval_t   
) [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 ( void *  p  )  const [static]

Definition at line 130 of file hashtab.c.

static hashval_t hash_pointer ( const void *   )  [static]

static unsigned long higher_prime_number ( unsigned  long  )  [static]

Definition at line 65 of file hashtab.c.

Referenced by htab_expand(), and htab_try_create().

void htab_clear_slot ( htab_t  htab,
void **  slot 
)

Definition at line 454 of file hashtab.c.

References DELETED_ENTRY, and EMPTY_ENTRY.

double htab_collisions ( htab_t  htab  ) 

Definition at line 516 of file hashtab.c.

void htab_delete ( htab_t  htab  ) 

Definition at line 184 of file hashtab.c.

References DELETED_ENTRY, and EMPTY_ENTRY.

Referenced by read_abbrev().

size_t htab_elements ( htab_t  htab  ) 

Definition at line 506 of file hashtab.c.

void htab_empty ( htab_t  htab  ) 

Definition at line 202 of file hashtab.c.

References DELETED_ENTRY, and EMPTY_ENTRY.

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 
)

Definition at line 342 of file hashtab.c.

References htab_find_with_hash().

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().

void* htab_find_with_hash ( htab_t  htab,
const void *  element,
hashval_t  hash 
)

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.

size_t htab_size ( htab_t  htab  ) 

Definition at line 497 of file hashtab.c.

void htab_traverse ( htab_t  htab,
htab_trav  callback,
void *  info 
)

Definition at line 475 of file hashtab.c.

References DELETED_ENTRY, and EMPTY_ENTRY.

htab_t htab_try_create ( size_t  size,
htab_hash  hash_f,
htab_eq  eq_f,
htab_del  del_f 
)

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().


Variable Documentation

htab_eq htab_eq_pointer = eq_pointer

Definition at line 59 of file hashtab.c.

htab_hash htab_hash_pointer = hash_pointer

Definition at line 58 of file hashtab.c.


Generated on Tue Feb 19 22:53:38 2008 for rpm by  doxygen 1.5.1