PERFORCE change 167185 for review

Hans Petter Selasky hselasky at c2i.net
Tue Aug 11 07:57:29 UTC 2009


On Monday 10 August 2009 21:21:37 Sylvestre Gallon wrote:
> +#define SAFE_OPS(fops, field, err)                     \
> +       if (fops->field == NULL)                        \
> +               err = generic_roothub_fops.field(sc, &len, &value, &index);
>     \ +       else                                            \
> +               err = fops->field(sc, &len, &value, &index)
> +

There is another way you can solve this at compile time!

#define USB_RHUB_SAFE_OPS \
	.fieldxxx = ,
    .fieldyyy = ,

struct usb_root_hub_ops table = {
USB_ROOT_HUB_SAFE_OPS,
.fieldxxx = , /* override */
};

This almost sounds like virtuals in C. Please check what the C99 standard says 
about initialising the same field multiple times.

--HPS


More information about the p4-projects mailing list