From: Hallvard Furuseth Date: Fri, 30 May 2014 08:47:56 +0000 (+0200) Subject: Factor out mdb_cmp_clong() X-Git-Tag: accepted/tizen/5.0/unified/20181102.030725~416 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=cb5656c726551cc22ea149ab177fb5a2db4ac6c6;p=platform%2Fupstream%2Flmdb.git Factor out mdb_cmp_clong() --- diff --git a/libraries/liblmdb/mdb.c b/libraries/liblmdb/mdb.c index 94c7ffc..33928b1 100644 --- a/libraries/liblmdb/mdb.c +++ b/libraries/liblmdb/mdb.c @@ -4544,6 +4544,13 @@ mdb_cmp_cint(const MDB_val *a, const MDB_val *b) #endif } +/** Compare two items pointing at size_t's of unknown alignment. */ +#ifdef MISALIGNED_OK +# define mdb_cmp_clong mdb_cmp_long +#else +# define mdb_cmp_clong mdb_cmp_cint +#endif + /** Compare two items lexically */ static int mdb_cmp_memn(const MDB_val *a, const MDB_val *b) @@ -5967,11 +5974,7 @@ more: #if UINT_MAX < SIZE_MAX if (mc->mc_dbx->md_dcmp == mdb_cmp_int && olddata.mv_size == sizeof(size_t)) -#ifdef MISALIGNED_OK - mc->mc_dbx->md_dcmp = mdb_cmp_long; -#else - mc->mc_dbx->md_dcmp = mdb_cmp_cint; -#endif + mc->mc_dbx->md_dcmp = mdb_cmp_clong; #endif /* if data matches, skip it */ if (!mc->mc_dbx->md_dcmp(data, &olddata)) { @@ -6775,11 +6778,7 @@ mdb_xcursor_init1(MDB_cursor *mc, MDB_node *node) mx->mx_dbflag = DB_VALID|DB_DIRTY; /* DB_DIRTY guides mdb_cursor_touch */ #if UINT_MAX < SIZE_MAX if (mx->mx_dbx.md_cmp == mdb_cmp_int && mx->mx_db.md_pad == sizeof(size_t)) -#ifdef MISALIGNED_OK - mx->mx_dbx.md_cmp = mdb_cmp_long; -#else - mx->mx_dbx.md_cmp = mdb_cmp_cint; -#endif + mx->mx_dbx.md_cmp = mdb_cmp_clong; #endif }