aboutsummaryrefslogtreecommitdiff
path: root/luamem.c
diff options
context:
space:
mode:
Diffstat (limited to 'luamem.c')
-rw-r--r--luamem.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/luamem.c b/luamem.c
index 9c0799b3..812da490 100644
--- a/luamem.c
+++ b/luamem.c
@@ -3,7 +3,7 @@
3** TecCGraf - PUC-Rio 3** TecCGraf - PUC-Rio
4*/ 4*/
5 5
6char *rcs_luamem = "$Id: luamem.c,v 1.15 1997/03/31 14:17:09 roberto Exp roberto $"; 6char *rcs_luamem = "$Id: luamem.c,v 1.16 1997/04/01 21:23:20 roberto Exp $";
7 7
8#include <stdlib.h> 8#include <stdlib.h>
9 9
@@ -15,7 +15,7 @@ char *rcs_luamem = "$Id: luamem.c,v 1.15 1997/03/31 14:17:09 roberto Exp roberto
15 15
16#if !DEBUG 16#if !DEBUG
17 17
18void luaI_free (void *block) 18static void lfree (void *block)
19{ 19{
20 if (block) 20 if (block)
21 { 21 {
@@ -31,6 +31,10 @@ void *luaI_realloc (void *oldblock, unsigned long size)
31 size_t s = (size_t)size; 31 size_t s = (size_t)size;
32 if (s != size) 32 if (s != size)
33 lua_error("Allocation Error: Block too big"); 33 lua_error("Allocation Error: Block too big");
34 if (size == 0) { /* ANSI doen't need this, but some machines... */
35 lfree(oldblock);
36 return NULL;
37 }
34 block = oldblock ? realloc(oldblock, s) : malloc(s); 38 block = oldblock ? realloc(oldblock, s) : malloc(s);
35 if (block == NULL) 39 if (block == NULL)
36 lua_error(memEM); 40 lua_error(memEM);