+static void check_block (ISAMB b, struct ISAMB_block *p)
+{
+ if (p->leaf)
+ {
+ ;
+ }
+ else
+ {
+ /* sanity check */
+ char *startp = p->bytes;
+ char *src = startp;
+ char *endp = p->bytes + p->size;
+ int pos;
+
+ decode_ptr (&src, &pos);
+ assert ((pos&3) == p->cat);
+ while (src != endp)
+ {
+ int item_len;
+ decode_ptr (&src, &item_len);
+ assert (item_len > 0 && item_len < 30);
+ src += item_len;
+ decode_ptr (&src, &pos);
+ assert ((pos&3) == p->cat);
+ }
+ }
+}
+