I've cleaned up some old tweaks of mine which, er, I still haven't checked properly on non-Linux. Might be easier to start there: Branch "mdb/fopen" in repo git://git.uio.no/u/hbf/openldap.git.
The main point is "[DRAFT] Move opening files out to mdb_fopen()". "Factoring out" the file handling doesn't mean less code, but it does collect all the #ifdef ugliness in one place. Using mdb_fname_init() saves a few mallocs on Windows, and some malloced bytes on Unix.
Howard, do we want that, or did I get too fancy? :-)