On Fri, Apr 17, 2015 at 06:02:37PM +0100, Paul Jakma wrote:
> Nice.
> 
> Just one question. The s/CMD_/CMDS_/ in the macro names seems to just be 
> churn? Presumably to help catch uses while developing? If just churn, 
> maybe undo it?

It was intentional to make the break in usage obvious.  Maybe we should
move it from command.h to .c altogether, it's not used anywhere else...
(or even kill the macros, each of them has only one place of usage left)


-David

> On Mon, 13 Apr 2015, David Lamparter wrote:
> 
> > Er, no idea how anyone could ever have thought that it would be a good
> > idea to have a zillion of strcmp() calls in the CLI's active paths, just
> > to compare against things like "A.B.C.D".
> >
> > Reduces 40k prefix list load time from 1.65s to 1.23s (1.34:1).
> >
> > Signed-off-by: David Lamparter <[email protected]>
> 
> > /* Some macroes */
> > -#define CMD_OPTION(S)   ((S[0]) == '[')
> > -#define CMD_VARIABLE(S) (((S[0]) >= 'A' && (S[0]) <= 'Z') || ((S[0]) == 
> > '<'))
> > -#define CMD_VARARG(S)   ((S[0]) == '.')
> > -#define CMD_RANGE(S)       ((S[0] == '<'))
> > -
> > -#define CMD_IPV4(S)           ((strcmp ((S), "A.B.C.D") == 0))
> > -#define CMD_IPV4_PREFIX(S) ((strcmp ((S), "A.B.C.D/M") == 0))
> > -#define CMD_IPV6(S)        ((strcmp ((S), "X:X::X:X") == 0))
> > -#define CMD_IPV6_PREFIX(S) ((strcmp ((S), "X:X::X:X/M") == 0))
> > +#define CMDS_OPTION(S)   ((S[0]) == '[')
> > +#define CMDS_VARIABLE(S) (((S[0]) >= 'A' && (S[0]) <= 'Z') || ((S[0]) == 
> > '<'))
> > +#define CMDS_VARARG(S)   ((S[0]) == '.')
> > +#define CMDS_RANGE(S)    ((S[0] == '<'))
> > +
> > +#define CMDS_IPV4(S)        ((strcmp ((S), "A.B.C.D") == 0))
> > +#define CMDS_IPV4_PREFIX(S) ((strcmp ((S), "A.B.C.D/M") == 0))
> > +#define CMDS_IPV6(S)        ((strcmp ((S), "X:X::X:X") == 0))
> > +#define CMDS_IPV6_PREFIX(S) ((strcmp ((S), "X:X::X:X/M") == 0))
> >
> > /* Common descriptions. */
> > #define SHOW_STR "Show running system information\n"
> >
> 
> -- 
> Paul Jakma    [email protected]  @pjakma Key ID: 64A2FF6A
> Fortune:
> Isn't it conceivable to you that an intelligent person could harbor
> two opposing ideas in his mind?
>               -- Adlai Stevenson, to reporters
> 
> _______________________________________________
> Quagga-dev mailing list
> [email protected]
> https://lists.quagga.net/mailman/listinfo/quagga-dev

_______________________________________________
Quagga-dev mailing list
[email protected]
https://lists.quagga.net/mailman/listinfo/quagga-dev

Reply via email to