buff_t and thereabouts
Matthias Andree
matthias.andree at gmx.de
Wed Jan 5 00:12:58 CET 2005
David Relson <relson at osagesoftware.com> writes:
> 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.
The relation ship is clear, I wonder if we actually use the "partial
read" to an extent that makes buff_t worthwhile, and if it's really
doing the right thing in _fgets, just filling up the buffer, making the
supported line length dependent on previous data.
> 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.
Half of the stuff has already been written, and fgetsln() writing to the
beginning of the buffer area will also make all tests pass, buff_fgets*
are apparently never called with nonzero ->read.
--
Matthias Andree
More information about the bogofilter-dev
mailing list