aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2015-11-13 10:16:51 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2015-11-13 10:16:51 -0200
commit89e3a843442679252773a29114c8552e3f59777d (patch)
tree74c9bcfd5d2f3c877877c20654fd33e9f3825c1d
parent04587b62562f246e89d1b138bed5b90ee4bdfe69 (diff)
downloadlua-89e3a843442679252773a29114c8552e3f59777d.tar.gz
lua-89e3a843442679252773a29114c8552e3f59777d.tar.bz2
lua-89e3a843442679252773a29114c8552e3f59777d.zip
removed field 'n' from 'CallInfo' (not being used right now)
-rw-r--r--lstate.c25
-rw-r--r--lstate.h3
2 files changed, 12 insertions, 16 deletions
diff --git a/lstate.c b/lstate.c
index 4d6fcc1b..11299d37 100644
--- a/lstate.c
+++ b/lstate.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lstate.c,v 2.131 2015/10/20 13:11:05 roberto Exp roberto $ 2** $Id: lstate.c,v 2.132 2015/11/02 16:01:41 roberto Exp roberto $
3** Global State 3** Global State
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -111,7 +111,7 @@ CallInfo *luaE_extendCI (lua_State *L) {
111 L->ci->next = ci; 111 L->ci->next = ci;
112 ci->previous = L->ci; 112 ci->previous = L->ci;
113 ci->next = NULL; 113 ci->next = NULL;
114 ci->n = ++L->nci; 114 L->nci++;
115 return ci; 115 return ci;
116} 116}
117 117
@@ -126,8 +126,8 @@ void luaE_freeCI (lua_State *L) {
126 while ((ci = next) != NULL) { 126 while ((ci = next) != NULL) {
127 next = ci->next; 127 next = ci->next;
128 luaM_free(L, ci); 128 luaM_free(L, ci);
129 L->nci--;
129 } 130 }
130 L->nci = L->ci->n;
131} 131}
132 132
133 133
@@ -136,17 +136,15 @@ void luaE_freeCI (lua_State *L) {
136*/ 136*/
137void luaE_shrinkCI (lua_State *L) { 137void luaE_shrinkCI (lua_State *L) {
138 CallInfo *ci = L->ci; 138 CallInfo *ci = L->ci;
139 CallInfo *next; 139 CallInfo *next2; /* next's next */
140 int n = (L->nci - ci->n + 1)/2; /* number of entries to be preserved */ 140 /* while there are two nexts */
141 for (; n > 0; n--) 141 while (ci->next != NULL && (next2 = ci->next->next) != NULL) {
142 ci = ci->next; /* skip items to be preserved */ 142 luaM_free(L, ci->next); /* free next */
143 lua_assert(n == 0); 143 L->nci--;
144 while ((next = ci->next) != NULL) { /* remove all other items */ 144 ci->next = next2; /* remove 'next' from the list */
145 ci->next = next->next; 145 next2->previous = ci;
146 luaM_free(L, next); /* remove item */ 146 ci = next2; /* keep next's next */
147 n++; /* count number of removed items */
148 } 147 }
149 L->nci -= n;
150} 148}
151 149
152 150
@@ -161,7 +159,6 @@ static void stack_init (lua_State *L1, lua_State *L) {
161 L1->stack_last = L1->stack + L1->stacksize - EXTRA_STACK; 159 L1->stack_last = L1->stack + L1->stacksize - EXTRA_STACK;
162 /* initialize first ci */ 160 /* initialize first ci */
163 ci = &L1->base_ci; 161 ci = &L1->base_ci;
164 ci->n = 0;
165 ci->next = ci->previous = NULL; 162 ci->next = ci->previous = NULL;
166 ci->callstatus = 0; 163 ci->callstatus = 0;
167 ci->func = L1->top; 164 ci->func = L1->top;
diff --git a/lstate.h b/lstate.h
index 4b4577e2..b5ac89c2 100644
--- a/lstate.h
+++ b/lstate.h
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lstate.h,v 2.126 2015/11/02 11:43:17 roberto Exp roberto $ 2** $Id: lstate.h,v 2.127 2015/11/02 16:01:41 roberto Exp roberto $
3** Global State 3** Global State
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -78,7 +78,6 @@ typedef struct CallInfo {
78 } c; 78 } c;
79 } u; 79 } u;
80 ptrdiff_t extra; 80 ptrdiff_t extra;
81 unsigned short n; /* ordinal number in call list */
82 short nresults; /* expected number of results from this function */ 81 short nresults; /* expected number of results from this function */
83 lu_byte callstatus; 82 lu_byte callstatus;
84} CallInfo; 83} CallInfo;