hash.c File Reference

simple in-memory hashing routines More...

#include "jam.h"
#include "hash.h"

Data Structures

struct  hashhdr
struct  hashdata
struct  item
struct  hash
struct  hash::tab_s
struct  hash::items_s

Defines

#define MAX_LISTS   32
#define ALIGNED(x)   ( ( x + sizeof( item_t ) - 1 ) & ~( sizeof( item_t ) - 1 ) )

Typedefs

typedef item item_t

Functions

static void hash_rehash (struct hash *hp)
static void hash_stat (struct hash *hp)
int hash_item (register struct hash *hp, HASHDATA **data, int enter)
static void hash_rehash (register struct hash *hp)
hashhash_init (int datalen, const char *name)
void hash_done (struct hash *hp)


Detailed Description

simple in-memory hashing routines

External routines:

hash_init() - initialize a hash table, returning a handle.
hash_item() - find a record in the table, and optionally enter a new one.
hash_done() - free a hash table, given its handle.

Internal routines:

hash_rehash() - resize and rebuild hp->tab, the hash table


Define Documentation

#define ALIGNED (  )     ( ( x + sizeof( item_t ) - 1 ) & ~( sizeof( item_t ) - 1 ) )

#define MAX_LISTS   32

Maximum LISTS hold in ...


Typedef Documentation

typedef struct item item_t


Function Documentation

void hash_done ( struct hash hp  ) 

free a hash table, given its handle.

struct hash* hash_init ( int  datalen,
const char *  name 
)

initialize a hash table, returning a handle

Parameters:
[in] datalen Length of records in this table
[in] name Name printed by hash_stat.

int hash_item ( register struct hash hp,
HASHDATA **  data,
int  enter 
)

find a record in the table, and optionally enter a new one.

static void hash_rehash ( register struct hash hp  )  [static]

resize and rebuild hp->tab, the hash table.

static void hash_rehash ( struct hash hp  )  [static]

static void hash_stat ( struct hash hp  )  [static]

print hash statistics.


Generated on Thu Aug 17 15:54:32 2006 for MaJam by  doxygen 1.4.7