fix: more precise handling was needed for multiple overlapped removed files.
[tools/librpm-tizen.git] / lib / hash.h
1 #ifndef H_HASH
2 #define H_HASH
3
4 typedef struct hashTable_s * hashTable;
5
6 #ifdef __cplusplus
7 extern "C" {
8 #endif
9
10 typedef unsigned int (*hashFunctionType)(const void * string);
11 typedef int (*hashEqualityType)(const void * key1, const void * key2);
12
13 unsigned int hashFunctionString(const void * string);
14 int hashEqualityString(const void * key1, const void * key2);
15
16 /* if keySize > 0, the key is duplicated within the table (which costs
17    memory, but may be usefull anyway */
18 hashTable htCreate(int numBuckets, int keySize, hashFunctionType fn,
19                    hashEqualityType eq); 
20 void htAddEntry(hashTable ht, const void * key, const void * data);
21 void htFree(hashTable ht);
22 /* returns 0 on success, 1 if the item is not found. tableKey may be NULL */
23 int htGetEntry(hashTable ht, const void * key, const void *** data, int * dataCount,
24                const void ** tableKey);
25 /* returns 1 if the item is present, 0 otherwise */
26 int htHasEntry(hashTable ht, const void * key);
27
28 #ifdef __cplusplus
29 }
30 #endif
31
32 #endif