mirror of
https://github.com/netwide-assembler/nasm.git
synced 2025-03-19 18:00:23 +08:00
nasmlib: Add list_last helper
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
This commit is contained in:
parent
a39912dcd9
commit
87225da76d
@ -248,12 +248,16 @@ void standard_extension(char *inname, char *outname, char *extension);
|
||||
*
|
||||
* list_for_each - regular iterator over list
|
||||
* list_for_each_safe - the same but safe against list items removal
|
||||
* list_last - find the last element in a list
|
||||
*/
|
||||
#define list_for_each(pos, head) \
|
||||
for (pos = head; pos; pos = pos->next)
|
||||
#define list_for_each_safe(pos, n, head) \
|
||||
for (pos = head, n = (pos ? pos->next : NULL); pos; \
|
||||
pos = n, n = (n ? n->next : NULL))
|
||||
#define list_last(pos, head) \
|
||||
for (pos = head; pos && pos->next; pos = pos->next) \
|
||||
;
|
||||
|
||||
/*
|
||||
* Power of 2 align helpers
|
||||
|
Loading…
x
Reference in New Issue
Block a user