diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1996-03-14 12:55:49 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1996-03-14 12:55:49 -0300 |
| commit | 7236df875aa62e3e217e676365738ae5a0308a9b (patch) | |
| tree | 433387dc47bc099b32cb79e36f032862d7a47bc8 /luamem.c | |
| parent | 675e608325ace43e4350bcde8cfb6ec93b46788f (diff) | |
| download | lua-7236df875aa62e3e217e676365738ae5a0308a9b.tar.gz lua-7236df875aa62e3e217e676365738ae5a0308a9b.tar.bz2 lua-7236df875aa62e3e217e676365738ae5a0308a9b.zip | |
new function "luaI_buffer".
Diffstat (limited to 'luamem.c')
| -rw-r--r-- | luamem.c | 12 |
1 files changed, 11 insertions, 1 deletions
| @@ -3,7 +3,7 @@ | |||
| 3 | ** TecCGraf - PUC-Rio | 3 | ** TecCGraf - PUC-Rio |
| 4 | */ | 4 | */ |
| 5 | 5 | ||
| 6 | char *rcs_mem = "$Id: mem.c,v 1.7 1996/02/04 16:59:12 roberto Exp roberto $"; | 6 | char *rcs_mem = "$Id: mem.c,v 1.8 1996/02/22 20:34:33 roberto Exp roberto $"; |
| 7 | 7 | ||
| 8 | #include <stdlib.h> | 8 | #include <stdlib.h> |
| 9 | #include <string.h> | 9 | #include <string.h> |
| @@ -53,3 +53,13 @@ void *luaI_realloc (void *oldblock, unsigned long size) | |||
| 53 | return block; | 53 | return block; |
| 54 | } | 54 | } |
| 55 | 55 | ||
| 56 | |||
| 57 | void* luaI_buffer (unsigned long size) | ||
| 58 | { | ||
| 59 | static unsigned long buffsize = 0; | ||
| 60 | static char* buffer = NULL; | ||
| 61 | if (size > buffsize) | ||
| 62 | buffer = luaI_realloc(buffer, buffsize=size); | ||
| 63 | return buffer; | ||
| 64 | } | ||
| 65 | |||
