From: Howard Chu Date: Sat, 16 Oct 2004 21:59:58 +0000 (+0000) Subject: define DB_VERSION_FULL to simplify version checks X-Git-Tag: OPENLDAP_REL_ENG_2_3_0ALPHA~426 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=84ce5490164a61bc9861b50f3cabca47ec297ede;p=openldap define DB_VERSION_FULL to simplify version checks --- diff --git a/servers/slapd/back-bdb/back-bdb.h b/servers/slapd/back-bdb/back-bdb.h index fc286726ed..a95b084f11 100644 --- a/servers/slapd/back-bdb/back-bdb.h +++ b/servers/slapd/back-bdb/back-bdb.h @@ -23,6 +23,8 @@ LDAP_BEGIN_DECL +#define DB_VERSION_FULL ((DB_VERSION_MAJOR << 24) | (DB_VERSION_MINOR << 16) | DB_VERSION_PATCH) + #define BDB_SUBENTRIES 1 #define DN_BASE_PREFIX SLAP_INDEX_EQUALITY_PREFIX @@ -227,7 +229,7 @@ struct bdb_op_info { #define XLOCK_ID_FREE(env, locker) (env)->lock_id_free(env, locker) /* BDB 4.1.17 adds txn arg to db->open */ -#if DB_VERSION_MINOR > 1 || DB_VERSION_PATCH >= 17 +#if DB_VERSION_FULL >= 0x04010011 #undef DB_OPEN #define DB_OPEN(db, file, name, type, flags, mode) \ (db)->open(db, NULL, file, name, type, (flags)|DB_AUTO_COMMIT, mode) diff --git a/servers/slapd/back-bdb/idl.c b/servers/slapd/back-bdb/idl.c index b005d90d51..1e1453822d 100644 --- a/servers/slapd/back-bdb/idl.c +++ b/servers/slapd/back-bdb/idl.c @@ -438,7 +438,7 @@ bdb_idl_fetch_key( * * configure now requires Berkeley DB 4.1. */ -#if (DB_VERSION_MAJOR == 4) && (DB_VERSION_MINOR == 0) +#if DB_VERSION_FULL < 0x04010000 # define BDB_ENOUGH 5 #else # define BDB_ENOUGH 1 diff --git a/servers/slapd/back-bdb/init.c b/servers/slapd/back-bdb/init.c index 5d2552532d..cc3118f603 100644 --- a/servers/slapd/back-bdb/init.c +++ b/servers/slapd/back-bdb/init.c @@ -580,7 +580,7 @@ bdb_initialize( bi->bi_controls = controls; { /* version check */ - int major, minor, patch; + int major, minor, patch, ver; char *version = db_version( &major, &minor, &patch ); #ifdef HAVE_EBCDIC char v2[1024]; @@ -594,9 +594,8 @@ bdb_initialize( version = v2; #endif - if( major != DB_VERSION_MAJOR || - minor != DB_VERSION_MINOR || - patch < DB_VERSION_PATCH ) + ver = (major << 24) | (minor << 16) | patch; + if( ver < DB_VERSION_FULL ) { Debug( LDAP_DEBUG_ANY, "bdb_initialize: BDB library version mismatch:"