fix the fix wl_reverse() for empty lists

This commit is contained in:
rlar 2012-07-15 19:42:09 +02:00
parent a890a55937
commit 2b859633a1
1 changed files with 6 additions and 3 deletions

View File

@ -155,14 +155,17 @@ wl_append(wordlist *wlist, wordlist *nwl)
wordlist *
wl_reverse(wordlist *wl)
{
while (wl) {
if (!wl)
return wl;
for (;;) {
wordlist *t = wl->wl_next;
wl->wl_next = wl->wl_prev;
wl->wl_prev = t;
if (!t)
return wl;
wl = t;
}
return wl;
}