diff options
Diffstat (limited to 'lmem.c')
-rw-r--r-- | lmem.c | 18 |
1 files changed, 8 insertions, 10 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: $ | 2 | ** $Id: lmem.c,v 1.1 1997/09/16 19:25:59 roberto Exp roberto $ |
3 | ** Interface to Memory Manager | 3 | ** Interface to Memory Manager |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -8,6 +8,7 @@ | |||
8 | #include <stdlib.h> | 8 | #include <stdlib.h> |
9 | 9 | ||
10 | #include "lmem.h" | 10 | #include "lmem.h" |
11 | #include "lstate.h" | ||
11 | #include "lua.h" | 12 | #include "lua.h" |
12 | 13 | ||
13 | 14 | ||
@@ -25,24 +26,21 @@ int luaM_growaux (void **block, unsigned long nelems, int size, | |||
25 | } | 26 | } |
26 | 27 | ||
27 | 28 | ||
28 | static unsigned long Mbuffsize = 0; | ||
29 | static char *Mbuffer = NULL; | ||
30 | |||
31 | 29 | ||
32 | void *luaM_buffer (unsigned long size) | 30 | void *luaM_buffer (unsigned long size) |
33 | { | 31 | { |
34 | if (size > Mbuffsize) { | 32 | if (size > L->Mbuffsize) { |
35 | Mbuffsize = size; | 33 | L->Mbuffsize = size; |
36 | Mbuffer = luaM_realloc(Mbuffer, Mbuffsize); | 34 | L->Mbuffer = luaM_realloc(L->Mbuffer, L->Mbuffsize); |
37 | } | 35 | } |
38 | return Mbuffer; | 36 | return L->Mbuffer; |
39 | } | 37 | } |
40 | 38 | ||
41 | 39 | ||
42 | void luaM_clearbuffer (void) | 40 | void luaM_clearbuffer (void) |
43 | { | 41 | { |
44 | Mbuffsize /= 2; | 42 | L->Mbuffsize /= 2; |
45 | Mbuffer = luaM_realloc(Mbuffer, Mbuffsize); | 43 | L->Mbuffer = luaM_realloc(L->Mbuffer, L->Mbuffsize); |
46 | } | 44 | } |
47 | 45 | ||
48 | 46 | ||