]> git.sur5r.net Git - openldap/commitdiff
BDB 4.2 compatibility for log_printf (requires modern C preprocessor)
authorHoward Chu <hyc@openldap.org>
Thu, 6 Dec 2007 01:51:32 +0000 (01:51 +0000)
committerHoward Chu <hyc@openldap.org>
Thu, 6 Dec 2007 01:51:32 +0000 (01:51 +0000)
servers/slapd/back-bdb/back-bdb.h
servers/slapd/back-bdb/cache.c
servers/slapd/back-bdb/delete.c

index 9b9020b1d3a77af1ce917c4914bbe4648c447b5e..6e49d132a20ac0bbfece965a15c5a4ca36e279b1 100644 (file)
@@ -312,6 +312,15 @@ struct bdb_op_info {
 #define TXN_ID(txn)    (txn)->locker
 #endif
 
+/* env->log_printf appeared in 4.4 */
+#if DB_VERSION_FULL >= 0x04040000
+#define        LOG_PRINTF(env,txn,fmt,...)     (env)->log_printf((env),(txn),(fmt),__VA_ARGS__)
+#else
+extern int __db_logmsg(const DB_ENV *env, DB_TXN *txn, const char *op, u_int32_t flags,
+       const char *fmt,...);
+#define        LOG_PRINTF(env,txn,fmt,...)     __db_logmsg((env),(txn),"DIAGNOSTIC",0,(fmt),__VA_ARGS__)
+#endif
+
 #endif
 
 #ifndef DB_BUFFER_SMALL
index 58794b89a2fe770dba53828f304070673c39074b..93be806635a00b9cbe4341897c8bfad572db7ff0 100644 (file)
@@ -438,7 +438,7 @@ bdb_cache_find_ndn(
                        bdb_cache_entryinfo_unlock( eip );
 
 #if defined(LDAP_DEBUG) && defined(LDAP_DEVEL)
-                       bdb->bi_dbenv->log_printf( bdb->bi_dbenv, NULL, "slapd Reading %s",
+                       LOG_PRINTF( bdb->bi_dbenv, NULL, "slapd Reading %s",
                                ei.bei_nrdn.bv_val );
 #endif
 
@@ -450,7 +450,7 @@ bdb_cache_find_ndn(
                        }
 
 #if defined(LDAP_DEBUG) && defined(LDAP_DEVEL)
-                       bdb->bi_dbenv->log_printf( bdb->bi_dbenv, NULL, "slapd Read got %s(%d)",
+                       LOG_PRINTF( bdb->bi_dbenv, NULL, "slapd Read got %s(%d)",
                                ei.bei_nrdn.bv_val, ei.bei_id );
 #endif
 
index 8233f7ee6b19dbc7d900b1ff4d637c3dc63b7d54..b419c1cb074607fd7583045c9962a1a1c1f4ba06 100644 (file)
@@ -373,7 +373,7 @@ retry:      /* transaction retry */
        }
 
 #if defined(LDAP_DEBUG) && defined(LDAP_DEVEL)
-       bdb->bi_dbenv->log_printf( bdb->bi_dbenv, lt2, "slapd Starting delete %s(%d)",
+       LOG_PRINTF( bdb->bi_dbenv, lt2, "slapd Starting delete %s(%d)",
                e->e_nname.bv_val, e->e_id );
 #endif
 
@@ -498,7 +498,7 @@ retry:      /* transaction retry */
        }
 
 #if defined(LDAP_DEBUG) && defined(LDAP_DEVEL)
-       bdb->bi_dbenv->log_printf( bdb->bi_dbenv, lt2, "slapd Commit1 delete %s(%d)",
+       LOG_PRINTF( bdb->bi_dbenv, lt2, "slapd Commit1 delete %s(%d)",
                e->e_nname.bv_val, e->e_id );
 #endif
 
@@ -529,7 +529,7 @@ retry:      /* transaction retry */
        } else {
 
 #if defined(LDAP_DEBUG) && defined(LDAP_DEVEL)
-               bdb->bi_dbenv->log_printf( bdb->bi_dbenv, ltid, "slapd Cache delete %s(%d)",
+               LOG_PRINTF( bdb->bi_dbenv, ltid, "slapd Cache delete %s(%d)",
                        e->e_nname.bv_val, e->e_id );
 #endif
 
@@ -546,7 +546,7 @@ retry:      /* transaction retry */
        op->o_private = NULL;
 
 #if defined(LDAP_DEBUG) && defined(LDAP_DEVEL)
-       bdb->bi_dbenv->log_printf( bdb->bi_dbenv, NULL, "slapd Committed delete %s(%d)",
+       LOG_PRINTF( bdb->bi_dbenv, NULL, "slapd Committed delete %s(%d)",
                e->e_nname.bv_val, e->e_id );
 #endif