geany  1.38
About: Geany is a text editor (using GTK2) with basic features of an integrated development environment (syntax highlighting, code folding, symbol name auto-completion, ...). F: office T: editor programming GTK+ IDE
  Fossies Dox: geany-1.38.tar.bz2  ("unofficial" and yet experimental doxygen-generated source code documentation)  

htable.c File Reference
#include "general.h"
#include "htable.h"
#include <stdio.h>
#include "routines.h"
#include <string.h>
Include dependency graph for htable.c:

Go to the source code of this file.

Classes

struct  sHashEntry
 
struct  sHashTable
 
struct  chainTracker
 

Typedefs

typedef struct sHashEntry hentry
 

Functions

static hentryentry_new (void *key, void *value, hentry *next)
 
static hentryentry_destroy (hentry *entry, hashTableFreeFunc keyfreefn, hashTableFreeFunc valfreefn)
 
static void entry_reclaim (hentry *entry, hashTableFreeFunc keyfreefn, hashTableFreeFunc valfreefn)
 
static void * entry_find (hentry *entry, const void *const key, hashTableEqualFunc equalfn)
 
static bool entry_delete (hentry **entry, const void *key, hashTableEqualFunc equalfn, hashTableFreeFunc keyfreefn, hashTableFreeFunc valfreefn)
 
static bool entry_foreach (hentry *entry, hashTableForeachFunc proc, void *user_data)
 
hashTablehashTableNew (unsigned int size, hashTableHashFunc hashfn, hashTableEqualFunc equalfn, hashTableFreeFunc keyfreefn, hashTableFreeFunc valfreefn)
 
hashTablehashTableIntNew (unsigned int size, hashTableHashFunc hashfn, hashTableEqualFunc equalfn, hashTableFreeFunc keyfreefn)
 
void hashTableDelete (hashTable *htable)
 
void hashTableClear (hashTable *htable)
 
void hashTablePutItem (hashTable *htable, void *key, void *value)
 
void * hashTableGetItem (hashTable *htable, const void *key)
 
bool hashTableDeleteItem (hashTable *htable, const void *key)
 
bool hashTableHasItem (hashTable *htable, const void *key)
 
bool hashTableForeachItem (hashTable *htable, hashTableForeachFunc proc, void *user_data)
 
static bool track_chain (const void *const key, void *value, void *chain_data)
 
bool hashTableForeachItemOnChain (hashTable *htable, const void *key, hashTableForeachFunc proc, void *user_data)
 
static bool count (const void *const key, void *value, void *data)
 
int hashTableCountItem (hashTable *htable)
 
unsigned int hashPtrhash (const void *const x)
 
bool hashPtreq (const void *const a, const void *const b)
 
static unsigned long djb2 (const unsigned char *str)
 
static unsigned long casedjb2 (const unsigned char *str)
 
unsigned int hashCstrhash (const void *const x)
 
bool hashCstreq (const void *const a, const void *const b)
 
unsigned int hashInthash (const void *const x)
 
bool hashInteq (const void *const a, const void *const b)
 
unsigned int hashCstrcasehash (const void *const x)
 
bool hashCstrcaseeq (const void *const a, const void *const b)
 

Typedef Documentation

◆ hentry

typedef struct sHashEntry hentry

Definition at line 34 of file htable.c.

Function Documentation

◆ casedjb2()

static unsigned long casedjb2 ( const unsigned char *  str)
static

Definition at line 300 of file htable.c.

Referenced by hashCstrcasehash().

◆ count()

static bool count ( const void *const  key,
void *  value,
void *  data 
)
static

Definition at line 254 of file htable.c.

Referenced by hashTableCountItem().

◆ djb2()

static unsigned long djb2 ( const unsigned char *  str)
static

Definition at line 288 of file htable.c.

Referenced by hashCstrhash().

◆ entry_delete()

static bool entry_delete ( hentry **  entry,
const void *  key,
hashTableEqualFunc  equalfn,
hashTableFreeFunc  keyfreefn,
hashTableFreeFunc  valfreefn 
)
static

Definition at line 105 of file htable.c.

References entry, and entry_destroy().

Referenced by hashTableDeleteItem().

◆ entry_destroy()

static hentry * entry_destroy ( hentry entry,
hashTableFreeFunc  keyfreefn,
hashTableFreeFunc  valfreefn 
)
static

Definition at line 68 of file htable.c.

References eFree(), entry, and NULL.

Referenced by entry_delete(), and entry_reclaim().

◆ entry_find()

static void * entry_find ( hentry entry,
const void *const  key,
hashTableEqualFunc  equalfn 
)
static

Definition at line 94 of file htable.c.

References entry, and NULL.

Referenced by hashTableGetItem().

◆ entry_foreach()

static bool entry_foreach ( hentry entry,
hashTableForeachFunc  proc,
void *  user_data 
)
static

Definition at line 120 of file htable.c.

References entry.

Referenced by hashTableForeachItem(), and hashTableForeachItemOnChain().

◆ entry_new()

static hentry * entry_new ( void *  key,
void *  value,
hentry next 
)
static

Definition at line 57 of file htable.c.

References entry, and xMalloc.

Referenced by hashTablePutItem().

◆ entry_reclaim()

static void entry_reclaim ( hentry entry,
hashTableFreeFunc  keyfreefn,
hashTableFreeFunc  valfreefn 
)
static

Definition at line 86 of file htable.c.

References entry, and entry_destroy().

Referenced by hashTableClear().

◆ hashCstrcaseeq()

bool hashCstrcaseeq ( const void *const  a,
const void *const  b 
)

Definition at line 354 of file htable.c.

References strcasecmp.

Referenced by initializeParsing().

◆ hashCstrcasehash()

unsigned int hashCstrcasehash ( const void *const  x)

Definition at line 348 of file htable.c.

References casedjb2().

Referenced by initializeParsing().

◆ hashCstreq()

bool hashCstreq ( const void *const  a,
const void *const  b 
)

Definition at line 322 of file htable.c.

◆ hashCstrhash()

unsigned int hashCstrhash ( const void *const  x)

Definition at line 316 of file htable.c.

References djb2().

◆ hashInteq()

bool hashInteq ( const void *const  a,
const void *const  b 
)

Definition at line 339 of file htable.c.

◆ hashInthash()

unsigned int hashInthash ( const void *const  x)

Definition at line 327 of file htable.c.

◆ hashPtreq()

bool hashPtreq ( const void *const  a,
const void *const  b 
)

Definition at line 280 of file htable.c.

◆ hashPtrhash()

unsigned int hashPtrhash ( const void *const  x)

Definition at line 268 of file htable.c.

References ptr.

◆ hashTableClear()

void hashTableClear ( hashTable htable)

◆ hashTableCountItem()

int hashTableCountItem ( hashTable htable)

Definition at line 261 of file htable.c.

References count(), and hashTableForeachItem().

◆ hashTableDelete()

void hashTableDelete ( hashTable htable)

Definition at line 159 of file htable.c.

References eFree(), hashTableClear(), and sHashTable::table.

Referenced by initializeParsing().

◆ hashTableDeleteItem()

bool hashTableDeleteItem ( hashTable htable,
const void *  key 
)

◆ hashTableForeachItem()

bool hashTableForeachItem ( hashTable htable,
hashTableForeachFunc  proc,
void *  user_data 
)

Definition at line 216 of file htable.c.

References entry_foreach(), sHashTable::size, and sHashTable::table.

Referenced by hashTableCountItem().

◆ hashTableForeachItemOnChain()

bool hashTableForeachItemOnChain ( hashTable htable,
const void *  key,
hashTableForeachFunc  proc,
void *  user_data 
)

◆ hashTableGetItem()

void * hashTableGetItem ( hashTable htable,
const void *  key 
)

◆ hashTableHasItem()

bool hashTableHasItem ( hashTable htable,
const void *  key 
)

Definition at line 211 of file htable.c.

References hashTableGetItem().

◆ hashTableIntNew()

hashTable * hashTableIntNew ( unsigned int  size,
hashTableHashFunc  hashfn,
hashTableEqualFunc  equalfn,
hashTableFreeFunc  keyfreefn 
)

Definition at line 151 of file htable.c.

References hashTableNew(), and NULL.

◆ hashTableNew()

hashTable * hashTableNew ( unsigned int  size,
hashTableHashFunc  hashfn,
hashTableEqualFunc  equalfn,
hashTableFreeFunc  keyfreefn,
hashTableFreeFunc  valfreefn 
)

◆ hashTablePutItem()

void hashTablePutItem ( hashTable htable,
void *  key,
void *  value 
)

Definition at line 186 of file htable.c.

References entry_new(), sHashTable::hashfn, sHashTable::size, and sHashTable::table.

Referenced by initializeParsingCommon().

◆ track_chain()

static bool track_chain ( const void *const  key,
void *  value,
void *  chain_data 
)
static