summaryrefslogtreecommitdiff
path: root/libs/liblua/src/lmem.c
diff options
context:
space:
mode:
authorAlexander Lantsev <aunsane@gmail.com>2016-06-13 14:18:51 +0000
committerAlexander Lantsev <aunsane@gmail.com>2016-06-13 14:18:51 +0000
commit8cf571c5ea48be2d281d2c83ed0f2dba6f2c32f4 (patch)
tree0345c47dc55eee01884f535fb26e0a2d44732213 /libs/liblua/src/lmem.c
parent4386b8b61c08045c5d416b546517e1c71c7dcae6 (diff)
lublua:
- updated to 5.3.3 - renamed to lua53.dll git-svn-id: http://svn.miranda-ng.org/main/trunk@16965 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'libs/liblua/src/lmem.c')
-rw-r--r--libs/liblua/src/lmem.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/libs/liblua/src/lmem.c b/libs/liblua/src/lmem.c
index 4feaf036c7..0a0476cc77 100644
--- a/libs/liblua/src/lmem.c
+++ b/libs/liblua/src/lmem.c
@@ -1,5 +1,5 @@
/*
-** $Id: lmem.c,v 1.89 2014/11/02 19:33:33 roberto Exp $
+** $Id: lmem.c,v 1.91 2015/03/06 19:45:54 roberto Exp $
** Interface to Memory Manager
** See Copyright Notice in lua.h
*/
@@ -85,10 +85,11 @@ void *luaM_realloc_ (lua_State *L, void *block, size_t osize, size_t nsize) {
#endif
newblock = (*g->frealloc)(g->ud, block, osize, nsize);
if (newblock == NULL && nsize > 0) {
- api_check( nsize > realosize,
- "realloc cannot fail when shrinking a block");
- luaC_fullgc(L, 1); /* try to free some memory... */
- newblock = (*g->frealloc)(g->ud, block, osize, nsize); /* try again */
+ lua_assert(nsize > realosize); /* cannot fail when shrinking a block */
+ if (g->version) { /* is state fully built? */
+ luaC_fullgc(L, 1); /* try to free some memory... */
+ newblock = (*g->frealloc)(g->ud, block, osize, nsize); /* try again */
+ }
if (newblock == NULL)
luaD_throw(L, LUA_ERRMEM);
}