#include <fcntl.h>
#endif
-#include <assert.h>
#include <errno.h>
#include <limits.h>
#include <stddef.h>
mdb_page_dirty(MDB_txn *txn, MDB_page *mp)
{
MDB_ID2 mid;
- int (*insert)(MDB_ID2L, MDB_ID2 *);
+ int rc, (*insert)(MDB_ID2L, MDB_ID2 *);
if (txn->mt_env->me_flags & MDB_WRITEMAP) {
insert = mdb_mid2l_append;
}
mid.mid = mp->mp_pgno;
mid.mptr = mp;
- insert(txn->mt_u.dirty_list, &mid);
+ rc = insert(txn->mt_u.dirty_list, &mid);
+ mdb_tassert(txn, rc == 0);
txn->mt_dirty_room--;
}
return ENOMEM;
mid.mid = pgno;
mid.mptr = np;
- mdb_mid2l_insert(dl, &mid);
+ rc = mdb_mid2l_insert(dl, &mid);
+ mdb_cassert(mc, rc == 0);
} else {
return 0;
}
MDB_node *leaf = NULL;
DKBUF;
- assert(mc);
- mdb_cassert(mc, key);
if (key->mv_size == 0)
return MDB_BAD_VALSIZE;
unsigned int flags)
{
enum { MDB_NO_ROOT = MDB_LAST_ERRCODE+10 }; /* internal code */
- MDB_env *env = mc->mc_txn->mt_env;
+ MDB_env *env;
MDB_node *leaf = NULL;
MDB_page *fp, *mp;
uint16_t fp_flags;
unsigned int nflags;
DKBUF;
+ if (mc == NULL || key == NULL)
+ return EINVAL;
+
+ env = mc->mc_txn->mt_env;
+
/* Check this first so counter will always be zero on any
* early failures.
*/
return ENOMEM;
id2.mid = pg;
id2.mptr = np;
- mdb_mid2l_insert(mc->mc_txn->mt_u.dirty_list, &id2);
+ rc = mdb_mid2l_insert(mc->mc_txn->mt_u.dirty_list, &id2);
+ mdb_cassert(mc, rc == 0);
if (!(flags & MDB_RESERVE)) {
/* Copy end of page, adjusting alignment so
* compiler may copy words instead of bytes.
MDB_dbi
mdb_cursor_dbi(MDB_cursor *mc)
{
- assert(mc != NULL);
return mc->mc_dbi;
}