X-Git-Url: https://git.distorted.org.uk/~mdw/sgt/agedu/blobdiff_plain/70322ae3751bc07ac749dffad79a5f3420e67b55..cfe942fb3391ae80e816272d7baa45be30e5e7ec:/index.c diff --git a/index.c b/index.c index 53f1000..2d1f840 100644 --- a/index.c +++ b/index.c @@ -139,7 +139,7 @@ static void avl_fix(indexbuild *ib, struct avlnode *n) MAXDEPTH(NODE(ib->t, n->children[1]))); n->totalsize = - (ELEMENT(ib->t, n->element)->blocks + + (ELEMENT(ib->t, n->element)->size + (n->children[0] ? NODE(ib->t, n->children[0])->totalsize : 0) + (n->children[1] ? NODE(ib->t, n->children[1])->totalsize : 0)); } @@ -304,7 +304,7 @@ unsigned long long index_query(const void *t, int n, unsigned long long at) } else { if (left) ret += left->totalsize; - ret += tf->blocks; + ret += tf->size; node = right; } } @@ -334,12 +334,12 @@ unsigned long long index_order_stat(const void *t, double f) if (left && size < left->totalsize) { node = left; } else if (!right || - size < (left ? left->totalsize : 0) + tf->blocks) { + size < (left ? left->totalsize : 0) + tf->size) { return tf->atime; } else { if (left) size -= left->totalsize; - size -= tf->blocks; + size -= tf->size; node = right; } }