nasmlib: Add list_reverse helper

There is no way to make it as a helper function
for a while, we need to unify list processing
in general (ie to use abstract list type).

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
This commit is contained in:
Cyrill Gorcunov 2011-04-13 11:25:49 +04:00
parent 87225da76d
commit 396b5dfe95

View File

@ -258,6 +258,19 @@ void standard_extension(char *inname, char *outname, char *extension);
#define list_last(pos, head) \
for (pos = head; pos && pos->next; pos = pos->next) \
;
#define list_reverse(head, prev, next) \
do { \
if (!head || !head->next) \
break; \
prev = NULL; \
while (head) { \
next = head->next; \
head->next = prev; \
prev = head; \
head = next; \
} \
head = prev; \
} while (0)
/*
* Power of 2 align helpers