about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/lstate.c9
-rw-r--r--src/notes2
2 files changed, 5 insertions, 6 deletions
diff --git a/src/lstate.c b/src/lstate.c
index e9d8cae..26d76d9 100644
--- a/src/lstate.c
+++ b/src/lstate.c
@@ -24,7 +24,6 @@
 #include "ltm.h"
 
 
-#define state_size(x)	(sizeof(x))
 #define fromstate(l)	(cast(lu_byte *, (l)))
 #define tostate(l)   (cast(lua_State *, cast(lu_byte *, l)))
 
@@ -112,12 +111,12 @@ static void close_state (lua_State *L) {
   luaZ_freebuffer(L, &g->buff);
   freestack(L, L);
   lua_assert(g->totalbytes == sizeof(LG));
-  (*g->frealloc)(g->ud, fromstate(L), state_size(LG), 0);
+  (*g->frealloc)(g->ud, fromstate(L), sizeof(LG), 0);
 }
 
 
 lua_State *luaE_newthread (lua_State *L) {
-  lua_State *L1 = tostate(luaM_malloc(L, state_size(lua_State)));
+  lua_State *L1 = tostate(luaM_malloc(L, sizeof(lua_State)));
   luaC_link(L, obj2gco(L1), LUA_TTHREAD);
   preinit_state(L1, G(L));
   stack_init(L1, L);  /* init stack */
@@ -136,7 +135,7 @@ void luaE_freethread (lua_State *L, lua_State *L1) {
   lua_assert(L1->openupval == NULL);
   luai_userstatefree(L1);
   freestack(L, L1);
-  luaM_freemem(L, fromstate(L1), state_size(lua_State));
+  luaM_freemem(L, fromstate(L1), sizeof(lua_State));
 }
 
 
@@ -144,7 +143,7 @@ LUA_API lua_State *lua_newstate (lua_Alloc f, void *ud) {
   int i;
   lua_State *L;
   global_State *g;
-  void *l = (*f)(ud, NULL, 0, state_size(LG));
+  void *l = (*f)(ud, NULL, 0, sizeof(LG));
   if (l == NULL) return NULL;
   L = tostate(l);
   g = &((LG *)L)->g;
diff --git a/src/notes b/src/notes
index 213bba7..e13492c 100644
--- a/src/notes
+++ b/src/notes
@@ -8,7 +8,7 @@ lua_State:
   &{Value; int tt} stack, stack_last, base, top
 
 == todo stack
-delete statesize/from_state/to_state
+delete fromstate/tostate
 eradicate LUAI_EXTRASPACE
 lua_newstate
 lua_State's stack