summaryrefslogtreecommitdiff
path: root/nasmlib.h
diff options
context:
space:
mode:
authorCyrill Gorcunov <gorcunov@gmail.com>2011-04-13 10:19:30 +0400
committerCyrill Gorcunov <gorcunov@gmail.com>2011-06-25 18:15:21 +0400
commit87225da76d87bfe388f8a772bf5419fb82306f67 (patch)
treec427ffd9f3378b2543eebc2f165c643f1952b9ca /nasmlib.h
parenta39912dcd9ad21cba4bf1748200126dce3c011bf (diff)
downloadnasm-87225da76d87bfe388f8a772bf5419fb82306f67.tar.gz
nasm-87225da76d87bfe388f8a772bf5419fb82306f67.tar.bz2
nasm-87225da76d87bfe388f8a772bf5419fb82306f67.zip
nasmlib: Add list_last helper
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Diffstat (limited to 'nasmlib.h')
-rw-r--r--nasmlib.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/nasmlib.h b/nasmlib.h
index e571159..4d67e8b 100644
--- a/nasmlib.h
+++ b/nasmlib.h
@@ -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