Date: Tue, 11 Aug 2009 08:57:27 +0200 From: Hans Petter Selasky <hselasky@c2i.net> To: Sylvestre Gallon <syl@freebsd.org> Cc: Perforce Change Reviews <perforce@freebsd.org> Subject: Re: PERFORCE change 167185 for review Message-ID: <200908110857.28422.hselasky@c2i.net> In-Reply-To: <200908101921.n7AJLbUb077185@repoman.freebsd.org> References: <200908101921.n7AJLbUb077185@repoman.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200908110857.28422.hselasky>
