]> git.sur5r.net Git - openldap/commitdiff
define DB_VERSION_FULL to simplify version checks
authorHoward Chu <hyc@openldap.org>
Sat, 16 Oct 2004 21:59:58 +0000 (21:59 +0000)
committerHoward Chu <hyc@openldap.org>
Sat, 16 Oct 2004 21:59:58 +0000 (21:59 +0000)
servers/slapd/back-bdb/back-bdb.h
servers/slapd/back-bdb/idl.c
servers/slapd/back-bdb/init.c

index fc286726edf922004790df1d53c23f802f370da7..a95b084f11d76cb724c1e0924365d01fccb2d77a 100644 (file)
@@ -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)
index b005d90d518bae005fa81c480da2692f229baa66..1e1453822d155ccd76540d20fcdae4c23c24ec00 100644 (file)
@@ -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
index 5d2552532d2fa14460548bd854a6c719a1e353f1..cc3118f6030d7544b9856e854db0486677b067f2 100644 (file)
@@ -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:"