Acked-by: Donald Sharp <sha...@cumulusnetworks.com> On Sat, Mar 12, 2016 at 5:12 PM, David Lamparter < da...@opensourcerouting.org> wrote:
> On Sat, Mar 12, 2016 at 04:31:52PM -0500, Donald Sharp wrote: > > Let me rephrase a little bit. If this code was inspired from the linux > > kernel I'd like to attribute it properly, if not I'm not going to get too > > worried about it. The code just looks similiar enough that I'd like to > > make sure we don't run afoul of anyone shaking their virtual fists at us. > > I took it from the gcc docs in the assumption it's below the boundary of > creativeness required by copyright law, but if we can copy it off the > kernel sources that would be better (since the kernel is GPL, gcc docs > are GFDL which is not GPL compatible). > > > -David > > > On Sat, Mar 12, 2016 at 4:29 PM, Donald Sharp < > sha...@cumulusnetworks.com> > > wrote: > > > > > I agree this is less surprising! I was looking at pretty much the > exact > > > same thing in the linux kernel on friday afternoon right as I walked > out > > > the door. Should we attribute the original author? > > > > > > thanks! > > > > > > donald > > > > > > On Sat, Mar 12, 2016 at 1:58 PM, David Lamparter < > > > equi...@opensourcerouting.org> wrote: > > > > > >> cf. https://gcc.gnu.org/onlinedocs/gcc/Typeof.html > > >> (Works on all compilers on Quagga's compiler support list in > > >> doc/overview.texi) > > >> > > >> Signed-off-by: David Lamparter <equi...@opensourcerouting.org> > > >> --- > > >> Would suggest this additional fix to make the macro less surprising. > > >> > > >> -David > > >> > > >> --- > > >> lib/zebra.h | 12 +++++++++--- > > >> 1 file changed, 9 insertions(+), 3 deletions(-) > > >> > > >> diff --git a/lib/zebra.h b/lib/zebra.h > > >> index d980283..0ea5ee4 100644 > > >> --- a/lib/zebra.h > > >> +++ b/lib/zebra.h > > >> @@ -373,10 +373,16 @@ struct in_pktinfo > > >> > > >> /* MAX / MIN are not commonly defined, but useful */ > > >> #ifndef MAX > > >> -#define MAX(a, b) ((a) > (b) ? (a) : (b)) > > >> -#endif > > >> +#define MAX(a, b) \ > > >> + ({ typeof (a) _a = (a); \ > > >> + typeof (b) _b = (b); \ > > >> + _a > _b ? _a : _b; }) > > >> +#endif > > >> #ifndef MIN > > >> -#define MIN(a, b) ((a) < (b) ? (a) : (b)) > > >> +#define MIN(a, b) \ > > >> + ({ typeof (a) _a = (a); \ > > >> + typeof (b) _b = (b); \ > > >> + _a < _b ? _a : _b; }) > > >> #endif > > >> > > >> #define ZEBRA_NUM_OF(x) (sizeof (x) / sizeof (x[0])) > > >> -- > > >> 2.3.6 > > >> > > >> > > >> _______________________________________________ > > >> Quagga-dev mailing list > > >> Quagga-dev@lists.quagga.net > > >> https://lists.quagga.net/mailman/listinfo/quagga-dev > > >> > > > > > > >
_______________________________________________ Quagga-dev mailing list Quagga-dev@lists.quagga.net https://lists.quagga.net/mailman/listinfo/quagga-dev