Skip to content

Commit b6f0179

Browse files
committed
Simpler flag/DBI checks and MDB_DEBUG
1 parent 06df0a4 commit b6f0179

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

libraries/liblmdb/mdb.c

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5082,15 +5082,12 @@ static void
50825082
mdb_cursor_pop(MDB_cursor *mc)
50835083
{
50845084
if (mc->mc_snum) {
5085-
#if MDB_DEBUG
5086-
MDB_page *top = mc->mc_pg[mc->mc_top];
5087-
#endif
5085+
DPRINTF(("popping page %"Z"u off db %d cursor %p",
5086+
mc->mc_pg[mc->mc_top]->mp_pgno, DDBI(mc), (void *) mc));
5087+
50885088
mc->mc_snum--;
50895089
if (mc->mc_snum)
50905090
mc->mc_top--;
5091-
5092-
DPRINTF(("popped page %"Z"u off db %d cursor %p", top->mp_pgno,
5093-
DDBI(mc), (void *) mc));
50945091
}
50955092
}
50965093

@@ -8556,7 +8553,7 @@ mdb_put(MDB_txn *txn, MDB_dbi dbi,
85568553
if (!key || !data || dbi == FREE_DBI || !TXN_DBI_EXIST(txn, dbi))
85578554
return EINVAL;
85588555

8559-
if ((flags & (MDB_NOOVERWRITE|MDB_NODUPDATA|MDB_RESERVE|MDB_APPEND|MDB_APPENDDUP)) != flags)
8556+
if (flags & ~(MDB_NOOVERWRITE|MDB_NODUPDATA|MDB_RESERVE|MDB_APPEND|MDB_APPENDDUP))
85608557
return EINVAL;
85618558

85628559
mdb_cursor_init(&mc, txn, dbi, &mx);
@@ -9126,7 +9123,7 @@ mdb_env_copy(MDB_env *env, const char *path)
91269123
int ESECT
91279124
mdb_env_set_flags(MDB_env *env, unsigned int flag, int onoff)
91289125
{
9129-
if ((flag & CHANGEABLE) != flag)
9126+
if (flag & ~CHANGEABLE)
91309127
return EINVAL;
91319128
if (onoff)
91329129
env->me_flags |= flag;
@@ -9275,7 +9272,7 @@ int mdb_dbi_open(MDB_txn *txn, const char *name, unsigned int flags, MDB_dbi *db
92759272
unsigned int unused = 0, seq;
92769273
size_t len;
92779274

9278-
if ((flags & VALID_FLAGS) != flags)
9275+
if (flags & ~VALID_FLAGS)
92799276
return EINVAL;
92809277
if (txn->mt_flags & MDB_TXN_ERROR)
92819278
return MDB_BAD_TXN;

0 commit comments

Comments
 (0)