subtle "algorithm" definition issue.

Matthias Andree matthias.andree at gmx.de
Sun Nov 3 19:13:27 CET 2002


Hi,

I've tried to clean up the source a bit, and I found that bogofilter.h
contained a definition of the algorithm variable. I don't think this is
right, and removing it indeed revealed a problem: bogoutil needs the
algorithm, but never initializes it properly.

Change this line in bogofilter.h

enum algorithm { AL_GRAHAM, AL_ROBINSON } algorithm;

to

enum algorithm { AL_GRAHAM = 1, AL_ROBINSON };

You'll then find that bogoutil no longer compiles, and the necessary
dependency flow is intricate.

wordlists.c:setup_lists calls init_list with GOOD_BIAS, which itself
depends on algorithm:

bogofilter.h:18:
#define GOOD_BIAS (algorithm == AL_GRAHAM ? GRAHAM_GOOD_BIAS : ROBINSON_GOOD_BIAS)

I'm unsure how the interfaces must be changed to make this clear. I
wondered if I should just add enum algorithm algorithm = AL_GRAHAM; to
bogoutil, but that does not look right to me.

Opinions appreciated.

-- 
Matthias Andree



More information about the bogofilter-dev mailing list