Tachyon (current)  Current Main Branch
Data Structures | Macros | Typedefs | Functions
hash.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "hash.h"

Go to the source code of this file.

Data Structures

struct  hash_node_t
 

Macros

#define HASH_LIMIT   0.5
 

Typedefs

typedef struct hash_node_t hash_node_t
 

Functions

static int hash (rt_hash_t *tptr, const char *key)
 
static void rebuild_table (rt_hash_t *tptr)
 
void rt_hash_init (rt_hash_t *tptr, int buckets)
 
int rt_hash_lookup (rt_hash_t *tptr, const char *key)
 
int rt_hash_insert (rt_hash_t *tptr, const char *key, int data)
 
int rt_hash_delete (rt_hash_t *tptr, const char *key)
 
void rt_hash_destroy (rt_hash_t *tptr)
 
static float alos (rt_hash_t *tptr)
 
char * rt_hash_stats (rt_hash_t *tptr)
 

Macro Definition Documentation

◆ HASH_LIMIT

#define HASH_LIMIT   0.5

Definition at line 17 of file hash.c.

Referenced by rt_hash_insert().

Typedef Documentation

◆ hash_node_t

typedef struct hash_node_t hash_node_t

Function Documentation

◆ alos()

static float alos ( rt_hash_t tptr)
static

Definition at line 243 of file hash.c.

References rt_hash_t::bucket, rt_hash_t::entries, hash_node_t::next, and rt_hash_t::size.

Referenced by rt_hash_stats().

◆ hash()

static int hash ( rt_hash_t tptr,
const char *  key 
)
static

◆ rebuild_table()

static void rebuild_table ( rt_hash_t tptr)
static

◆ rt_hash_delete()

int rt_hash_delete ( rt_hash_t tptr,
const char *  key 
)

◆ rt_hash_destroy()

void rt_hash_destroy ( rt_hash_t tptr)

Definition at line 218 of file hash.c.

References rt_hash_t::bucket, hash_node_t::next, and rt_hash_t::size.

Referenced by free_tex_table().

◆ rt_hash_init()

void rt_hash_init ( rt_hash_t tptr,
int  buckets 
)

◆ rt_hash_insert()

int rt_hash_insert ( rt_hash_t tptr,
const char *  key,
int  data 
)

◆ rt_hash_lookup()

int rt_hash_lookup ( rt_hash_t tptr,
const char *  key 
)

◆ rt_hash_stats()

char* rt_hash_stats ( rt_hash_t tptr)

Definition at line 264 of file hash.c.

References alos(), rt_hash_t::entries, and rt_hash_t::size.