> -----Original Message----- > From: dev [mailto:dev-boun...@dpdk.org] On Behalf Of Ravi Kerur > Sent: Sunday, March 5, 2017 7:47 PM > To: dev@dpdk.org > Cc: Ananyev, Konstantin <konstantin.anan...@intel.com>; Richardson, Bruce > <bruce.richard...@intel.com>; Ravi Kerur <rke...@gmail.com> > Subject: [dpdk-dev] [v4 2/3] LPM config file read option. > > ... > + > +#define IPV6_ADDR_LEN 16 > +#define IPV6_ADDR_U16 (IPV6_ADDR_LEN / sizeof(uint16_t)) > +#define IPV6_ADDR_U32 (IPV6_ADDR_LEN / sizeof(uint32_t)) > + > +#define GET_CB_FIELD(in, fd, base, lim, dlm) do { \ > + unsigned long val; \ > + char *end; \ > + errno = 0; \ > + val = strtoul((in), &end, (base)); \ > + if (errno != 0 || end[0] != (dlm) || val > (lim)) \ > + return -EINVAL; \ > + (fd) = (typeof(fd))val; \ > + (in) = end + 1; \ > +} while (0)
Hi, It is probably worth putting a comment before this macro to explain what it does. Also, it isn't clear, to me, what CB stands for. Also, having a return in the middle of the macro might be problematic if it is used in a function with a different, or not, return value. John