[PATCH v2 04/20] common: Introduce for_each_link macro

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Benjamin Berg <benjamin.berg@xxxxxxxxx>

This is a simple macro iterating the given bitmask using the given
variable. Having the macro avoids the for loop-continuation making it
more readable overall.

Signed-off-by: Benjamin Berg <benjamin.berg@xxxxxxxxx>
---
 src/utils/common.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/utils/common.h b/src/utils/common.h
index d4ffb998b..3a8d9e022 100644
--- a/src/utils/common.h
+++ b/src/utils/common.h
@@ -599,6 +599,10 @@ int str_starts(const char *str, const char *start);
 u8 rssi_to_rcpi(int rssi);
 char * get_param(const char *cmd, const char *param);
 
+#define for_each_link(__links, __i)                            \
+       for ((__i) = 0; (__i) < MAX_NUM_MLD_LINKS; (__i)++)     \
+               if ((__links) & BIT(__i))
+
 void forced_memzero(void *ptr, size_t len);
 
 /*
-- 
2.43.2


_______________________________________________
Hostap mailing list
Hostap@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/hostap



[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux