buff_t and thereabouts

David Relson relson at osagesoftware.com
Tue Jan 4 23:41:06 CET 2005


On Tue, 04 Jan 2005 19:57:01 +0100
Matthias Andree wrote:

> David,
> 
> although I documented the buff.* stuff and it has some few users, do we
> really need this?
> 
> I see some abuse (i. e. direct access, such as assigning a buff_t to a
> word_t) and a lot of unused features, for instance, the test suite
> doesn't need the "fgetsl to ->read", and some prying other types into
> buff_t shape just for convenience.
> 
> What exactly is the advantage of buff? Can the buff_add perhaps be
> folded into word.* and buff* be removed altogether? It seems the only
> halfway serious user is bogoreader, and the latter looks somewhat
> clumsy.
> 
> Short: I'd like to get rid of buff.* - hints and pitfalls appreciated.

word_t is an encapsulation of a byte array and its length.  buff_t has
additional attributes which support partial buffer operations.  The
differences make it reasonable for a big chunk of input to be read into
a buff_t, then have individual lines pass to the parser, where word_t
are generated for use in scoring.

Looking at them from an object oriented perspective, word_t is the super
class and buff_t is the sub-class and inherits its attributes.  Given
that perspective, direct assignments are reasonable.

Changing one to the other may be feasible.  I just remember the
difficulty of getting them working properly in the first place and am
reluctant to tackle a rewrite without compelling need.



More information about the bogofilter-dev mailing list