]> git.ipfire.org Git - thirdparty/hostap.git/commit
Use for_each_link() in most cases
authorBenjamin Berg <benjamin.berg@intel.com>
Tue, 20 Feb 2024 13:18:12 +0000 (14:18 +0100)
committerJouni Malinen <j@w1.fi>
Sat, 2 Mar 2024 09:11:12 +0000 (11:11 +0200)
commitdbdf7ef679fb4c2fd5b4b5b80beea5be18aec118
treea04399b84ba39b6d6c39144bef2140c24d3d7702
parentc9f8fe0664a83b3ebd363e0b9d3c9d4f95bd9c80
Use for_each_link() in most cases

This was done using the below semantic patch. There are a few more
places that were missed due to variable declarations or additional
checks in the for loop.

@@
iterator name for_each_link;
identifier max_links =~ "MAX_NUM_MLD_LINKS|MAX_NUM_MLO_LINKS";
expression links;
expression further_tests;
identifier i;
statement stmt;
@@
-for (i = 0; i < max_links; i++)
+for_each_link(links, i)
 {
(
-  if (!(links & BIT(i)))
-    continue;
   ...
|
-  if (!(links & BIT(i)) || further_tests)
+  if (further_tests)
     continue;
   ...
|
-  if (further_tests || !(links & BIT(i)))
+  if (further_tests)
     continue;
   ...
|
-  if (links & BIT(i))
     stmt
|
-  if (further_tests && (links & BIT(i)))
+  if (further_tests)
     stmt
|
-  if ((links & BIT(i)) && further_tests)
+  if (further_tests)
     stmt
)
 }

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
13 files changed:
src/ap/wpa_auth.c
src/drivers/driver_nl80211.c
src/drivers/driver_nl80211_event.c
src/rsn_supp/tdls.c
src/rsn_supp/wpa.c
wpa_supplicant/bss.c
wpa_supplicant/ctrl_iface.c
wpa_supplicant/events.c
wpa_supplicant/rrm.c
wpa_supplicant/scan.c
wpa_supplicant/sme.c
wpa_supplicant/wnm_sta.c
wpa_supplicant/wpa_supplicant.c