HomeFreeBSD

Remove potential identifier conflict in the EV_SET macro.

Description

Remove potential identifier conflict in the EV_SET macro.

PR43905 pointed out a problem with the EV_SET macro if the passed
struct kevent pointer were specified with an expression with side
effects (e.g., "kevp++"). This was fixed in rS110241, but by using a
local block that defined an internal variable (named "kevp") to get
the pointer value once. This worked, but could cause issues if an
existing variable named "kevp" is in scope. To avoid that issue,
jilles@ pointed out that "C99 compound literals and designated
initializers allow doing this cleanly using a macro". This change
incorporates that suggestion, essentially verbatim from jilles@
comment on PR43905, except retaining the old definition for pre-C99 or
non-STDC (e.g., C++) compilers.

PR: 43905
Submitted by: Jilles Tjoelker (jilles@)
Reported by: Lamont Granquist <lamont@scriptkiddie.org>
Reviewed by: jmg (no comments), jilles
MFC after: 1 week
Sponsored by: Dell EMC
Differential Revision: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=43905

Details

Provenance
dabAuthored on
Reviewer
jmg
Differential Revision
D15679: Remove potential identifier conflict in the EV_SET macro.
Parents
rS335764: Add an errata entry regarding Bugzilla 228536.
Branches
Unknown
Tags
Unknown