hash.c File Reference
#include "squid.h"
#include "hash.h"
Include dependency graph for hash.c:

Go to the source code of this file.


#define free(a)   my_free(__FILE__, __LINE__, a)
#define PRIME1   37
#define PRIME2   1048583
#define HASH4a   h = (h << 5) - h + *key++;
#define HASH4b   h = (h << 5) + h + *key++;
#define HASH4   HASH4b


void my_free (char *, int, void *)
void print_stats ()
unsigned int hash_url (const void *data, unsigned int size)
unsigned int hash_string (const void *data, unsigned int size)
unsigned int hash4 (const void *data, unsigned int size)
hash_tablehash_create (HASHCMP *cmp_func, int hash_sz, HASHHASH *hash_func)
void hash_insert (hash_table *hid, const char *k, void *item)
void hash_join (hash_table *hid, hash_link *lnk)
hash_linkhash_lookup (hash_table *hid, const void *k)
hash_linkhash_first (hash_table *hid)
hash_linkhash_next (hash_table *hid)
int hash_delete (hash_table *hid, const char *key)
int hash_unlink (hash_table *hid, hash_link *hl, int FreeLink)
int hash_delete_link (hash_table *hid, hash_link *hl)
int hash_remove_link (hash_table *hid, hash_link *hl)
hash_linkhash_get_bucket (hash_table *hid, unsigned int bucket)
void hashFreeMemory (hash_table *hid)

Macro Definition Documentation

◆ free


#define HASH4   HASH4b

Referenced by hash4().

◆ HASH4a

#define HASH4a   h = (h << 5) - h + *key++;

◆ HASH4b

#define HASH4b   h = (h << 5) + h + *key++;


#define PRIME1   37

Definition at line 79 of file hash.c.


#define PRIME2   1048583

Definition at line 80 of file hash.c.

Function Documentation

◆ hash4()

unsigned int hash4 ( const void *  data,
unsigned int  size 

Definition at line 84 of file hash.c.

References data, HASH4, len, and size.

◆ hash_create()

hash_table* hash_create ( HASHCMP cmp_func,
int  hash_sz,
HASHHASH hash_func 

hash_create - creates a new hash table, uses the cmp_func to compare keys. Returns the identification for the hash table; otherwise returns a negative number on error.

Definition at line 134 of file hash.c.

References hash_table::buckets, hash_table::cmp, hash_table::current_slot, DEFAULT_HASH_SIZE, hash_table::hash, int, hash_table::next, NULL, hash_table::size, and xcalloc.

Referenced by accessLogInit(), authenticateDigestNonceSetup(), cacheCreate(), cacheIndexCreate(), clientdbInit(), externalAclInit(), fqdncache_init(), hashFreeMemory(), Dns::Init(), Store::Disks::init(), Ident::Init(), ipcache_init(), LeakFinder::LeakFinder(), main(), netdbInit(), PconnPool::PconnPool(), and read_passwd_file().

◆ hash_delete()

int hash_delete ( hash_table hid,
const char *  key 

Definition at line 255 of file hash.c.

References hash_delete_link(), and hash_lookup().

Referenced by hashFreeMemory(), and hashKeyStr().

◆ hash_delete_link()

int hash_delete_link ( hash_table hid,
hash_link hl 

Definition at line 299 of file hash.c.

References hash_unlink().

Referenced by hash_delete().

◆ hash_first()

◆ hash_get_bucket()

hash_link* hash_get_bucket ( hash_table hid,
unsigned int  bucket 

hash_get_bucket - returns the head item of the bucket in the hash table 'hid'. Otherwise, returns NULL on error.

Definition at line 316 of file hash.c.

References hash_table::buckets, NULL, and hash_table::size.

Referenced by clientdbGC(), and Store::LocalSearch::copyBucket().

◆ hash_insert()

void hash_insert ( hash_table hid,
const char *  k,
void *  item 

◆ hash_join()

void hash_join ( hash_table hid,
hash_link lnk 

◆ hash_lookup()

◆ hash_next()

◆ hash_remove_link()

◆ hash_string()

unsigned int hash_string ( const void *  data,
unsigned int  size 

Definition at line 53 of file hash.c.

References data, i, and size.

Referenced by hashFreeMemory().

◆ hash_unlink()

int hash_unlink ( hash_table hid,
hash_link hl,
int  FreeLink 

◆ hash_url()

unsigned int hash_url ( const void *  data,
unsigned int  size 

Definition at line 41 of file hash.c.

References data, i, and size.

◆ hashFreeMemory()

◆ my_free()

void my_free ( char *  file,
int  line,
void *  ptr 

Definition at line 335 of file membanger.c.

References free.

◆ print_stats()

void print_stats ( )

Definition at line 258 of file membanger.c.

References mstat, myusage, rusage::ru_majflt, rusage::ru_maxrss, rusage::ru_stime, rusage::ru_utime, and size2id_len.

Referenced by hash_insert(), and main().






Web Site Translations