Mercurial > cgi-bin > hgwebdir.cgi > VMS > C_Libraries > Hash_impl
view PrivateHash.h @ 4:1ee100564408
Changed malloc and free to VMS__malloc and VMS__free
| author | Me |
|---|---|
| date | Sun, 31 Oct 2010 20:25:30 -0700 |
| parents | ee3ad252427e |
| children | 7c4d2bf121a9 |
line source
1 /*
2 * Copyright 2009 OpenSourceStewardshipFoundation.org
3 * Licensed under GNU General Public License version 2
4 *
5 * Author: seanhalle@yahoo.com
6 */
8 #ifndef _PRIVATE_HASH_H
9 #define _PRIVATE_HASH_H
11 #include "../VMS_primitive_data_types.h"
13 #define TRUE 1
14 #define FALSE 0
17 #define DEFAULT_HASHSIZE 1 << 10
19 typedef struct _HashEntry HashEntry;
21 struct _HashEntry
22 {
23 char *key;
24 void *content;
25 HashEntry *next;
26 };
28 typedef void (*FreeEntryContentFnPtr) ( void * );
30 typedef struct
31 { int tableSz;
32 int numEntries;
33 HashEntry* *entries;
34 FreeEntryContentFnPtr freeEntryContentFn;
35 }
36 HashTable;
39 //===========================================================================
40 // Public functions
41 HashTable *makeHashTable( int numHashSlots, FreeEntryContentFnPtr freeFn );
43 int putEntryIntoTable( HashEntry *entry, HashTable *table);
44 int addValueIntoTable( char* key, void *value, HashTable *table);
45 HashEntry *getEntryFromTable( char *key, HashTable *table );
46 void *getValueFromTable( char *key, HashTable *table );
48 bool8 deleteEntryFromTable( char *key, HashTable *table );
49 bool8 deleteThisEntryFromTable( HashEntry *entry, HashTable *table );
50 bool8 deleteEntrysValueInTable( char *key, HashTable *table );
51 bool8 deleteEntryFromTableAndFreeValue( char *key, HashTable *table );
52 void freeHashTable( HashTable *table );
53 //char *paramBagToString( ParamBag * bag )
55 //===========================================================================
56 // Internal functions
57 void freeHashEntryUsing( HashEntry *entry, HashTable *table );
58 unsigned int hashThisKey( char *s, int hashSz );
59 void nullOutTablesArray( HashTable *table );
60 void doubleTableSize( HashTable *table );
61 void freeHashEntryButNotContent( HashEntry *entry );
63 #endif /* _PRIVATE_HASH_H */
