Change in openvpn[master]: route: Clarify operator precedence in a & b ? c : d
A message that is not in the archive (sent off-list or not yet received): gerrit.1778102459000.I5c9b54dca0a14688a3bb7798cb086f5bde7311b8@...2715...
Attention is currently required from: plaisthos.
Hello plaisthos,
I'd like you to do a code review.
Please visit
http://gerrit.openvpn.net/c/openvpn/+/1668?usp=email
to review the following change.
Change subject: route: Clarify operator precedence in a & b ? c : d
......................................................................
route: Clarify operator precedence in a & b ? c : d
As suggested by cppcheck.
---
M src/openvpn/route.c
1 file changed, 1 insertion(+), 1 deletion(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/68/1668/1
src/openvpn/route.c +1 -1
@@ -2884,7 +2884,7 @@ .prefix.ipv4.s_addr = htonl(r->network), .gateway.ipv4.s_addr = htonl(r->gateway), .iface = { .index = if_index, .name = "" }, - .metric = (r->flags & RT_METRIC_DEFINED ? r->metric : -1) }; + .metric = ((r->flags & RT_METRIC_DEFINED) ? r->metric : -1) };netmask_to_netbits (r->network, r->netmask, &msg.prefix_len);if (msg.prefix_len ==-1 )
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1668?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I5c9b54dca0a14688a3bb7798cb086f5bde7311b8
Gerrit-Change-Number: 1668
Gerrit-PatchSet: 1
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Attention is currently required from: flichtenheld, plaisthos.
cron2 has posted comments on this change by flichtenheld. ( http://gerrit.openvpn.net/c/openvpn/+/1668?usp=email )
Change subject: route: Clarify operator precedence in a & b ? c : d
......................................................................
Patch Set 1: Code-Review-1
(1 comment)
File src/openvpn/route.c:
http://gerrit.openvpn.net/c/openvpn/+/1668/comment/7004e626_e74dcd6c?usp=email :
PS1, Line 2887: .metric = ((r->flags & RT_METRIC_DEFINED) ? r->metric : -1) };
can we get rid of the outer braces?
.metric = ( a & b )? c: d
is clear enough to readers (IMHO easier to grasp) and should be fine for the compiler?
Signature · 18 lines
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1668?usp=email To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email Gerrit-MessageType: comment Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: I5c9b54dca0a14688a3bb7798cb086f5bde7311b8 Gerrit-Change-Number: 1668 Gerrit-PatchSet: 1 Gerrit-Owner: flichtenheld <[email protected]...> Gerrit-Reviewer: cron2 <[email protected]...> Gerrit-Reviewer: plaisthos <[email protected]...> Gerrit-CC: openvpn-devel <[email protected]> Gerrit-Attention: plaisthos <[email protected]...> Gerrit-Attention: flichtenheld <[email protected]...> Gerrit-Comment-Date: Thu, 07 May 2026 05:49:26 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: Yes
Attention is currently required from: cron2, flichtenheld, plaisthos.
Hello cron2, plaisthos,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/1668?usp=email
to look at the new patch set (#3).
The following approvals got outdated and were removed:
Code-Review-1 by cron2
Change subject: route: Clarify operator precedence in a & b ? c : d
......................................................................
route: Clarify operator precedence in a & b ? c : d
As suggested by cppcheck.
---
M src/openvpn/route.c
1 file changed, 2 insertions(+), 2 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/68/1668/3
src/openvpn/route.c +2 -2
@@ -2884,7 +2884,7 @@ .prefix.ipv4.s_addr = htonl(r->network), .gateway.ipv4.s_addr = htonl(r->gateway), .iface = { .index = if_index, .name = "" }, - .metric = (r->flags & RT_METRIC_DEFINED ? r->metric : -1) }; + .metric = (r->flags & RT_METRIC_DEFINED) ? r->metric : -1 };netmask_to_netbits (r->network, r->netmask, &msg.prefix_len);if (msg.prefix_len ==-1 )
@@ -2986,7 +2986,7 @@ .prefix_len = r->netbits, .gateway.ipv6 = r->gateway, .iface = { .index = tt->adapter_index, .name = "" }, - .metric = ((r->flags & RT_METRIC_DEFINED) ? r->metric : -1) }; + .metric = (r->flags & RT_METRIC_DEFINED) ? r->metric : -1 };if (r->adapter_index)/* vpn server special route */ {
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1668?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I5c9b54dca0a14688a3bb7798cb086f5bde7311b8
Gerrit-Change-Number: 1668
Gerrit-PatchSet: 3
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: cron2 <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Attention is currently required from: flichtenheld, plaisthos.
cron2 has posted comments on this change by flichtenheld. ( http://gerrit.openvpn.net/c/openvpn/+/1668?usp=email )
Change subject: route: Clarify operator precedence in a & b ? c : d
......................................................................
Patch Set 3: Code-Review+2
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1668?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I5c9b54dca0a14688a3bb7798cb086f5bde7311b8
Gerrit-Change-Number: 1668
Gerrit-PatchSet: 3
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Mon, 11 May 2026 20:06:29 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
PATCH v3 1/1 route: Clarify operator precedence in a & b ? c : d
In reply to a message not in the archiveFrom: Frank Lichtenheld <[email protected]...>
As suggested by cppcheck.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1668
---
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/+/1668
This mail reflects revision 3 of this Change.
Acked-by according to Gerrit (reflected above):
Gert Doering <[email protected]...>
src/openvpn/route.c +2 -2
@@ -2884,7 +2884,7 @@ .prefix.ipv4.s_addr = htonl(r->network), .gateway.ipv4.s_addr = htonl(r->gateway), .iface = { .index = if_index, .name = "" }, - .metric = (r->flags & RT_METRIC_DEFINED ? r->metric : -1) }; + .metric = (r->flags & RT_METRIC_DEFINED) ? r->metric : -1 };netmask_to_netbits (r->network, r->netmask, &msg.prefix_len);if (msg.prefix_len ==-1 )
@@ -2986,7 +2986,7 @@ .prefix_len = r->netbits, .gateway.ipv6 = r->gateway, .iface = { .index = tt->adapter_index, .name = "" }, - .metric = ((r->flags & RT_METRIC_DEFINED) ? r->metric : -1) }; + .metric = (r->flags & RT_METRIC_DEFINED) ? r->metric : -1 };if (r->adapter_index)/* vpn server special route */ {