libmdb: Simplify mdb_default_cmp. No real change.

vmware
Hallvard Furuseth 13 years ago
parent 729a8a2819
commit dce5bb2fee
  1. 30
      libraries/libmdb/mdb.c

@ -6117,27 +6117,17 @@ mdb_env_stat(MDB_env *env, MDB_stat *arg)
static void static void
mdb_default_cmp(MDB_txn *txn, MDB_dbi dbi) mdb_default_cmp(MDB_txn *txn, MDB_dbi dbi)
{ {
if (txn->mt_dbs[dbi].md_flags & MDB_REVERSEKEY) uint16_t f = txn->mt_dbs[dbi].md_flags;
txn->mt_dbxs[dbi].md_cmp = mdb_cmp_memnr;
else if (txn->mt_dbs[dbi].md_flags & MDB_INTEGERKEY)
txn->mt_dbxs[dbi].md_cmp = mdb_cmp_cint;
else
txn->mt_dbxs[dbi].md_cmp = mdb_cmp_memn;
if (txn->mt_dbs[dbi].md_flags & MDB_DUPSORT) { txn->mt_dbxs[dbi].md_cmp =
if (txn->mt_dbs[dbi].md_flags & MDB_INTEGERDUP) { (f & MDB_REVERSEKEY) ? mdb_cmp_memnr :
if (txn->mt_dbs[dbi].md_flags & MDB_DUPFIXED) (f & MDB_INTEGERKEY) ? mdb_cmp_cint : mdb_cmp_memn;
txn->mt_dbxs[dbi].md_dcmp = mdb_cmp_int;
else txn->mt_dbxs[dbi].md_dcmp =
txn->mt_dbxs[dbi].md_dcmp = mdb_cmp_cint; !(f & MDB_DUPSORT) ? 0 :
} else if (txn->mt_dbs[dbi].md_flags & MDB_REVERSEDUP) { ((f & MDB_INTEGERDUP)
txn->mt_dbxs[dbi].md_dcmp = mdb_cmp_memnr; ? ((f & MDB_DUPFIXED) ? mdb_cmp_int : mdb_cmp_cint)
} else { : ((f & MDB_REVERSEDUP) ? mdb_cmp_memnr : mdb_cmp_memn));
txn->mt_dbxs[dbi].md_dcmp = mdb_cmp_memn;
}
} else {
txn->mt_dbxs[dbi].md_dcmp = NULL;
}
} }
int mdb_open(MDB_txn *txn, const char *name, unsigned int flags, MDB_dbi *dbi) int mdb_open(MDB_txn *txn, const char *name, unsigned int flags, MDB_dbi *dbi)

Loading…
Cancel
Save