tech-net archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: patch make struct protosw pr_input non-variadic
On Sat, May 14, 2016 at 06:22:08PM -0400, Christos Zoulas wrote:
> On May 14, 5:28pm, rtr%netbsd.org@localhost (Tyler Retzlaff) wrote:
> -- Subject: Re: patch make struct protosw pr_input non-variadic
>
> | The only casts I see in the patch are those producing the address of
> | struct protosw that are the product of a designated initialization? Or
> | am I missing something?
>
> Yes, I guess the only way to avoid those is to have static variables for
> them?
That would be my expectation if it what was desired. It seems harder to
maintain though.
(1)
const struct protosw unixsw[] = {
{ /* 0 */
... initialize ...
},
{ /* 1 */
... initialize ...
},
};
const struct protosw *unixswp[] = {
&unixsw[0],
&unixsw[1],
};
struct domain unixdomain = {
.dom_protosw = unixswp,
.dom_nprotosw = __arraycount(unixswp)
... other members ...
};
Would be awful.
The other possibility is to populate at domain initialization.
(2)
void
un_dom_init()
{
for (i = 0; i < __arraycount(unixsw); i++) {
unixdomain.dom_protosw[i] = &unixsw[i];
}
}
Neither of these seems better than just placing the cast at the point
of designated initialization. I guess you would agree?
>
> christos
Home |
Main Index |
Thread Index |
Old Index