** free half of the CallInfo structures not in use by a thread, ** keeping the first one. */
| 102 | ** keeping the first one. |
| 103 | */ |
| 104 | void luaE_shrinkCI (lua_State *L) { |
| 105 | CallInfo *ci = L->ci->next; /* first free CallInfo */ |
| 106 | CallInfo *next; |
| 107 | if (ci == NULL) |
| 108 | return; /* no extra elements */ |
| 109 | while ((next = ci->next) != NULL) { /* two extra elements? */ |
| 110 | CallInfo *next2 = next->next; /* next's next */ |
| 111 | ci->next = next2; /* remove next from the list */ |
| 112 | L->nci--; |
| 113 | luaM_free(L, next); /* free next */ |
| 114 | if (next2 == NULL) |
| 115 | break; /* no more elements */ |
| 116 | else { |
| 117 | next2->previous = ci; |
| 118 | ci = next2; /* continue */ |
| 119 | } |
| 120 | } |
| 121 | } |
| 122 | |
| 123 | |
| 124 | /* |