Just a thing I spotted while reading it through quickly: > +static void subtract_helper(size_t *p, size_t amount) > +{ > + if (*p == (size_t) -1) > + return; > + if (*p < amount) > + *p = 0; > + *p -= amount; > +} Maybe you meant: if (*p < amount) *p = 0; else *p -= amount; Otherwise *p might end up being "-amount" instead of "0"? -- David Henningsson, Canonical Ltd. https://launchpad.net/~diwic