lua

A copy of the Lua development repository
Log | Files | Refs | README

commit 2d5931ebc8c3136bae92b5c502f3de0f06c31364
parent 35fa276099bba69c4def7304e53a8962b3ab00fc
Author: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date:   Tue, 17 Nov 2009 14:46:20 -0200

ensure that reader function cannot yield during parsing

Diffstat:
Mldo.c | 4+++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/ldo.c b/ldo.c @@ -1,5 +1,5 @@ /* -** $Id: ldo.c,v 2.70 2009/10/23 19:12:19 roberto Exp roberto $ +** $Id: ldo.c,v 2.71 2009/11/17 16:33:38 roberto Exp roberto $ ** Stack and Call structure of Lua ** See Copyright Notice in lua.h */ @@ -589,12 +589,14 @@ static void f_parser (lua_State *L, void *ud) { int luaD_protectedparser (lua_State *L, ZIO *z, const char *name) { struct SParser p; int status; + L->nny++; /* cannot yield during parsing */ p.z = z; p.name = name; p.varl.actvar = NULL; p.varl.nactvar = p.varl.actvarsize = 0; luaZ_initbuffer(L, &p.buff); status = luaD_pcall(L, f_parser, &p, savestack(L, L->top), L->errfunc); luaZ_freebuffer(L, &p.buff); luaM_freearray(L, p.varl.actvar, p.varl.actvarsize); + L->nny--; return status; }