[cvs] bogofilter/src maint.c,1.49,1.50 datastore.h,1.33,1.34 datastore.c,1.49,1.50 bogoutil.c,1.133,
Fast Bayesian spam filter along lines suggested by Paul Graham
Brought to you by:
m-a
From: <m-...@us...> - 2004-11-26 01:06:50
|
Update of /cvsroot/bogofilter/bogofilter/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11086 Modified Files: maint.c datastore.h datastore.c bogoutil.c bogotune.c bogohist.c Log Message: Change ds_init() interface to take the environment directory. Index: maint.c =================================================================== RCS file: /cvsroot/bogofilter/bogofilter/src/maint.c,v retrieving revision 1.49 retrieving revision 1.50 diff -u -d -r1.49 -r1.50 --- maint.c 20 Nov 2004 03:34:52 -0000 1.49 +++ maint.c 26 Nov 2004 01:06:40 -0000 1.50 @@ -15,6 +15,9 @@ #include <assert.h> #include <stdlib.h> +/* this should go away some day: */ +#include "bogohome.h" + #include "datastore.h" #include "error.h" #include "maint.h" @@ -283,7 +286,7 @@ dsh_t *dsh; void *dbe; - dbe = ds_init(); + dbe = ds_init(bogohome); dsh = ds_open(dbe, CURDIR_S, db_file, DS_WRITE); if (dsh == NULL) Index: datastore.h =================================================================== RCS file: /cvsroot/bogofilter/bogofilter/src/datastore.h,v retrieving revision 1.33 retrieving revision 1.34 diff -u -d -r1.33 -r1.34 --- datastore.h 22 Nov 2004 22:43:22 -0000 1.33 +++ datastore.h 26 Nov 2004 01:06:40 -0000 1.34 @@ -116,8 +116,10 @@ /** Flush pending writes to disk */ extern void ds_flush(void *vhandle); -/** Global initialization of datastore layer. */ -extern void *ds_init(void); +/** Global initialization of datastore layer. The directory holds the + * database environment (only for BerkeleyDB TXN store, otherwise + * ignored), you can - for now - pass bogohome. */ +extern void *ds_init(const char *directory); /** Cleanup storage allocation of datastore layer. After calling this, * datastore access is no longer permitted. */ Index: datastore.c =================================================================== RCS file: /cvsroot/bogofilter/bogofilter/src/datastore.c,v retrieving revision 1.49 retrieving revision 1.50 diff -u -d -r1.49 -r1.50 --- datastore.c 22 Nov 2004 22:43:22 -0000 1.49 +++ datastore.c 26 Nov 2004 01:06:40 -0000 1.50 @@ -346,14 +346,15 @@ static word_t *msg_count_tok; static word_t *wordlist_version_tok; -void *ds_init(void) +void *ds_init(const char *directory) { - void *dbe = dbe_init(); + void *dbe = dbe_init(directory); if (msg_count_tok == NULL) { msg_count_tok = word_new((const byte *)MSG_COUNT, strlen(MSG_COUNT)); } if (wordlist_version_tok == NULL) { - wordlist_version_tok = word_new((const byte *)WORDLIST_VERSION, strlen(WORDLIST_VERSION)); + wordlist_version_tok = word_new((const byte *)WORDLIST_VERSION, + strlen(WORDLIST_VERSION)); } return dbe; } Index: bogoutil.c =================================================================== RCS file: /cvsroot/bogofilter/bogofilter/src/bogoutil.c,v retrieving revision 1.133 retrieving revision 1.134 diff -u -d -r1.133 -r1.134 --- bogoutil.c 26 Nov 2004 00:45:38 -0000 1.133 +++ bogoutil.c 26 Nov 2004 01:06:40 -0000 1.134 @@ -86,7 +86,7 @@ token_count = 0; - dbe = ds_init(); + dbe = ds_init(bogohome); rc = ds_oper(dbe, ds_file, DS_READ, ds_dump_hook, NULL); ds_cleanup(dbe); @@ -121,7 +121,7 @@ unsigned long line = 0; unsigned long count[IX_SIZE], date; YYYYMMDD today_save = today; - void *dbe = ds_init(); + void *dbe = ds_init(bogohome); if (dbe == NULL) return EX_ERROR; @@ -288,7 +288,7 @@ return EX_ERROR; } - dbe = ds_init(); + dbe = ds_init(bogohome); if ( stat(path, &sb) == 0 ) { /* XXX FIXME: deadlock possible */ Index: bogotune.c =================================================================== RCS file: /cvsroot/bogofilter/bogofilter/src/bogotune.c,v retrieving revision 1.184 retrieving revision 1.185 diff -u -d -r1.184 -r1.185 --- bogotune.c 22 Nov 2004 22:55:53 -0000 1.184 +++ bogotune.c 26 Nov 2004 01:06:40 -0000 1.185 @@ -1723,7 +1723,7 @@ ds_file = get_directory(PR_ENV_HOME); set_bogohome(ds_file); check_wordlist_path(); - env = ds_init(); + env = ds_init(bogohome); } bogotune(); Index: bogohist.c =================================================================== RCS file: /cvsroot/bogofilter/bogofilter/src/bogohist.c,v retrieving revision 1.17 retrieving revision 1.18 diff -u -d -r1.17 -r1.18 --- bogohist.c 20 Nov 2004 03:34:52 -0000 1.17 +++ bogohist.c 26 Nov 2004 01:06:40 -0000 1.18 @@ -18,6 +18,9 @@ #include <errno.h> #include <sys/stat.h> +/* this should go away some day: */ +#include "bogohome.h" + #include "bogohist.h" #include "prob.h" #include "datastore.h" @@ -138,7 +141,7 @@ build_wordlist_path(filepath, sizeof(filepath), path); - dbe = ds_init(); + dbe = ds_init(bogohome); if (dbe == NULL) return EX_ERROR; |