Re: multilog filtering issues

"Benjamin R. Haskell" <[email protected]> Sat, 6 Dec 2008 22:02:55 -0500 (EST)
Newsgroups gmane.comp.djb.syslog
Message-ID <[email protected]>
On Sun, 7 Dec 2008, Daryl Tester wrote:

> I thought I had read somewhere about match() being written to be linear 
> in its run time, but all I can currently find is the current caveat on 
> the multilog page about its memory constraint.

It will certainly be linear in runtime. By changing '*' to mean 'anything 
but the following character', you can just proceed straight through the 
string. At each character you check to see if it matches a particular 
character (if there's a literal character in the pattern) or doesn't match 
a particular character (if there's a '*', in which case you've precomputed 
the non-match). If the comparison fails at any point, you can reject. 
(With the extra exception that '*' at the end means 'return positive match 
now'.)

Best,
Ben

(Reply to the list, please -- Reply-To set to avoid autoresponders)