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

Go to the source code of this file.

Macros

#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
 

Functions

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

#define HASH4   HASH4b

Referenced by hash4().

#define HASH4a   h = (h << 5) - h + *key++;
#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

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

Definition at line 84 of file hash.c.

References data, HASH4, key, len, and size.

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 authenticateDigestNonceSetup(), cacheCreate(), cacheIndexCreate(), clientdbInit(), externalAclInit(), fqdncache_init(), Dns::Init(), Store::Disks::init(), Ident::Init(), ipcache_init(), LeakFinder::LeakFinder(), main(), netdbInit(), PconnPool::PconnPool(), and read_passwd_file().

int hash_delete ( hash_table hid,
const char *  key 
)

Definition at line 255 of file hash.c.

References hash_delete_link(), and hash_lookup().

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_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().

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

Definition at line 158 of file hash.c.

References assert, hash_table::buckets, hash_table::hash, i, NULL, print_stats(), and hash_table::size.

Referenced by my_hash_insert().

void hash_join ( hash_table hid,
hash_link lnk 
)
unsigned int hash_string ( const void *  data,
unsigned int  size 
)

Definition at line 53 of file hash.c.

References data, i, and size.

int hash_unlink ( hash_table hid,
hash_link hl,
int  FreeLink 
)
unsigned int hash_url ( const void *  data,
unsigned int  size 
)

Definition at line 41 of file hash.c.

References data, i, and size.

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

Definition at line 335 of file membanger.c.

References free.

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().

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors