[PATCH 1/3] lib/string_helpers: Consolidate yesno() implementation

David Laight David.Laight at ACULAB.COM
Wed Jan 19 16:38:26 UTC 2022


> > > > +static inline const char *yesno(bool v) { return v ? "yes" : "no"; }
> 
> 	return "yes\0no" + v * 4;
> 
> :-)

except '"no\0\0yes" + v * 4' works a bit better.

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)


More information about the Linux-security-module-archive mailing list