[cvs] bogofilter/src datastore_db.c,1.191,1.192 datastore_db_trad.c,1.8,1.9 datastore_txn_dummies.c,
Fast Bayesian spam filter along lines suggested by Paul Graham
Brought to you by:
m-a
From: David R. <re...@us...> - 2005-03-24 04:49:28
|
Update of /cvsroot/bogofilter/bogofilter/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5748 Modified Files: datastore_db.c datastore_db_trad.c datastore_txn_dummies.c Log Message: Remove unneeded dummy functions. Index: datastore_db_trad.c =================================================================== RCS file: /cvsroot/bogofilter/bogofilter/src/datastore_db_trad.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- datastore_db_trad.c 24 Mar 2005 01:26:52 -0000 1.8 +++ datastore_db_trad.c 24 Mar 2005 04:49:17 -0000 1.9 @@ -34,18 +34,13 @@ #include "xstrdup.h" /* public -- used in datastore.c */ -static int bft_begin (void *vhandle); -static int bft_abort (void *vhandle); -static int bft_commit (void *vhandle); + /* private -- used in datastore_db_*.c */ static DB_ENV *bft_get_env_dbe (dbe_t *env); static const char *bft_database_name (const char *db_file); static DB_ENV *bft_recover_open (bfdir *directory, bffile *db_file); -static int bft_auto_commit_flags(void); static int bft_get_rmw_flag (int open_mode); static int bft_lock (void *handle, int open_mode); -static ex_t bft_common_close (DB_ENV *dbe, bfdir *directory); -static int bft_sync (DB_ENV *dbe, int ret); static void bft_log_flush (DB_ENV *dbe); static dbe_t *bft_init (bfdir *directory); static void bft_cleanup (dbe_t *env); @@ -55,9 +50,9 @@ dsm_t dsm_traditional = { /* public -- used in datastore.c */ - &bft_begin, - &bft_abort, - &bft_commit, + NULL, /* bft_begin */ + NULL, /* bft_abort */ + NULL, /* bft_commit */ /* private -- used in datastore_db_*.c */ &bft_init, @@ -66,11 +61,11 @@ &bft_get_env_dbe, &bft_database_name, &bft_recover_open, - &bft_auto_commit_flags, + NULL, /* bft_auto_commit_flags*/ &bft_get_rmw_flag, &bft_lock, - &bft_common_close, - &bft_sync, + NULL, /* &bft_common_close */ + NULL, /* &bft_sync */ &bft_log_flush, NULL, /* dsm_pagesize */ NULL, /* dsm_checkpoint */ @@ -91,25 +86,6 @@ return db_file; } -int bft_auto_commit_flags(void) -{ - return 0; -} - -ex_t bft_common_close(DB_ENV *dbe, bfdir *directory) -{ - (void) dbe; - (void) directory; - return EX_OK; -} - -int bft_sync(DB_ENV *dbe, int ret) -{ - (void) dbe; - (void) ret; - return 0; -} - int bft_lock(void *vhandle, int open_mode) { int e = 0; @@ -174,10 +150,6 @@ db_strerror(ret)); } -int bft_begin (void *vhandle) { (void) vhandle; return 0; } -int bft_abort (void *vhandle) { (void) vhandle; return 0; } -int bft_commit (void *vhandle) { (void) vhandle; return 0; } - dbe_t *bft_init(bfdir *directory) { dbe_t *env = xcalloc(1, sizeof(dbe_t)); Index: datastore_txn_dummies.c =================================================================== RCS file: /cvsroot/bogofilter/bogofilter/src/datastore_txn_dummies.c,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- datastore_txn_dummies.c 24 Mar 2005 01:11:30 -0000 1.14 +++ datastore_txn_dummies.c 24 Mar 2005 04:49:17 -0000 1.15 @@ -37,9 +37,10 @@ dsm_t dsm_transactional = { /* public -- used in datastore.c */ - NULL, /* dsm_begin */ - NULL, /* dsm_abort */ - NULL, /* dsm_commit */ + NULL, /* dsm_begin */ + NULL, /* dsm_abort */ + NULL, /* dsm_commit */ + /* private -- used in datastore_db_*.c */ NULL, /* dsm_env_init */ NULL, /* dsm_cleanup */ @@ -61,30 +62,14 @@ NULL /* dsm_verify */ }; -#ifndef ENABLE_SQLITE_DATASTORE - -#if !defined(DISABLE_TRANSACTIONS) && !defined(ENABLE_TRANSACTIONS) +#ifndef DISABLE_TRANSACTIONS +#ifndef ENABLE_TRANSACTIONS void *dbe_init(bfdir *d, bffile *f) { (void)d; (void)f; return (void *)~0; } #endif - -int db_txn_begin(void *vhandle) { (void)vhandle; return 0; } -int db_txn_abort(void *vhandle) { (void)vhandle; return 0; } -int db_txn_commit(void *vhandle) { (void)vhandle; return 0; } - -#else - -extern void *dsm; -void *dbe_init(bfdir *d, bffile *f) { - dsm = &dsm_transactional; - (void)d; - (void)f; - return (void *)~0; -} - #endif ex_t dbe_recover(bfdir *directory, bool catastrophic, bool force) @@ -108,24 +93,6 @@ } #endif -ex_t dbe_checkpoint(bfdir *directory) -{ - (void) directory; - return EX_OK; -} - -ex_t dbe_purgelogs(bfdir *directory) -{ - (void) directory; - return EX_OK; -} - -ex_t dbe_remove(bfdir *directory) -{ - (void) directory; - return EX_OK; -} - /** probe if the directory contains an environment, and if so, * if it has transactions */ Index: datastore_db.c =================================================================== RCS file: /cvsroot/bogofilter/bogofilter/src/datastore_db.c,v retrieving revision 1.191 retrieving revision 1.192 diff -u -d -r1.191 -r1.192 --- datastore_db.c 21 Mar 2005 01:34:43 -0000 1.191 +++ datastore_db.c 24 Mar 2005 04:49:17 -0000 1.192 @@ -96,7 +96,8 @@ const char *ps; #if DB_AT_LEAST(4,1) - flags |= dsm->dsm_auto_commit_flags(); + if (dsm->dsm_auto_commit_flags != NULL) + flags |= dsm->dsm_auto_commit_flags(); #endif if ((ps = getenv("BF_PAGESIZE"))) { @@ -815,7 +816,8 @@ ret = 0; #endif - ret = dsm->dsm_sync(handle->dbenv->dbe, ret); + if (dsm->dsm_sync != NULL) + ret = dsm->dsm_sync(handle->dbenv->dbe, ret); if (ret) print_error(__FILE__, __LINE__, "DB->close error: %s", |