summaryrefslogtreecommitdiff
path: root/luamem.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>1994-11-16 15:39:16 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>1994-11-16 15:39:16 -0200
commit2b5bc5d1a81579a76c13e638de2592e2c39c73f0 (patch)
tree8294278f9fbd2565d3a2cd11642fed41982824bd /luamem.c
parent94686ce58554a80374eeff115ee5b87c184ed173 (diff)
downloadlua-2b5bc5d1a81579a76c13e638de2592e2c39c73f0.tar.gz
lua-2b5bc5d1a81579a76c13e638de2592e2c39c73f0.tar.bz2
lua-2b5bc5d1a81579a76c13e638de2592e2c39c73f0.zip
new module for memory allocation
Diffstat (limited to 'luamem.c')
-rw-r--r--luamem.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/luamem.c b/luamem.c
new file mode 100644
index 00000000..ddbd5e47
--- /dev/null
+++ b/luamem.c
@@ -0,0 +1,35 @@
1/*
2** mem.c
3** TecCGraf - PUC-Rio
4*/
5
6char *rcs_mem = "$Id: $";
7
8#include <stdlib.h>
9
10#include "mem.h"
11#include "lua.h"
12
13void luaI_free (void *block)
14{
15 free(block);
16}
17
18
19void *luaI_malloc (unsigned long size)
20{
21 void *block = malloc(size);
22 if (block == NULL)
23 lua_error("not enough memory");
24 return block;
25}
26
27
28void *luaI_realloc (void *oldblock, unsigned long size)
29{
30 void *block = realloc(oldblock, size);
31 if (block == NULL)
32 lua_error("not enough memory");
33 return block;
34}
35