diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2005-04-25 16:24:10 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2005-04-25 16:24:10 -0300 |
| commit | 8718fda9b24fa148ffe1a06fb36a7aa2ed628bdc (patch) | |
| tree | 4ad0b914b84005b706fb6c9af302132d789b133a /lmem.h | |
| parent | 8c3c3e769195facf6b8c061f4fab1d86e6606be8 (diff) | |
| download | lua-8718fda9b24fa148ffe1a06fb36a7aa2ed628bdc.tar.gz lua-8718fda9b24fa148ffe1a06fb36a7aa2ed628bdc.tar.bz2 lua-8718fda9b24fa148ffe1a06fb36a7aa2ed628bdc.zip | |
added LUAI_FUNC to functions not in the API
Diffstat (limited to 'lmem.h')
| -rw-r--r-- | lmem.h | 17 |
1 files changed, 8 insertions, 9 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lmem.h,v 1.29 2004/12/01 15:46:18 roberto Exp roberto $ | 2 | ** $Id: lmem.h,v 1.30 2005/03/18 16:38:02 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 | */ |
| @@ -16,19 +16,11 @@ | |||
| 16 | #define MEMERRMSG "not enough memory" | 16 | #define MEMERRMSG "not enough memory" |
| 17 | 17 | ||
| 18 | 18 | ||
| 19 | void *luaM_realloc_ (lua_State *L, void *block, size_t oldsize, size_t size); | ||
| 20 | |||
| 21 | void *luaM_toobig (lua_State *L); | ||
| 22 | |||
| 23 | #define luaM_reallocv(L,b,on,n,e) \ | 19 | #define luaM_reallocv(L,b,on,n,e) \ |
| 24 | ((cast(size_t, (n)+1) <= MAX_SIZET/(e)) ? /* +1 to avoid warnings */ \ | 20 | ((cast(size_t, (n)+1) <= MAX_SIZET/(e)) ? /* +1 to avoid warnings */ \ |
| 25 | luaM_realloc_(L, (b), (on)*(e), (n)*(e)) : \ | 21 | luaM_realloc_(L, (b), (on)*(e), (n)*(e)) : \ |
| 26 | luaM_toobig(L)) | 22 | luaM_toobig(L)) |
| 27 | 23 | ||
| 28 | |||
| 29 | void *luaM_growaux_ (lua_State *L, void *block, int *size, size_t size_elem, | ||
| 30 | int limit, const char *errormsg); | ||
| 31 | |||
| 32 | #define luaM_freemem(L, b, s) luaM_realloc_(L, (b), (s), 0) | 24 | #define luaM_freemem(L, b, s) luaM_realloc_(L, (b), (s), 0) |
| 33 | #define luaM_free(L, b) luaM_realloc_(L, (b), sizeof(*(b)), 0) | 25 | #define luaM_free(L, b) luaM_realloc_(L, (b), sizeof(*(b)), 0) |
| 34 | #define luaM_freearray(L, b, n, t) luaM_reallocv(L, (b), n, 0, sizeof(t)) | 26 | #define luaM_freearray(L, b, n, t) luaM_reallocv(L, (b), n, 0, sizeof(t)) |
| @@ -46,5 +38,12 @@ void *luaM_growaux_ (lua_State *L, void *block, int *size, size_t size_elem, | |||
| 46 | ((v)=cast(t *, luaM_reallocv(L, v, oldn, n, sizeof(t)))) | 38 | ((v)=cast(t *, luaM_reallocv(L, v, oldn, n, sizeof(t)))) |
| 47 | 39 | ||
| 48 | 40 | ||
| 41 | LUAI_FUNC void *luaM_realloc_ (lua_State *L, void *block, size_t oldsize, | ||
| 42 | size_t size); | ||
| 43 | LUAI_FUNC void *luaM_toobig (lua_State *L); | ||
| 44 | LUAI_FUNC void *luaM_growaux_ (lua_State *L, void *block, int *size, | ||
| 45 | size_t size_elem, int limit, | ||
| 46 | const char *errormsg); | ||
| 47 | |||
| 49 | #endif | 48 | #endif |
| 50 | 49 | ||
