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