[cvs] bogofilter/src word.h,1.17,1.18

David Relson relson at osagesoftware.com
Mon Mar 14 01:07:29 CET 2005


On Mon, 14 Mar 2005 00:50:30 +0100
Matthias Andree wrote:

> David Relson <relson at users.sourceforge.net> writes:
> 
> >  /** create a new word_t from the NUL-terminated \a cstring */
> > -#define word_news(cstring) word_new((cstring), strlen((const char *)(cstring)));
> > +#define word_news(cstring) word_new(cstring, 0)
> 
> Dangerous. It is common practice to always include macro expansions into
> parentheses, to avoid trouble when someone stuffs special characters
> such as commas into the macro call that might goof up the RHS of the
> expansion. As written in the other mail, there is no longer reason to
> keep the "len == 0" special treatment, we can just take the second
> word_new() length argument straight in and use it. Gratuitous strlen()
> calls are slow, particularly in such low-level functions.
> 
> -- 
> Matthias Andree

There's nothing gratuitous about the strlen() call in word_new().  It's
part of the (unwritten) semantics of the function.  I'll be glad to
document the feature and make it official.

At the moment, rather than have more tweaks for word_t, I'd rather have
the new bogoutil capabilities so I can build/release 0.94.1

_______________________________________________
Bogofilter-dev mailing list
Bogofilter-dev at bogofilter.org
http://www.bogofilter.org/mailman/listinfo/bogofilter-dev



More information about the bogofilter-dev mailing list