diff options
| author | Michael Brown | 2012-05-08 11:46:39 +0200 |
|---|---|---|
| committer | Michael Brown | 2012-05-08 13:49:01 +0200 |
| commit | 6ba7fb7c5cdcdfa6f32dd1a97c3ab235ffe54616 (patch) | |
| tree | d8c56e623edd926736a7f6e2faa6902e893bbfce /src/include | |
| parent | [tcp] Discard all TCP connections on shutdown (diff) | |
| download | ipxe-6ba7fb7c5cdcdfa6f32dd1a97c3ab235ffe54616.tar.gz ipxe-6ba7fb7c5cdcdfa6f32dd1a97c3ab235ffe54616.tar.xz ipxe-6ba7fb7c5cdcdfa6f32dd1a97c3ab235ffe54616.zip | |
[list] Add list_last_entry()
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/include')
| -rw-r--r-- | src/include/ipxe/list.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/include/ipxe/list.h b/src/include/ipxe/list.h index 4daf12b2e..b14a83d70 100644 --- a/src/include/ipxe/list.h +++ b/src/include/ipxe/list.h @@ -325,6 +325,19 @@ static inline void list_splice_tail_init ( struct list_head *list, list_entry ( (list)->next, type, member ) ) /** + * Get the container of the last entry in a list + * + * @v list List head + * @v type Containing type + * @v member Name of list field within containing type + * @ret first First list entry, or NULL + */ +#define list_last_entry( list, type, member ) \ + ( list_empty ( (list) ) ? \ + ( type * ) NULL : \ + list_entry ( (list)->prev, type, member ) ) + +/** * Iterate over a list * * @v pos Iterator |
