summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2020-05-12 14:37:01 +0200
committerThomas Haller <thaller@redhat.com>2020-05-12 14:41:09 +0200
commit1c216ca3be88223c80b1da0baceb6ec4ccd4be81 (patch)
tree6603cbed8a56926363a5df5f5f6a4d7c5cca3cfa
parentb7a2e73bd26b3d48a6a083ff73882afcfa1be228 (diff)
downloadNetworkManager-1c216ca3be88223c80b1da0baceb6ec4ccd4be81.tar.gz
wifi: drop extra conditions in nm_wifi_utils_parse_ies() and use NM_SET_OUT()
NM_SET_OUT() macro already has an "if" condition to only do anything if the output pointer is not NULL. As such, we don't need to check first. In practice, this only reorders the checks, which the compiler may anyway do. Note that above the checks are still relevant, because we want to avoid the more expensive parsing, if we don't care about the result.
-rw-r--r--src/nm-core-utils.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/src/nm-core-utils.c b/src/nm-core-utils.c
index 86ba360c45..019d1e600f 100644
--- a/src/nm-core-utils.c
+++ b/src/nm-core-utils.c
@@ -4446,21 +4446,18 @@ nm_wifi_utils_parse_ies (const guint8 *bytes,
}
break;
case WLAN_EID_VENDOR_SPECIFIC:
- if (out_metered) {
- if ( len == 8
- && bytes[0] == 0x00 /* OUI: Microsoft */
- && bytes[1] == 0x50
- && bytes[2] == 0xf2
- && bytes[3] == 0x11) /* OUI type: Network cost */
- *out_metered = (bytes[7] > 1); /* Cost level > 1 */
- }
- if ( out_owe_transition_mode
- && elem_len >= 10
+ if ( len == 8
+ && bytes[0] == 0x00 /* OUI: Microsoft */
+ && bytes[1] == 0x50
+ && bytes[2] == 0xf2
+ && bytes[3] == 0x11) /* OUI type: Network cost */
+ NM_SET_OUT (out_metered, (bytes[7] > 1)); /* Cost level > 1 */
+ if ( elem_len >= 10
&& bytes[0] == 0x50 /* OUI: WiFi Alliance */
&& bytes[1] == 0x6f
&& bytes[2] == 0x9a
&& bytes[3] == 0x1c) /* OUI type: OWE Transition Mode */
- *out_owe_transition_mode = TRUE;
+ NM_SET_OUT (out_owe_transition_mode, TRUE);
break;
}