From af0a0c2c031e3cee6ab96b3e7a5367f4d84e3db1 Mon Sep 17 00:00:00 2001 From: rlar Date: Tue, 31 Jul 2012 20:39:48 +0200 Subject: [PATCH] lexical #9/19, aproach the `append' cw has never been NULL here, because we used to survive an update of cw->wl_next here wlist hasn't been NULL either, because there is no place where wlist becomes NULL without setting cw to NULL as well. yet cw isn't NULL (see above) aproach the `append' --- src/frontend/parser/lexical.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/frontend/parser/lexical.c b/src/frontend/parser/lexical.c index efa07d3d2..ecea8fd3b 100644 --- a/src/frontend/parser/lexical.c +++ b/src/frontend/parser/lexical.c @@ -75,9 +75,14 @@ static int numeofs = 0; */ #define newword cw->wl_word = copy(buf); \ - cw->wl_next = wl_cons(NULL, NULL); \ - cw->wl_next->wl_prev = cw; \ - cw = cw->wl_next; \ + { wordlist *aux = wl_cons(NULL, NULL); \ + if (cw) /* which is true here */ \ + cw->wl_next = aux; \ + aux->wl_prev = cw; \ + cw = aux; \ + if (!wlist) /* which is false here */ \ + wlist = cw; \ + } \ bzero(buf, NEW_BSIZE_SP); \ i = 0;