projects
/
rrq
/
rrqmisc.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
initial tuple support
[rrq/rrqmisc.git]
/
tests
/
example-hashvector.c
diff --git
a/tests/example-hashvector.c
b/tests/example-hashvector.c
index 7bd57a5f53a3018aa7a101b501553d64db30919b..516cd07393cc8e790e6b872a32453e767e18e7b2 100644
(file)
--- a/
tests/example-hashvector.c
+++ b/
tests/example-hashvector.c
@@
-8,15
+8,15
@@
typedef struct _ipslot {
unsigned int bits;
} ipslot;
unsigned int bits;
} ipslot;
-static unsigned long voidp_hashcode(void *key) {
+static unsigned long voidp_hashcode(
itemkeyfun *this,
void *key) {
return hashvector_hashcode( key, sizeof( ipslot ) );
}
return hashvector_hashcode( key, sizeof( ipslot ) );
}
-static void* voidp_itemkey(void *item) {
+static void* voidp_itemkey(
itemkeyfun *this,
void *item) {
return item;
}
return item;
}
-static int voidp_haskey(void *item,void *key) {
+static int voidp_haskey(
itemkeyfun *this,
void *item,void *key) {
return memcmp( item, key, sizeof( ipslot ) ) == 0;
}
return memcmp( item, key, sizeof( ipslot ) ) == 0;
}
@@
-33,13
+33,16
@@
static int shrink(vector *pv,unsigned long index,void *item,void *data) {
}
int main(int argc,char **argv) {
}
int main(int argc,char **argv) {
+ itemkeyfun voidpfun = {
+ .hashcode = voidp_hashcode,
+ .itemkey = voidp_itemkey,
+ .haskey = voidp_haskey
+ };
hashvector hv = {
.table = { 4, 0 },
.fill = 0,
.holes = 0,
hashvector hv = {
.table = { 4, 0 },
.fill = 0,
.holes = 0,
- .keyhashcode = voidp_hashcode,
- .itemkey = voidp_itemkey,
- .haskey = voidp_haskey
+ .type = &voidpfun
};
int i = 0;
for ( ; i < 259; i++ ) {
};
int i = 0;
for ( ; i < 259; i++ ) {