aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2019-02-08 16:57:49 (GMT)
committerJouni Malinen <j@w1.fi>2019-02-11 11:37:22 (GMT)
commiteb84238df6819fe38b52d8db3b529ec26cf978fa (patch)
tree5bc69bafb87419837b3806de40a537c0b6c51a69
parent0e0c31bdc57a124c2b62e6659ef9e20b8368c8de (diff)
downloadhostap-eb84238df6819fe38b52d8db3b529ec26cf978fa.zip
hostap-eb84238df6819fe38b52d8db3b529ec26cf978fa.tar.gz
hostap-eb84238df6819fe38b52d8db3b529ec26cf978fa.tar.bz2
common: Use for_each_element() in ieee802_11_ie_count()
Simple cleanup using the new macros. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
-rw-r--r--src/common/ieee802_11_common.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/src/common/ieee802_11_common.c b/src/common/ieee802_11_common.c
index 871536f..b38f2f1 100644
--- a/src/common/ieee802_11_common.c
+++ b/src/common/ieee802_11_common.c
@@ -543,21 +543,14 @@ ParseRes ieee802_11_parse_elems(const u8 *start, size_t len,
int ieee802_11_ie_count(const u8 *ies, size_t ies_len)
{
+ const struct element *elem;
int count = 0;
- const u8 *pos, *end;
if (ies == NULL)
return 0;
- pos = ies;
- end = ies + ies_len;
-
- while (end - pos >= 2) {
- if (2 + pos[1] > end - pos)
- break;
+ for_each_element(elem, ies, ies_len)
count++;
- pos += 2 + pos[1];
- }
return count;
}