summaryrefslogtreecommitdiffstats
path: root/src/net/80211
diff options
context:
space:
mode:
authorMichael Brown2010-11-08 03:51:18 +0100
committerMichael Brown2010-11-08 04:15:28 +0100
commitea631f6fb8dbffe3081ecf29eafa62ecd38ec64f (patch)
treef27d347fc48c524e172a4bdeea80976a26b9904a /src/net/80211
parent[list] Extend list-manipulation assertions to all list-handling functions (diff)
downloadipxe-ea631f6fb8dbffe3081ecf29eafa62ecd38ec64f.tar.gz
ipxe-ea631f6fb8dbffe3081ecf29eafa62ecd38ec64f.tar.xz
ipxe-ea631f6fb8dbffe3081ecf29eafa62ecd38ec64f.zip
[list] Add list_first_entry()
There are several points in the iPXE codebase where list_for_each_entry() is (ab)used to extract only the first entry from a list. Add a macro list_first_entry() to make this code easier to read. Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/net/80211')
-rw-r--r--src/net/80211/net80211.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/net/80211/net80211.c b/src/net/80211/net80211.c
index ffa5c911..d39958ba 100644
--- a/src/net/80211/net80211.c
+++ b/src/net/80211/net80211.c
@@ -668,11 +668,11 @@ struct io_buffer * net80211_mgmt_dequeue ( struct net80211_device *dev,
*signal = rxi->signal;
free ( rxi );
- list_for_each_entry ( iobuf, &dev->mgmt_queue, list ) {
- list_del ( &iobuf->list );
- return iobuf;
- }
- assert ( 0 );
+ assert ( ! list_empty ( &dev->mgmt_queue ) );
+ iobuf = list_first_entry ( &dev->mgmt_queue, struct io_buffer,
+ list );
+ list_del ( &iobuf->list );
+ return iobuf;
}
return NULL;