rpm  5.2.1
rpmhash.h
Go to the documentation of this file.
1 #ifndef H_RPMHASH
2 #define H_RPMHASH
3 
9 #include <rpmiotypes.h>
10 
13 typedef /*@abstract@*/ /*@refcounted@*/ struct hashTable_s * hashTable;
14 
15 #ifdef __cplusplus
16 extern "C" {
17 #endif
18 
25 typedef int (*hashEqualityType) (const void * key1, const void * key2)
26  /*@*/;
27 
34 int hashEqualityString(const void * key1, const void * key2)
35  /*@*/;
36 
44 typedef rpmuint32_t (*hashFunctionType) (rpmuint32_t h, const void * data,
45  size_t size)
46  /*@*/;
47 
55 rpmuint32_t hashFunctionString(rpmuint32_t h, const void * data, size_t size)
56  /*@*/;
57 
64 void htAddEntry(hashTable ht, /*@owned@*/ const void * key,
65  /*@owned@*/ const void * data)
66  /*@modifies ht */;
67 
77 int htGetEntry(hashTable ht, const void * key,
78  /*@null@*/ /*@out@*/ const void * data,
79  /*@null@*/ /*@out@*/ int * dataCount,
80  /*@null@*/ /*@out@*/ const void * tableKey)
81  /*@modifies *data, *dataCount, *tableKey @*/;
82 
88 const void ** htGetKeys(hashTable ht)
89  /*@*/;
90 
97 /*@unused@*/
98 int htHasEntry(hashTable ht, const void * key)
99  /*@*/;
100 
106 /*@unused@*/ /*@null@*/
107 hashTable htUnlink (/*@killref@*/ /*@null@*/ hashTable ht)
108  /*@modifies ht @*/;
109 #define htUnlink(_ht) \
110  ((hashTable)rpmioUnlinkPoolItem((rpmioItem)(_ht), __FUNCTION__, __FILE__, __LINE__))
111 
117 /*@unused@*/ /*@newref@*/ /*@null@*/
118 hashTable htLink (/*@null@*/ hashTable ht)
119  /*@modifies ht @*/;
120 #define htLink(_ht) \
121  ((hashTable)rpmioLinkPoolItem((rpmioItem)(_ht), __FUNCTION__, __FILE__, __LINE__))
122 
128 /*@null@*/
129 hashTable htFree( /*@only@*/ hashTable ht)
130  /*@modifies ht @*/;
131 #define htFree(_ht) \
132  ((hashTable)rpmioFreePoolItem((rpmioItem)(_ht), __FUNCTION__, __FILE__, __LINE__))
133 
145 /*@newref@*/ /*@null@*/
146 hashTable htCreate(int numBuckets, size_t keySize, int freeData,
147  /*@null@*/ hashFunctionType fn, /*@null@*/ hashEqualityType eq)
148  /*@globals fileSystem @*/
149  /*@modifies fileSystem @*/;
150 
151 #ifdef __cplusplus
152 }
153 #endif
154 
155 #endif