From 17dbaa8639505c9ad1a9946591f5960123fbd741 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Fri, 22 May 2020 11:40:34 -0300 Subject: Improvements in the handling of signals Added 'volatile' to 'l_signalT' variables plus some minor changes. --- lstate.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'lstate.c') diff --git a/lstate.c b/lstate.c index 8fba70d7..42a48436 100644 --- a/lstate.c +++ b/lstate.c @@ -190,14 +190,15 @@ void luaE_freeCI (lua_State *L) { */ void luaE_shrinkCI (lua_State *L) { CallInfo *ci = L->ci; + CallInfo *next; CallInfo *next2; /* next's next */ L->nCcalls += L->nci; /* add removed elements back to 'nCcalls' */ /* while there are two nexts */ - while (ci->next != NULL && (next2 = ci->next->next) != NULL) { - luaM_free(L, ci->next); /* free next */ - L->nci--; - ci->next = next2; /* remove 'next' from the list */ + while ((next = ci->next) != NULL && (next2 = next->next) != NULL) { + ci->next = next2; /* remove next from the list */ next2->previous = ci; + luaM_free(L, next); /* free next */ + L->nci--; ci = next2; /* keep next's next */ } L->nCcalls -= L->nci; /* adjust result */ -- cgit v1.2.3-55-g6feb