Browse Source

'luaM_freearray' does not need array type as argument

Roberto Ierusalimschy 16 years ago
parent
commit
c6b442bd36
5 changed files with 18 additions and 18 deletions
  1. 7 7
      lfunc.c
  2. 2 2
      lmem.h
  3. 3 3
      lstate.c
  4. 2 2
      lstring.c
  5. 4 4
      ltable.c

+ 7 - 7
lfunc.c

@@ -1,5 +1,5 @@
 /*
-** $Id: lfunc.c,v 2.12 2005/12/22 16:19:56 roberto Exp roberto $
+** $Id: lfunc.c,v 2.13 2007/02/07 17:48:52 roberto Exp roberto $
 ** Auxiliary functions to manipulate prototypes and closures
 ** See Copyright Notice in lua.h
 */
@@ -139,12 +139,12 @@ Proto *luaF_newproto (lua_State *L) {
 
 
 void luaF_freeproto (lua_State *L, Proto *f) {
-  luaM_freearray(L, f->code, f->sizecode, Instruction);
-  luaM_freearray(L, f->p, f->sizep, Proto *);
-  luaM_freearray(L, f->k, f->sizek, TValue);
-  luaM_freearray(L, f->lineinfo, f->sizelineinfo, int);
-  luaM_freearray(L, f->locvars, f->sizelocvars, struct LocVar);
-  luaM_freearray(L, f->upvalues, f->sizeupvalues, TString *);
+  luaM_freearray(L, f->code, f->sizecode);
+  luaM_freearray(L, f->p, f->sizep);
+  luaM_freearray(L, f->k, f->sizek);
+  luaM_freearray(L, f->lineinfo, f->sizelineinfo);
+  luaM_freearray(L, f->locvars, f->sizelocvars);
+  luaM_freearray(L, f->upvalues, f->sizeupvalues);
   luaM_free(L, f);
 }
 

+ 2 - 2
lmem.h

@@ -1,5 +1,5 @@
 /*
-** $Id: lmem.h,v 1.32 2006/09/14 18:42:28 roberto Exp roberto $
+** $Id: lmem.h,v 1.33 2007/02/09 13:04:52 roberto Exp roberto $
 ** Interface to Memory Manager
 ** See Copyright Notice in lua.h
 */
@@ -23,7 +23,7 @@
 
 #define luaM_freemem(L, b, s)	luaM_realloc_(L, (b), (s), 0)
 #define luaM_free(L, b)		luaM_realloc_(L, (b), sizeof(*(b)), 0)
-#define luaM_freearray(L, b, n, t)   luaM_reallocv(L, (b), n, 0, sizeof(t))
+#define luaM_freearray(L, b, n)   luaM_reallocv(L, (b), n, 0, sizeof((b)[0]))
 
 #define luaM_malloc(L,t)	luaM_realloc_(L, NULL, 0, (t))
 #define luaM_new(L,t)		cast(t *, luaM_malloc(L, sizeof(t)))

+ 3 - 3
lstate.c

@@ -1,5 +1,5 @@
 /*
-** $Id: lstate.c,v 2.50 2009/03/10 17:14:37 roberto Exp roberto $
+** $Id: lstate.c,v 2.51 2009/04/17 14:28:06 roberto Exp roberto $
 ** Global State
 ** See Copyright Notice in lua.h
 */
@@ -93,7 +93,7 @@ static void freestack (lua_State *L) {
   L->ci = &L->base_ci;  /* reset 'ci' list */
   luaE_freeCI(L);
   lua_assert(L->nci == 0);
-  luaM_freearray(L, L->stack, L->stacksize, TValue);
+  luaM_freearray(L, L->stack, L->stacksize);
 }
 
 
@@ -140,7 +140,7 @@ static void close_state (lua_State *L) {
   global_State *g = G(L);
   luaF_close(L, L->stack);  /* close all upvalues for this thread */
   luaC_freeall(L);  /* collect all objects */
-  luaM_freearray(L, G(L)->strt.hash, G(L)->strt.size, TString *);
+  luaM_freearray(L, G(L)->strt.hash, G(L)->strt.size);
   luaZ_freebuffer(L, &g->buff);
   freestack(L);
   lua_assert(g->totalbytes == sizeof(LG));

+ 2 - 2
lstring.c

@@ -1,5 +1,5 @@
 /*
-** $Id: lstring.c,v 2.10 2007/11/09 18:55:07 roberto Exp roberto $
+** $Id: lstring.c,v 2.11 2008/02/19 18:55:09 roberto Exp roberto $
 ** String table (keeps all strings handled by Lua)
 ** See Copyright Notice in lua.h
 */
@@ -41,7 +41,7 @@ void luaS_resize (lua_State *L, int newsize) {
       p = next;
     }
   }
-  luaM_freearray(L, tb->hash, tb->size, TString *);
+  luaM_freearray(L, tb->hash, tb->size);
   tb->size = newsize;
   tb->hash = newhash;
 }

+ 4 - 4
ltable.c

@@ -1,5 +1,5 @@
 /*
-** $Id: ltable.c,v 2.38 2008/01/30 18:05:23 roberto Exp roberto $
+** $Id: ltable.c,v 2.39 2009/03/30 18:38:24 roberto Exp roberto $
 ** Lua tables (hash)
 ** See Copyright Notice in lua.h
 */
@@ -320,7 +320,7 @@ void luaH_resize (lua_State *L, Table *t, int nasize, int nhsize) {
       setobjt2t(L, luaH_set(L, t, key2tval(old)), gval(old));
   }
   if (nold != dummynode)
-    luaM_freearray(L, nold, twoto(oldhsize), Node);  /* free old array */
+    luaM_freearray(L, nold, twoto(oldhsize));  /* free old array */
 }
 
 
@@ -369,8 +369,8 @@ Table *luaH_new (lua_State *L) {
 
 void luaH_free (lua_State *L, Table *t) {
   if (t->node != dummynode)
-    luaM_freearray(L, t->node, sizenode(t), Node);
-  luaM_freearray(L, t->array, t->sizearray, TValue);
+    luaM_freearray(L, t->node, sizenode(t));
+  luaM_freearray(L, t->array, t->sizearray);
   luaM_free(L, t);
 }