[Openvpn-devel,v2] Clarify operator precedence in a & b ? c : d
Commit Message
From: Frank Lichtenheld <frank@lichtenheld.com>
As suggested by cppcheck.
Change-Id: Ia153e0de888c0ee21199b192f3471ce4c08cb5c7
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1619
---
This change was reviewed on Gerrit and approved by at least one
developer. I request to merge it to master.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1619
This mail reflects revision 2 of this Change.
Acked-by according to Gerrit (reflected above):
Gert Doering <gert@greenie.muc.de>
Comments
Highly appreciated... (and oops, two of them are mine). No actual change
in functionality, just ensuring a clear and shared understanding between
compiler and humans reading the code... stared-at-code, test compiled,
BB ran client side tests.
Your patch has been applied to the master branch.
commit 1491fc8e05b01e65aba8b50499407d9af0424d69
Author: Frank Lichtenheld
Date: Tue Apr 7 22:52:28 2026 +0200
Clarify operator precedence in a & b ? c : d
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1619
Message-Id: <20260407205235.31126-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg36545.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
--
kind regards,
Gert Doering
@@ -399,7 +399,7 @@
static inline msglvl_t
nonfatal(const msglvl_t err)
{
- return err & M_FATAL ? (err ^ M_FATAL) | M_NONFATAL : err;
+ return (err & M_FATAL) ? (err ^ M_FATAL) | M_NONFATAL : err;
}
static inline int
@@ -7043,12 +7043,12 @@
if (options->routes->flags & RG_REROUTE_GW)
{
setenv_int(es, "route_redirect_gateway_ipv4",
- options->routes->flags & RG_BLOCK_LOCAL ? 2 : 1);
+ (options->routes->flags & RG_BLOCK_LOCAL) ? 2 : 1);
}
if (options->routes_ipv6 && (options->routes_ipv6->flags & RG_REROUTE_GW))
{
setenv_int(es, "route_redirect_gateway_ipv6",
- options->routes->flags & RG_BLOCK_LOCAL ? 2 : 1);
+ (options->routes->flags & RG_BLOCK_LOCAL) ? 2 : 1);
}
#ifdef _WIN32
/* we need this here to handle pushed --redirect-gateway */
@@ -276,7 +276,7 @@
const WCHAR *mesg[] = { msg[0], msg[1] };
ReportEvent(hEventSource,
- flags & MSG_FLAGS_ERROR ? EVENTLOG_ERROR_TYPE : EVENTLOG_INFORMATION_TYPE,
+ (flags & MSG_FLAGS_ERROR) ? EVENTLOG_ERROR_TYPE : EVENTLOG_INFORMATION_TYPE,
0,
EVT_TEXT_2,
NULL,