From 3ddf123912df66325d10aaa27958c9c2d5d7c5f0 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Sun, 22 Apr 2007 16:44:42 +0200 Subject: [PATCH] support DB 3.0 --- common/db.h | 12 ++++++++++++ common/exf.c | 4 ++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/common/db.h b/common/db.h index 2d3fd044..d405ffeb 100644 --- a/common/db.h +++ b/common/db.h @@ -1,5 +1,17 @@ #include +#if DB_VERSION_MAJOR >= 3 && DB_VERSION_MINOR >= 1 +#define db_env_open(env,path,flags,mode) \ + (env)->open(env, path, flags, mode) +#define db_env_remove(env,path,flags) \ + (env)->remove(env, path, flags) +#else +#define db_env_open(env,path,flags,mode) \ + (env)->open(env, path, NULL, flags, mode) +#define db_env_remove(env,path,flags) \ + (env)->remove(env, path, NULL, flags) +#endif + #if DB_VERSION_MAJOR >= 4 && DB_VERSION_MINOR >= 1 #define db_open(db,file,type,flags,mode) \ (db)->open(db, NULL, file, NULL, type, flags, mode) diff --git a/common/exf.c b/common/exf.c index 3d1a30eb..1b7e6359 100644 --- a/common/exf.c +++ b/common/exf.c @@ -776,7 +776,7 @@ file_end(SCR *sp, EXF *ep, int force) ep->env = 0; if ((sp->db_error = db_env_create(&env, 0))) msgq(sp, M_DBERR, "env_create"); - if ((sp->db_error = env->remove(env, ep->env_path, 0))) + if ((sp->db_error = db_env_remove(env, ep->env_path, 0))) msgq(sp, M_DBERR, "env->remove"); if (ep->env_path != NULL && rmdir(ep->env_path)) msgq_str(sp, M_SYSERR, ep->env_path, "242|%s: remove"); @@ -1623,7 +1623,7 @@ db_setup(SCR *sp, EXF *ep) goto err; } #endif - if ((sp->db_error = env->open(env, path, + if ((sp->db_error = db_env_open(env, path, DB_PRIVATE | DB_CREATE | DB_INIT_MPOOL | VI_DB_THREAD | VI_DB_INIT_LOG, 0)) != 0) { msgq(sp, M_DBERR, "env->open"); -- 2.11.4.GIT