mirror of
https://git.openldap.org/openldap/openldap.git
synced 2026-01-01 12:39:35 -05:00
Factor out MDB_SIZE_MAX, MDB_FMT_Y, MDB_FMT_Z
This commit is contained in:
parent
84610e65da
commit
32764bcb52
6 changed files with 28 additions and 60 deletions
|
|
@ -179,13 +179,32 @@ typedef int mdb_mode_t;
|
|||
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.
|
||||
|
|
|
|||
|
|
@ -355,12 +355,10 @@ typedef HANDLE mdb_mutex_t, mdb_mutexref_t;
|
|||
#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
|
||||
|
|
@ -458,15 +456,8 @@ typedef pthread_mutex_t mdb_mutex_t[1], *mdb_mutexref_t;
|
|||
#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
|
||||
|
|
|
|||
|
|
@ -20,20 +20,7 @@
|
|||
#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;
|
||||
|
|
|
|||
|
|
@ -38,20 +38,8 @@ static MDB_envinfo info;
|
|||
|
||||
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)
|
||||
|
||||
|
|
|
|||
|
|
@ -17,20 +17,8 @@
|
|||
#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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -26,8 +26,7 @@
|
|||
#ifndef _MDB_MIDL_H_
|
||||
#define _MDB_MIDL_H_
|
||||
|
||||
#include <stddef.h>
|
||||
#include <inttypes.h>
|
||||
#include "lmdb.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
|
@ -43,11 +42,7 @@ 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
|
||||
|
|
|
|||
Loading…
Reference in a new issue