BDB 4.2 compatibility for log_printf (requires modern C preprocessor)

This commit is contained in:
Howard Chu 2007-12-06 01:51:32 +00:00
parent abff944303
commit c2a02618bb
3 changed files with 15 additions and 6 deletions

View File

@ -312,6 +312,15 @@ struct bdb_op_info {
#define TXN_ID(txn) (txn)->locker #define TXN_ID(txn) (txn)->locker
#endif #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 #endif
#ifndef DB_BUFFER_SMALL #ifndef DB_BUFFER_SMALL

View File

@ -438,7 +438,7 @@ bdb_cache_find_ndn(
bdb_cache_entryinfo_unlock( eip ); bdb_cache_entryinfo_unlock( eip );
#if defined(LDAP_DEBUG) && defined(LDAP_DEVEL) #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 ); ei.bei_nrdn.bv_val );
#endif #endif
@ -450,7 +450,7 @@ bdb_cache_find_ndn(
} }
#if defined(LDAP_DEBUG) && defined(LDAP_DEVEL) #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 ); ei.bei_nrdn.bv_val, ei.bei_id );
#endif #endif

View File

@ -373,7 +373,7 @@ retry: /* transaction retry */
} }
#if defined(LDAP_DEBUG) && defined(LDAP_DEVEL) #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 ); e->e_nname.bv_val, e->e_id );
#endif #endif
@ -498,7 +498,7 @@ retry: /* transaction retry */
} }
#if defined(LDAP_DEBUG) && defined(LDAP_DEVEL) #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 ); e->e_nname.bv_val, e->e_id );
#endif #endif
@ -529,7 +529,7 @@ retry: /* transaction retry */
} else { } else {
#if defined(LDAP_DEBUG) && defined(LDAP_DEVEL) #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 ); e->e_nname.bv_val, e->e_id );
#endif #endif
@ -546,7 +546,7 @@ retry: /* transaction retry */
op->o_private = NULL; op->o_private = NULL;
#if defined(LDAP_DEBUG) && defined(LDAP_DEVEL) #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 ); e->e_nname.bv_val, e->e_id );
#endif #endif