Main Page Namespace List Class Hierarchy Alphabetical List Compound List File List Namespace Members Compound Members File Members Related Pages

hash.c File Reference

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "hash.h"

Go to the source code of this file.


Compounds

struct hash_node_t

Defines

#define HASH_LIMIT 0.5

Typedefs

typedef hash_node_t hash_node_t

Functions

int hash (const hash_t *tptr, const char *key)
VMDEXTERNSTATIC void hash_init (hash_t *tptr, int buckets)
void rebuild_table (hash_t *tptr)
VMDEXTERNSTATIC int hash_lookup (const hash_t *tptr, const char *key)
VMDEXTERNSTATIC int hash_insert (hash_t *tptr, const char *key, int data)
VMDEXTERNSTATIC int hash_delete (hash_t *tptr, const char *key)
VMDEXTERNSTATIC int hash_entries (hash_t *tptr)
VMDEXTERNSTATIC void hash_destroy (hash_t *tptr)
float alos (hash_t *tptr)
VMDEXTERNSTATIC char * hash_stats (hash_t *tptr)

Define Documentation

#define HASH_LIMIT 0.5

Definition at line 27 of file hash.c.

Referenced by hash_insert.


Typedef Documentation

typedef struct hash_node_t hash_node_t

hash table node data structure


Function Documentation

float alos ( hash_t * tptr ) [static]

Definition at line 259 of file hash.c.

References alos, hash_t::bucket, hash_t::entries, hash_node_t::next, NULL, and hash_t::size.

Referenced by alos, and hash_stats.

int hash ( const hash_t * tptr,
const char * key
) [static]

Definition at line 42 of file hash.c.

References hash_t::downshift, and hash_t::mask.

Referenced by hash_delete, hash_insert, hash_lookup, and rebuild_table.

VMDEXTERNSTATIC int hash_delete ( hash_t * ,
const char *
)

delete a string from the hash table, given its string name

Definition at line 183 of file hash.c.

References hash_t::bucket, hash_node_t::data, data, hash, hash_node_t::key, hash_node_t::next, and NULL.

VMDEXTERNSTATIC void hash_destroy ( hash_t * )

destroy the hash table completely, deallocate memory

Definition at line 234 of file hash.c.

References hash_t::bucket, hash_node_t::next, NULL, and hash_t::size.

VMDEXTERNSTATIC int hash_entries ( hash_t * )

return the number of entries in the hash table

Definition at line 223 of file hash.c.

References hash_t::entries.

VMDEXTERNSTATIC void hash_init ( hash_t * ,
int
)

initialize hash table for first use

Definition at line 63 of file hash.c.

References hash_t::bucket, hash_t::downshift, hash_t::entries, hash_t::mask, and hash_t::size.

VMDEXTERNSTATIC int hash_insert ( hash_t * ,
const char * ,
int
)

insert a string into the hash table, along with an integer key

Definition at line 151 of file hash.c.

References hash_t::bucket, hash_node_t::data, data, hash_t::entries, hash, HASH_LIMIT, hash_lookup, hash_node_t::key, hash_node_t::next, rebuild_table, and hash_t::size.

VMDEXTERNSTATIC int hash_lookup ( const hash_t * ,
const char *
)

lookup a string key in the hash table returning its integer key

Definition at line 127 of file hash.c.

References hash_t::bucket, hash_node_t::data, hash, hash_node_t::key, hash_node_t::next, and NULL.

VMDEXTERNSTATIC char* hash_stats ( hash_t * )

print hash table vital stats

Definition at line 280 of file hash.c.

References alos, hash_t::entries, and hash_t::size.

void rebuild_table ( hash_t * tptr ) [static]

Definition at line 93 of file hash.c.

References hash_t::bucket, hash_t::entries, hash, hash_init, hash_node_t::key, hash_node_t::next, and hash_t::size.

Referenced by hash_insert.


Generated on Mon Nov 17 02:47:39 2025 for VMD (current) by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002

AltStyle によって変換されたページ (->オリジナル) /