[Swan] streq()

Paul Wouters paul at nohats.ca
Mon Feb 11 02:28:44 EET 2013


On Sun, 10 Feb 2013, D. Hugh Redelmeier wrote:

> Pluto has a macro, defined in include/constants.h, called streq:
>
> #define streq(a, b) (strcmp((a), (b)) == 0)     /* clearer shorthand */

Maybe more that to libreswan.h so it can be used in lib/ as well?

> Note: officially the C standard has reserved identifiers that begin
> with str.  So STREQ is technically safer.  I think that streq is
> enough nicer that I'm willing to chance it.

I'd be okay with it. I agree its use is better. I also try to ensure
the "ugh" and "e" variables are used for cases where we expect the
return to be NULL for success, and errno/error if there was a problem.

Paul


More information about the Swan mailing list