From 08c99cafd2418eedb1d814212fab53b46e412fa4 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Sat, 30 Mar 2013 17:02:06 +0200 Subject: [PATCH] ap_list: Remove unused iteration list pointers This iter_next/iter_prev pointers were not really used for anything, so get rid of the unnecessary complexity in the AP list maintenance. Signed-hostap: Jouni Malinen --- src/ap/ap_list.c | 30 ------------------------------ src/ap/ap_list.h | 7 +------ src/ap/hostapd.h | 1 - 3 files changed, 1 insertion(+), 37 deletions(-) diff --git a/src/ap/ap_list.c b/src/ap/ap_list.c index 1d0b99ac4..585328c90 100644 --- a/src/ap/ap_list.c +++ b/src/ap/ap_list.c @@ -87,34 +87,6 @@ static void ap_ap_list_del(struct hostapd_iface *iface, struct ap_info *ap) } -static void ap_ap_iter_list_add(struct hostapd_iface *iface, - struct ap_info *ap) -{ - if (iface->ap_iter_list) { - ap->iter_prev = iface->ap_iter_list->iter_prev; - iface->ap_iter_list->iter_prev = ap; - } else - ap->iter_prev = ap; - ap->iter_next = iface->ap_iter_list; - iface->ap_iter_list = ap; -} - - -static void ap_ap_iter_list_del(struct hostapd_iface *iface, - struct ap_info *ap) -{ - if (iface->ap_iter_list == ap) - iface->ap_iter_list = ap->iter_next; - else - ap->iter_prev->iter_next = ap->iter_next; - - if (ap->iter_next) - ap->iter_next->iter_prev = ap->iter_prev; - else if (iface->ap_iter_list) - iface->ap_iter_list->iter_prev = ap->iter_prev; -} - - static void ap_ap_hash_add(struct hostapd_iface *iface, struct ap_info *ap) { ap->hnext = iface->ap_hash[STA_HASH(ap->addr)]; @@ -148,7 +120,6 @@ static void ap_free_ap(struct hostapd_iface *iface, struct ap_info *ap) { ap_ap_hash_del(iface, ap); ap_ap_list_del(iface, ap); - ap_ap_iter_list_del(iface, ap); iface->num_ap--; os_free(ap); @@ -203,7 +174,6 @@ static struct ap_info * ap_ap_add(struct hostapd_iface *iface, const u8 *addr) ap_ap_list_add(iface, ap); iface->num_ap++; ap_ap_hash_add(iface, ap); - ap_ap_iter_list_add(iface, ap); if (iface->num_ap > iface->conf->ap_table_max_size && ap != ap->prev) { wpa_printf(MSG_DEBUG, "Removing the least recently used AP " diff --git a/src/ap/ap_list.h b/src/ap/ap_list.h index d2c82ee17..24606cca4 100644 --- a/src/ap/ap_list.h +++ b/src/ap/ap_list.h @@ -14,15 +14,10 @@ struct ap_info { /* Note: next/prev pointers are updated whenever a new beacon is * received because these are used to find the least recently used - * entries. iter_next/iter_prev are updated only when adding new BSSes - * and when removing old ones. These should be used when iterating - * through the table in a manner that allows beacons to be received - * during the iteration. */ + * entries. */ struct ap_info *next; /* next entry in AP list */ struct ap_info *prev; /* previous entry in AP list */ struct ap_info *hnext; /* next entry in hash table list */ - struct ap_info *iter_next; /* next entry in AP iteration list */ - struct ap_info *iter_prev; /* previous entry in AP iteration list */ u8 addr[6]; u8 supported_rates[WLAN_SUPP_RATES_MAX]; int erp; /* ERP Info or -1 if ERP info element not present */ diff --git a/src/ap/hostapd.h b/src/ap/hostapd.h index f5aed9947..89591c705 100644 --- a/src/ap/hostapd.h +++ b/src/ap/hostapd.h @@ -220,7 +220,6 @@ struct hostapd_iface { int num_ap; /* number of entries in ap_list */ struct ap_info *ap_list; /* AP info list head */ struct ap_info *ap_hash[STA_HASH_SIZE]; - struct ap_info *ap_iter_list; unsigned int drv_flags;