mirror of
https://github.com/lua/lua
synced 2025-01-26 02:52:03 +03:00
field G renamed to _G to avoid problemas with bugged macro-systems
(there is a macro named G too)
This commit is contained in:
parent
ec9d8308b4
commit
617008f552
10
lstate.c
10
lstate.c
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
** $Id: lstate.c,v 1.70 2001/10/25 19:14:14 roberto Exp roberto $
|
** $Id: lstate.c,v 1.71 2001/10/31 19:58:11 roberto Exp $
|
||||||
** Global State
|
** Global State
|
||||||
** See Copyright Notice in lua.h
|
** See Copyright Notice in lua.h
|
||||||
*/
|
*/
|
||||||
@ -39,7 +39,7 @@ static void f_luaopen (lua_State *L, void *ud) {
|
|||||||
else
|
else
|
||||||
so->stacksize += LUA_MINSTACK;
|
so->stacksize += LUA_MINSTACK;
|
||||||
if (so->L != NULL) { /* shared global state? */
|
if (so->L != NULL) { /* shared global state? */
|
||||||
L->G = G(so->L);
|
L->_G = G(so->L);
|
||||||
L->gt = so->L->gt; /* share table of globals */
|
L->gt = so->L->gt; /* share table of globals */
|
||||||
so->L->next->previous = L; /* insert L into linked list */
|
so->L->next->previous = L; /* insert L into linked list */
|
||||||
L->next = so->L->next;
|
L->next = so->L->next;
|
||||||
@ -48,7 +48,7 @@ static void f_luaopen (lua_State *L, void *ud) {
|
|||||||
luaD_init(L, so->stacksize); /* init stack */
|
luaD_init(L, so->stacksize); /* init stack */
|
||||||
}
|
}
|
||||||
else { /* create a new global state */
|
else { /* create a new global state */
|
||||||
L->G = luaM_new(L, global_State);
|
L->_G = luaM_new(L, global_State);
|
||||||
G(L)->strt.size = 0;
|
G(L)->strt.size = 0;
|
||||||
G(L)->strt.nuse = 0;
|
G(L)->strt.nuse = 0;
|
||||||
G(L)->strt.hash = NULL;
|
G(L)->strt.hash = NULL;
|
||||||
@ -81,7 +81,7 @@ LUA_API lua_State *lua_newthread (lua_State *OL, int stacksize) {
|
|||||||
if (OL) lua_lock(OL);
|
if (OL) lua_lock(OL);
|
||||||
L = luaM_new(OL, lua_State);
|
L = luaM_new(OL, lua_State);
|
||||||
if (L) { /* allocation OK? */
|
if (L) { /* allocation OK? */
|
||||||
L->G = NULL;
|
L->_G = NULL;
|
||||||
L->stack = NULL;
|
L->stack = NULL;
|
||||||
L->stacksize = 0;
|
L->stacksize = 0;
|
||||||
L->ci = &L->basefunc;
|
L->ci = &L->basefunc;
|
||||||
@ -121,7 +121,7 @@ static void close_state (lua_State *L, lua_State *OL) {
|
|||||||
luaS_freeall(L);
|
luaS_freeall(L);
|
||||||
luaM_freearray(L, G(L)->TMtable, G(L)->sizeTM, struct TM);
|
luaM_freearray(L, G(L)->TMtable, G(L)->sizeTM, struct TM);
|
||||||
luaM_freearray(L, G(L)->Mbuffer, G(L)->Mbuffsize, l_char);
|
luaM_freearray(L, G(L)->Mbuffer, G(L)->Mbuffsize, l_char);
|
||||||
luaM_freelem(NULL, L->G);
|
luaM_freelem(NULL, L->_G);
|
||||||
}
|
}
|
||||||
luaM_freearray(OL, L->stack, L->stacksize, TObject);
|
luaM_freearray(OL, L->stack, L->stacksize, TObject);
|
||||||
luaM_freelem(OL, L);
|
luaM_freelem(OL, L);
|
||||||
|
8
lstate.h
8
lstate.h
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
** $Id: lstate.h,v 1.62 2001/10/25 19:12:21 roberto Exp roberto $
|
** $Id: lstate.h,v 1.63 2001/10/31 19:58:11 roberto Exp $
|
||||||
** Global State
|
** Global State
|
||||||
** See Copyright Notice in lua.h
|
** See Copyright Notice in lua.h
|
||||||
*/
|
*/
|
||||||
@ -68,7 +68,7 @@ typedef struct global_State {
|
|||||||
Closure *rootcl; /* list of all C closures and closed Lua closures */
|
Closure *rootcl; /* list of all C closures and closed Lua closures */
|
||||||
Table *roottable; /* list of all tables */
|
Table *roottable; /* list of all tables */
|
||||||
Udata *rootudata; /* list of all userdata */
|
Udata *rootudata; /* list of all userdata */
|
||||||
UpVal *rootupval; /* list of all up values */
|
TObject *rootupval; /* list of all up values */
|
||||||
} global_State;
|
} global_State;
|
||||||
|
|
||||||
|
|
||||||
@ -81,7 +81,7 @@ struct lua_State {
|
|||||||
CallInfo *ci; /* call info for current function */
|
CallInfo *ci; /* call info for current function */
|
||||||
StkId stack_last; /* last free slot in the stack */
|
StkId stack_last; /* last free slot in the stack */
|
||||||
TObject gt; /* table for globals */
|
TObject gt; /* table for globals */
|
||||||
global_State *G;
|
global_State *_G;
|
||||||
StkId stack; /* stack base */
|
StkId stack; /* stack base */
|
||||||
int stacksize;
|
int stacksize;
|
||||||
lua_Hook callhook;
|
lua_Hook callhook;
|
||||||
@ -95,7 +95,7 @@ struct lua_State {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#define G(L) (L->G)
|
#define G(L) (L->_G)
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user