diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2015-03-06 16:45:54 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2015-03-06 16:45:54 -0300 |
commit | bb4baa73ea85c0fd49ab2ab96f0f174cd131830a (patch) | |
tree | 32025750dc6d6741a5a6e2f6ee5f1d8acdc0a8bc /lmem.c | |
parent | d7d44b038dcdbd4b8f8261c6a9a02ec05c0ea0ec (diff) | |
download | lua-bb4baa73ea85c0fd49ab2ab96f0f174cd131830a.tar.gz lua-bb4baa73ea85c0fd49ab2ab96f0f174cd131830a.tar.bz2 lua-bb4baa73ea85c0fd49ab2ab96f0f174cd131830a.zip |
allocation function is not exactly API (and cannot raise errors
like other API functions); better not use 'api_check' for cheking it.
Diffstat (limited to 'lmem.c')
-rw-r--r-- | lmem.c | 5 |
1 files changed, 2 insertions, 3 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lmem.c,v 1.89 2014/11/02 19:33:33 roberto Exp roberto $ | 2 | ** $Id: lmem.c,v 1.90 2015/03/03 18:18:29 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 | */ |
@@ -85,8 +85,7 @@ void *luaM_realloc_ (lua_State *L, void *block, size_t osize, size_t nsize) { | |||
85 | #endif | 85 | #endif |
86 | newblock = (*g->frealloc)(g->ud, block, osize, nsize); | 86 | newblock = (*g->frealloc)(g->ud, block, osize, nsize); |
87 | if (newblock == NULL && nsize > 0) { | 87 | if (newblock == NULL && nsize > 0) { |
88 | api_check( nsize > realosize, | 88 | lua_assert(nsize > realosize); /* cannot fail when shrinking a block */ |
89 | "realloc cannot fail when shrinking a block"); | ||
90 | if (g->version) { /* is state fully built? */ | 89 | if (g->version) { /* is state fully built? */ |
91 | luaC_fullgc(L, 1); /* try to free some memory... */ | 90 | luaC_fullgc(L, 1); /* try to free some memory... */ |
92 | newblock = (*g->frealloc)(g->ud, block, osize, nsize); /* try again */ | 91 | newblock = (*g->frealloc)(g->ud, block, osize, nsize); /* try again */ |