strncmp usage in ipfw
brooks at one-eyed-alien.net
Thu Dec 9 13:50:35 PST 2004
On Tue, Nov 30, 2004 at 04:19:32AM -0800, Luigi Rizzo wrote:
> i believe the original, old ipfw code used strncmp() to allow for
> abbreviations. When i rewrote ipfw2 i did not feel like removing
> the feature for fear of introducing backward compatibility problems
> with existing files. However I agree that this introduces a
> maintainability nightmare and i believe we should move to strcmp(),
> especially given that with ipfw2 new option names are coming out
> quite frequently.
OK, that makes sense.
I'd like to propose the following plan:
- Disallow new strncmp instances in all branches.
- remove strncmp usage in HEAD with the intention of explicitly adding
back needed abbreviations when those abbreviations are both:
- sane (no single letter appreviations, reasionable edit distance
from other options, either obvious shorthand or reasionbly mnemonic).
- actually used be someone (this is key, espeicaly since there are
hundreds of possiable values and this isn't a documented
feature as far as I can tell.)
If need be we could implement a more complex stratigy for deprecation
where we use a new matching function and warn about short matches, but
I'm not sure that's necessicary.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 189 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-ipfw/attachments/20041209/07c09c74/attachment.bin
More information about the freebsd-ipfw