typedef mode_t mdb_mode_t;
#endif
+#ifdef _WIN32
+# define MDB_FMT_Z "I"
+#else
+# define MDB_FMT_Z "z" /**< printf/scanf format modifier for size_t */
+#endif
+
#ifdef MDB_VL32
typedef uint64_t mdb_size_t;
+#define MDB_SIZE_MAX UINT64_MAX
+#ifdef _WIN32
+# define MDB_FMT_Y "I64"
+#else
+# define MDB_FMT_Y "ll"
+#endif
#define mdb_env_create mdb_env_create_vl32 /**< Prevent mixing with non-VL32 builds */
#else
typedef size_t mdb_size_t;
+# define MDB_SIZE_MAX SIZE_MAX /**< max #mdb_size_t */
+# define MDB_FMT_Y MDB_FMT_Z /**< Obsolescent, see #MDB_PRIz()/#MDB_SCNz() */
#endif
+/** #mdb_size_t printf formats, \b t = one of [diouxX] without quotes */
+#define MDB_PRIz(t) MDB_FMT_Y #t
+/** #mdb_size_t scanf formats, \b t = one of [dioux] without quotes */
+#define MDB_SCNz(t) MDB_FMT_Y #t
+
/** An abstraction for a file handle.
* On POSIX systems file handles are small integers. On Windows
* they're opaque pointers.
#else
#define MDB_PROCESS_QUERY_LIMITED_INFORMATION 0x1000
#endif
-#define Z "I"
#else
#define THREAD_RET void *
#define THREAD_CREATE(thr,start,arg) pthread_create(&thr,NULL,start,arg)
#define THREAD_FINISH(thr) pthread_join(thr,NULL)
-#define Z "z" /**< printf format modifier for size_t */
/** For MDB_LOCK_FORMAT: True if readers take a pid lock in the lockfile */
#define MDB_PIDLOCK 1
#define GET_PAGESIZE(x) ((x) = sysconf(_SC_PAGE_SIZE))
#endif
-#ifdef MDB_VL32
-#ifdef _WIN32
-#define Y "I64"
-#else
-#define Y "ll"
-#endif
-#else
-#define Y Z
-#endif
+#define Z MDB_FMT_Z /**< printf/scanf format modifier for size_t */
+#define Y MDB_FMT_Y /**< printf/scanf format modifier for #mdb_size_t */
#if defined(_WIN32) || defined(MDB_USE_POSIX_SEM)
#define MNAME_LEN 32
#include <signal.h>
#include "lmdb.h"
-#ifdef _WIN32
-#define Z "I"
-#else
-#define Z "z"
-#endif
-#ifdef MDB_VL32
-#ifdef _WIN32
-#define Y "I64"
-#else
-#define Y "ll"
-#endif
-#else
-#define Y Z
-#endif
+#define Y MDB_FMT_Y
#define PRINT 1
static int mode;
static MDB_val kbuf, dbuf;
-#ifdef _WIN32
-#define Z "I"
-#else
-#define Z "z"
-#endif
-#ifdef MDB_VL32
-#ifdef _WIN32
-#define Y "I64"
-#else
-#define Y "ll"
-#endif
-#else
-#define Y Z
-#endif
+#define Z MDB_FMT_Z
+#define Y MDB_FMT_Y
#define STRLENOF(s) (sizeof(s)-1)
#include <unistd.h>
#include "lmdb.h"
-#ifdef _WIN32
-#define Z "I"
-#else
-#define Z "z"
-#endif
-#ifdef MDB_VL32
-#ifdef _WIN32
-#define Y "I64"
-#else
-#define Y "ll"
-#endif
-#else
-#define Y Z
-#endif
+#define Z MDB_FMT_Z
+#define Y MDB_FMT_Y
static void prstat(MDB_stat *ms)
{
#ifndef _MDB_MIDL_H_
#define _MDB_MIDL_H_
-#include <stddef.h>
-#include <inttypes.h>
+#include "lmdb.h"
#ifdef __cplusplus
extern "C" {
/** A generic unsigned ID number. These were entryIDs in back-bdb.
* Preferably it should have the same size as a pointer.
*/
-#ifdef MDB_VL32
-typedef uint64_t MDB_ID;
-#else
-typedef size_t MDB_ID;
-#endif
+typedef mdb_size_t MDB_ID;
/** An IDL is an ID List, a sorted array of IDs. The first
* element of the array is a counter for how many actual