mdbx: assert for NODEPTR.

This commit is contained in:
Leo Yuriev 2017-02-21 17:15:04 +03:00
parent febe2e2748
commit daa08e6102

6
mdbx.c
View File

@ -763,7 +763,11 @@ typedef struct MDB_node {
#define LEAFSIZE(k, d) (NODESIZE + (k)->mv_size + (d)->mv_size)
/** Address of node \b i in page \b p */
#define NODEPTR(p, i) ((MDB_node *)((char *)(p) + (p)->mp_ptrs[i] + PAGEBASE))
#define NODEPTR(p, i) \
({ \
assert(NUMKEYS(p) > (unsigned)(i)); \
(MDB_node *)((char *)(p) + (p)->mp_ptrs[i] + PAGEBASE); \
})
/** Address of the key for the node */
#define NODEKEY(node) (void *)((node)->mn_data)