[ovs-dev] [nxm 22/42] ofp-util: Add macros for composing error codes.

Justin Pettit jpettit at nicira.com
Fri Nov 5 00:55:06 UTC 2010


On Oct 28, 2010, at 10:27 AM, Ben Pfaff wrote:

> +/* These are macro versions of the functions defined below.  The macro versions
> + * are intended for use in contexts where function calls are not allowed,
> + * e.g. static initializers and case labels. */
> +#define OFP_MKERR(TYPE, CODE) ((1 << 30) | ((TYPE) << 16) | (CODE))
> +#define OFP_MKERR_VENDOR(VENDOR, TYPE, CODE) \
> +        ((1 << 30) | ((VENDOR) << 26) | ((TYPE) << 16) | (CODE))
> +#define OFP_MKERR_NICIRA(TYPE, CODE) \
> +        OFP_MKERR_VENDOR(OFPUTIL_VENDOR_NICIRA, TYPE, CODE)

Is it worth putting those last "TYPE" and "CODE" in parentheses?

Otherwise, looks good.

--Justin






More information about the dev mailing list