diff options
Diffstat (limited to 'lstate.c')
-rw-r--r-- | lstate.c | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -190,14 +190,15 @@ void luaE_freeCI (lua_State *L) { | |||
190 | */ | 190 | */ |
191 | void luaE_shrinkCI (lua_State *L) { | 191 | void luaE_shrinkCI (lua_State *L) { |
192 | CallInfo *ci = L->ci; | 192 | CallInfo *ci = L->ci; |
193 | CallInfo *next; | ||
193 | CallInfo *next2; /* next's next */ | 194 | CallInfo *next2; /* next's next */ |
194 | L->nCcalls += L->nci; /* add removed elements back to 'nCcalls' */ | 195 | L->nCcalls += L->nci; /* add removed elements back to 'nCcalls' */ |
195 | /* while there are two nexts */ | 196 | /* while there are two nexts */ |
196 | while (ci->next != NULL && (next2 = ci->next->next) != NULL) { | 197 | while ((next = ci->next) != NULL && (next2 = next->next) != NULL) { |
197 | luaM_free(L, ci->next); /* free next */ | 198 | ci->next = next2; /* remove next from the list */ |
198 | L->nci--; | ||
199 | ci->next = next2; /* remove 'next' from the list */ | ||
200 | next2->previous = ci; | 199 | next2->previous = ci; |
200 | luaM_free(L, next); /* free next */ | ||
201 | L->nci--; | ||
201 | ci = next2; /* keep next's next */ | 202 | ci = next2; /* keep next's next */ |
202 | } | 203 | } |
203 | L->nCcalls -= L->nci; /* adjust result */ | 204 | L->nCcalls -= L->nci; /* adjust result */ |