Change "this" to be void pointer so as to avoid spurious struct names
[rrq/rrqmisc.git] / vector / integeritem.c
1 #include <integeritem.h>
2
3 /**
4  * This callback function returns the hashcode of a key. The hashcode
5  * is used for indexing into the backing vector for finding the an
6  * item via its key. The same key must map consistently to the same
7  * hashcode while the hashtable contains an item with that key.
8  * Different keys map map to the same hashcode, in which case the
9  * vector placement is made at the first empty or hole slot following
10  * the hashcode index.
11  */
12 static unsigned long integeritem_hashcode(void *this,void *key) {
13     return (unsigned long) key;
14 }
15
16 /**
17  * This callback function determines whether an item has a
18  * given key or not.
19  */
20 static int integeritem_haskey(void *this,void *item,void *key) {
21     return item == key;
22 }
23
24 /**
25  * This callback function returns the key of an item by considering
26  * the arity and schema.
27  */
28 static void *integeritem_itemkey(void *this,void *item) {
29     return item;
30 }
31
32 /**
33  * This callback function handles a key obtained from the itemkey
34  * callback function to reclaim temporary allocation.
35  */
36 static void integeritem_releasekey(void *this,void *key) {
37 }
38
39 itemkeyfun integeritem = {
40     .hashcode = integeritem_hashcode,
41     .haskey = integeritem_haskey,
42     .itemkey = integeritem_itemkey,
43     .releasekey = integeritem_releasekey
44 };