From 3ca9af51a4f060cf2178901a67a21f8269af3224 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Tue, 11 Jul 2006 12:53:29 -0300 Subject: emergency garbage collector (core forces a GC when allocation fails) --- llex.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'llex.c') diff --git a/llex.c b/llex.c index 6a8c158e..056bbbdb 100644 --- a/llex.c +++ b/llex.c @@ -1,5 +1,5 @@ /* -** $Id: llex.c,v 2.19 2006/02/06 18:28:16 roberto Exp roberto $ +** $Id: llex.c,v 2.20 2006/03/09 18:14:31 roberto Exp roberto $ ** Lexical Analyzer ** See Copyright Notice in lua.h */ @@ -116,10 +116,13 @@ void luaX_syntaxerror (LexState *ls, const char *msg) { TString *luaX_newstring (LexState *ls, const char *str, size_t l) { lua_State *L = ls->L; + TValue *o; /* entry for `str' */ TString *ts = luaS_newlstr(L, str, l); - TValue *o = luaH_setstr(L, ls->fs->h, ts); /* entry for `str' */ + setsvalue2s(L, L->top++, ts); /* anchor string */ + o = luaH_setstr(L, ls->fs->h, ts); if (ttisnil(o)) setbvalue(o, 1); /* make sure `str' will not be collected */ + L->top--; return ts; } -- cgit v1.2.3-55-g6feb