Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 28 Jun 2018 21:44:26 +0200
From:      Ed Schouten <ed@nuxi.nl>
To:        "Conrad E. Meyer" <cem@freebsd.org>
Cc:        Justin Hibbits <jrh29@alumni.cwru.edu>, David Bright <dab@freebsd.org>,  src-committers <src-committers@freebsd.org>, svn-src-all@freebsd.org,  svn-src-head@freebsd.org
Subject:   Re: svn commit: r335765 - head/sys/sys
Message-ID:  <CABh_MKkmHq%2Bii2YYZA3i7ajpPcnWFWqK-BM77vhQ3G1K1GgKcA@mail.gmail.com>
In-Reply-To: <CAG6CVpXzD-27t3g9HCbZ_=5Uyo4VPj706yx8cUiFMhq7NrKe9w@mail.gmail.com>
References:  <201806281701.w5SH15eP011261@repo.freebsd.org> <CAHSQbTD5BtcvcMeA%2BZeAUfkdsB6F%2BY9G182rnOHwb-E%2ByGxCUw@mail.gmail.com> <CAG6CVpXzD-27t3g9HCbZ_=5Uyo4VPj706yx8cUiFMhq7NrKe9w@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
2018-06-28 21:09 GMT+02:00 Conrad Meyer <cem@freebsd.org>:
> I think the right initializer is something like:
>
> *(kevp_) = (struct kevent) {
> ...
> .ext = {
>   [0] = 0,
>   [1] = 0,
> ...
> },
> };

The nice thing about using an inline function is that you can get rid
of the compound literal:

static __inline void
EV_SET(struct kevent *kevp, ...)
{
    struct kevent kev = {
        // initializer goes here.
    };
    *kevp = kev;
}

This should even work with C89 compilers, assuming <sys/cdefs.h>
provides some smartness for __inline.

-- 
Ed Schouten <ed@nuxi.nl>
Nuxi, 's-Hertogenbosch, the Netherlands



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CABh_MKkmHq%2Bii2YYZA3i7ajpPcnWFWqK-BM77vhQ3G1K1GgKcA>