diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2006-07-11 12:53:29 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2006-07-11 12:53:29 -0300 |
commit | 3ca9af51a4f060cf2178901a67a21f8269af3224 (patch) | |
tree | 4f1bb541280aa8b4960b16d0925eca60adb2b1a8 /llex.c | |
parent | c7b89dd28097296bbc14d9b47b4cea72514b2b76 (diff) | |
download | lua-3ca9af51a4f060cf2178901a67a21f8269af3224.tar.gz lua-3ca9af51a4f060cf2178901a67a21f8269af3224.tar.bz2 lua-3ca9af51a4f060cf2178901a67a21f8269af3224.zip |
emergency garbage collector (core forces a GC when allocation fails)
Diffstat (limited to 'llex.c')
-rw-r--r-- | llex.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: llex.c,v 2.19 2006/02/06 18:28:16 roberto Exp roberto $ | 2 | ** $Id: llex.c,v 2.20 2006/03/09 18:14:31 roberto Exp roberto $ |
3 | ** Lexical Analyzer | 3 | ** Lexical Analyzer |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -116,10 +116,13 @@ void luaX_syntaxerror (LexState *ls, const char *msg) { | |||
116 | 116 | ||
117 | TString *luaX_newstring (LexState *ls, const char *str, size_t l) { | 117 | TString *luaX_newstring (LexState *ls, const char *str, size_t l) { |
118 | lua_State *L = ls->L; | 118 | lua_State *L = ls->L; |
119 | TValue *o; /* entry for `str' */ | ||
119 | TString *ts = luaS_newlstr(L, str, l); | 120 | TString *ts = luaS_newlstr(L, str, l); |
120 | TValue *o = luaH_setstr(L, ls->fs->h, ts); /* entry for `str' */ | 121 | setsvalue2s(L, L->top++, ts); /* anchor string */ |
122 | o = luaH_setstr(L, ls->fs->h, ts); | ||
121 | if (ttisnil(o)) | 123 | if (ttisnil(o)) |
122 | setbvalue(o, 1); /* make sure `str' will not be collected */ | 124 | setbvalue(o, 1); /* make sure `str' will not be collected */ |
125 | L->top--; | ||
123 | return ts; | 126 | return ts; |
124 | } | 127 | } |
125 | 128 | ||