aboutsummaryrefslogtreecommitdiff
path: root/ldo.c
diff options
context:
space:
mode:
Diffstat (limited to 'ldo.c')
-rw-r--r--ldo.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/ldo.c b/ldo.c
index 2f20dd33..9f3b7af1 100644
--- a/ldo.c
+++ b/ldo.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ldo.c,v 1.34 1999/02/22 14:17:24 roberto Exp roberto $ 2** $Id: ldo.c,v 1.35 1999/02/22 19:23:36 roberto Exp roberto $
3** Stack and Call structure of Lua 3** Stack and Call structure of Lua
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -43,13 +43,12 @@ void luaD_init (void) {
43} 43}
44 44
45 45
46void luaD_checkstack (int n) 46void luaD_checkstack (int n) {
47{
48 struct Stack *S = &L->stack; 47 struct Stack *S = &L->stack;
49 if (S->last-S->top <= n) { 48 if (S->last-S->top <= n) {
50 StkId top = S->top-S->stack; 49 StkId top = S->top-S->stack;
51 int stacksize = (S->last-S->stack)+1+STACK_UNIT+n; 50 int stacksize = (S->last-S->stack)+STACK_UNIT+n;
52 S->stack = luaM_reallocvector(S->stack, stacksize, TObject); 51 luaM_reallocvector(S->stack, stacksize, TObject);
53 S->last = S->stack+(stacksize-1); 52 S->last = S->stack+(stacksize-1);
54 S->top = S->stack + top; 53 S->top = S->stack + top;
55 if (stacksize >= STACK_LIMIT) { /* stack overflow? */ 54 if (stacksize >= STACK_LIMIT) { /* stack overflow? */
@@ -65,8 +64,7 @@ void luaD_checkstack (int n)
65/* 64/*
66** Adjust stack. Set top to the given value, pushing NILs if needed. 65** Adjust stack. Set top to the given value, pushing NILs if needed.
67*/ 66*/
68void luaD_adjusttop (StkId newtop) 67void luaD_adjusttop (StkId newtop) {
69{
70 int diff = newtop-(L->stack.top-L->stack.stack); 68 int diff = newtop-(L->stack.top-L->stack.stack);
71 if (diff <= 0) 69 if (diff <= 0)
72 L->stack.top += diff; 70 L->stack.top += diff;