Mercurial > cgi-bin > hgwebdir.cgi > VMS > C_Libraries > Hash_impl
comparison PrivateHash.h @ 0:ee3ad252427e
Initial add
| author | Me |
|---|---|
| date | Sat, 22 May 2010 19:49:28 -0700 |
| parents | |
| children | 5900d90f5d71 |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:bc7d6c169089 |
|---|---|
| 1 /* | |
| 2 * Copyright 2009 OpenSourceStewardshipFoundation.org | |
| 3 * Licensed under GNU General Public License version 2 | |
| 4 * | |
| 5 * Author: seanhalle@yahoo.com | |
| 6 */ | |
| 7 | |
| 8 #ifndef _PRIVATE_HASH_H | |
| 9 #define _PRIVATE_HASH_H | |
| 10 | |
| 11 | |
| 12 #define TRUE 1 | |
| 13 #define FALSE 0 | |
| 14 | |
| 15 | |
| 16 #define HASHSIZE 101 | |
| 17 | |
| 18 typedef struct _HashEntry HashEntry; | |
| 19 | |
| 20 struct _HashEntry | |
| 21 { | |
| 22 char *key; | |
| 23 void *content; | |
| 24 HashEntry *next; | |
| 25 }; | |
| 26 | |
| 27 typedef void (*FreeEntryContentFnPtr) ( void * ); | |
| 28 | |
| 29 typedef struct | |
| 30 { int tableSz; | |
| 31 int numEntries; | |
| 32 HashEntry* *entries; | |
| 33 FreeEntryContentFnPtr freeEntryContentFn; | |
| 34 } | |
| 35 HashTable; | |
| 36 | |
| 37 //=========================================================================== | |
| 38 // Internal functions | |
| 39 void freeHashEntryUsing( HashEntry *entry, HashTable *table ); | |
| 40 char* strdup_m(char *o); | |
| 41 unsigned int hashThisKey( char *s, int hashSz ); | |
| 42 void nullOutTablesArray( HashTable *table ); | |
| 43 void *getEntryFromTable( char *key, HashTable *table ); | |
| 44 void doubleTableSize( HashTable *table ); | |
| 45 void addEntryToTable( HashEntry *entry, HashTable *table ); | |
| 46 | |
| 47 //=========================================================================== | |
| 48 // Public functions | |
| 49 HashTable *makeHashTable( int numHashSlots, FreeEntryContentFnPtr freeFn ); | |
| 50 | |
| 51 void *getValueFromTable( char *key, HashTable *table ); | |
| 52 bool8 deleteEntryFromTable( char *key, HashTable *table ); | |
| 53 bool8 deleteEntrysValueInTable( char *key, HashTable *table ); | |
| 54 | |
| 55 int addToTable( char* key, void *content, HashTable *table ); | |
| 56 void freeTable( HashTable *table ); | |
| 57 //char *paramBagToString( ParamBag * bag ) | |
| 58 | |
| 59 #endif /* _PRIVATE_HASH_H */ | |
| 60 |
