|
From: Nicholas N. <nj...@ca...> - 2004-06-29 10:02:20
|
Hi,
vg_skiplist.c line 288:
Int size = sizeof(SkipNode) * sizeof(SkipNode *) * SK_MAXHEIGHT;
Surely that should be:
Int size = sizeof(SkipNode) + sizeof(SkipNode *) * SK_MAXHEIGHT;
?
---
While I'm looking at vg_skiplist.c... a SkipNode looks like:
struct _SkipNode {
UInt magic;
UShort level;
SkipNode *next[0];
};
There's no space for the key and value. AFAICT, they're stored before the
start of the _SkipNode struct, and the 'size' and 'keyoffset' elements of
struct _SkipList lets the code find them. The allocation points are
careful to provide this extra space, and there are functions that find the
key and value from a node. Except the head node doesn't seem to have a
key/value pair. Jeremy, is that all true? Wow, pretty nasty. It would
be nice to have a comment explaining this.
N
|