There was little point in returning EINVAL when not: Comparing (A,B)
and (B,A) would claim (A > B && B > A), which could confuse callers.
/** @brief Compare two data items according to a particular database.
*
* This returns a comparison as if the two items were data items of
- * a sorted duplicates #MDB_DUPSORT database.
+ * the specified database. The database must have the #MDB_DUPSORT flag.
* @param[in] txn A transaction handle returned by #mdb_txn_begin()
* @param[in] dbi A database handle returned by #mdb_dbi_open()
* @param[in] a The first item to compare
int
mdb_dcmp(MDB_txn *txn, MDB_dbi dbi, const MDB_val *a, const MDB_val *b)
{
- if (txn->mt_dbxs[dbi].md_dcmp)
- return txn->mt_dbxs[dbi].md_dcmp(a, b);
- else
- return EINVAL; /* too bad you can't distinguish this from a valid result */
+ return txn->mt_dbxs[dbi].md_dcmp(a, b);
}
/** Allocate a single page.