question about config code

Graham Wilson bob at decoy.wox.org
Mon Nov 25 21:52:15 CET 2002


On Mon, Nov 25, 2002 at 07:49:30AM -0500, David Relson wrote:
> Each entry in the parm_desc struct has a "type" field (CP_ALGORITHM, 
> CP_INTEGER, etc).  A switch statement branches on the type and either does 
> inline processing to get a value and store it (for simple types like 
> CP_INTEGER, CP_DOUBLE, etc), or it calls a function to process the 
> parameter (for CP_ALGORITHM and CP_WORDLIST).

it would seem to me both from looking at the code and from stepping
through it in gdb that the CP_ALGORITHM case is never reached, since
algorithm has a NULL in its addr field, which causes
process_config_parameter to pass return before even reaching the switch
statement:

	if ( arg->addr.v == NULL )
		return ok;

> Some options apply to bogofilter as a whole.  Some apply to a particular 
> algorithm, but not to the others.  The parm_desc struct in config.c gives 
> the handling info for the global parameters.  The algorithm files 
> (graham.c, robinson.c, and fisher.c) have their own parm_desc structs for 
> their private parameters.

it would seem to make more sense to handle the option processing from
config.c, but i guess it is done this way so that all algorithm code can
be properly seperated from the rest of the code, right?

--
gram




More information about the bogofilter-dev mailing list