aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2001-11-06 19:40:51 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2001-11-06 19:40:51 -0200
commit617008f5521030d0a99432efda5af0ef705f25c9 (patch)
tree99b6b411a25aad6ee83b293e63ad85d70cb30348
parentec9d8308b43cb468261f78fc4da6bd524c347db3 (diff)
downloadlua-617008f5521030d0a99432efda5af0ef705f25c9.tar.gz
lua-617008f5521030d0a99432efda5af0ef705f25c9.tar.bz2
lua-617008f5521030d0a99432efda5af0ef705f25c9.zip
field G renamed to _G to avoid problemas with bugged macro-systems
(there is a macro named G too)
-rw-r--r--lstate.c10
-rw-r--r--lstate.h8
2 files changed, 9 insertions, 9 deletions
diff --git a/lstate.c b/lstate.c
index 98190c22..40b3dc27 100644
--- a/lstate.c
+++ b/lstate.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lstate.c,v 1.70 2001/10/25 19:14:14 roberto Exp roberto $ 2** $Id: lstate.c,v 1.71 2001/10/31 19:58:11 roberto Exp $
3** Global State 3** Global State
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -39,7 +39,7 @@ static void f_luaopen (lua_State *L, void *ud) {
39 else 39 else
40 so->stacksize += LUA_MINSTACK; 40 so->stacksize += LUA_MINSTACK;
41 if (so->L != NULL) { /* shared global state? */ 41 if (so->L != NULL) { /* shared global state? */
42 L->G = G(so->L); 42 L->_G = G(so->L);
43 L->gt = so->L->gt; /* share table of globals */ 43 L->gt = so->L->gt; /* share table of globals */
44 so->L->next->previous = L; /* insert L into linked list */ 44 so->L->next->previous = L; /* insert L into linked list */
45 L->next = so->L->next; 45 L->next = so->L->next;
@@ -48,7 +48,7 @@ static void f_luaopen (lua_State *L, void *ud) {
48 luaD_init(L, so->stacksize); /* init stack */ 48 luaD_init(L, so->stacksize); /* init stack */
49 } 49 }
50 else { /* create a new global state */ 50 else { /* create a new global state */
51 L->G = luaM_new(L, global_State); 51 L->_G = luaM_new(L, global_State);
52 G(L)->strt.size = 0; 52 G(L)->strt.size = 0;
53 G(L)->strt.nuse = 0; 53 G(L)->strt.nuse = 0;
54 G(L)->strt.hash = NULL; 54 G(L)->strt.hash = NULL;
@@ -81,7 +81,7 @@ LUA_API lua_State *lua_newthread (lua_State *OL, int stacksize) {
81 if (OL) lua_lock(OL); 81 if (OL) lua_lock(OL);
82 L = luaM_new(OL, lua_State); 82 L = luaM_new(OL, lua_State);
83 if (L) { /* allocation OK? */ 83 if (L) { /* allocation OK? */
84 L->G = NULL; 84 L->_G = NULL;
85 L->stack = NULL; 85 L->stack = NULL;
86 L->stacksize = 0; 86 L->stacksize = 0;
87 L->ci = &L->basefunc; 87 L->ci = &L->basefunc;
@@ -121,7 +121,7 @@ static void close_state (lua_State *L, lua_State *OL) {
121 luaS_freeall(L); 121 luaS_freeall(L);
122 luaM_freearray(L, G(L)->TMtable, G(L)->sizeTM, struct TM); 122 luaM_freearray(L, G(L)->TMtable, G(L)->sizeTM, struct TM);
123 luaM_freearray(L, G(L)->Mbuffer, G(L)->Mbuffsize, l_char); 123 luaM_freearray(L, G(L)->Mbuffer, G(L)->Mbuffsize, l_char);
124 luaM_freelem(NULL, L->G); 124 luaM_freelem(NULL, L->_G);
125 } 125 }
126 luaM_freearray(OL, L->stack, L->stacksize, TObject); 126 luaM_freearray(OL, L->stack, L->stacksize, TObject);
127 luaM_freelem(OL, L); 127 luaM_freelem(OL, L);
diff --git a/lstate.h b/lstate.h
index 4b4c60e7..9f7c7e5c 100644
--- a/lstate.h
+++ b/lstate.h
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lstate.h,v 1.62 2001/10/25 19:12:21 roberto Exp roberto $ 2** $Id: lstate.h,v 1.63 2001/10/31 19:58:11 roberto Exp $
3** Global State 3** Global State
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -68,7 +68,7 @@ typedef struct global_State {
68 Closure *rootcl; /* list of all C closures and closed Lua closures */ 68 Closure *rootcl; /* list of all C closures and closed Lua closures */
69 Table *roottable; /* list of all tables */ 69 Table *roottable; /* list of all tables */
70 Udata *rootudata; /* list of all userdata */ 70 Udata *rootudata; /* list of all userdata */
71 UpVal *rootupval; /* list of all up values */ 71 TObject *rootupval; /* list of all up values */
72} global_State; 72} global_State;
73 73
74 74
@@ -81,7 +81,7 @@ struct lua_State {
81 CallInfo *ci; /* call info for current function */ 81 CallInfo *ci; /* call info for current function */
82 StkId stack_last; /* last free slot in the stack */ 82 StkId stack_last; /* last free slot in the stack */
83 TObject gt; /* table for globals */ 83 TObject gt; /* table for globals */
84 global_State *G; 84 global_State *_G;
85 StkId stack; /* stack base */ 85 StkId stack; /* stack base */
86 int stacksize; 86 int stacksize;
87 lua_Hook callhook; 87 lua_Hook callhook;
@@ -95,7 +95,7 @@ struct lua_State {
95}; 95};
96 96
97 97
98#define G(L) (L->G) 98#define G(L) (L->_G)
99 99
100 100
101#endif 101#endif