diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1998-01-28 15:47:05 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1998-01-28 15:47:05 -0200 |
commit | 46968b8ffa232a642cdc2f77cb02c7aa61ab9b89 (patch) | |
tree | 6538d169b364baa4e3735a85bf9bf5ccd84ff65b | |
parent | 6cdf0d8768afb16faaf6c020d6798a4588be2f74 (diff) | |
download | lua-46968b8ffa232a642cdc2f77cb02c7aa61ab9b89.tar.gz lua-46968b8ffa232a642cdc2f77cb02c7aa61ab9b89.tar.bz2 lua-46968b8ffa232a642cdc2f77cb02c7aa61ab9b89.zip |
"volatile is the only reliable way to ensure that a local variable
retains the value it had at the time of the call to longjmp"
-rw-r--r-- | ldo.c | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ldo.c,v 1.21 1998/01/07 16:26:48 roberto Exp roberto $ | 2 | ** $Id: ldo.c,v 1.22 1998/01/27 21:21:27 roberto Exp roberto $ |
3 | ** Stack and Call structure of Lua | 3 | ** Stack and Call structure of Lua |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -288,8 +288,8 @@ int luaD_protectedrun (int nResults) | |||
288 | { | 288 | { |
289 | jmp_buf myErrorJmp; | 289 | jmp_buf myErrorJmp; |
290 | int status; | 290 | int status; |
291 | struct C_Lua_Stack oldCLS = L->Cstack; | 291 | volatile struct C_Lua_Stack oldCLS = L->Cstack; |
292 | jmp_buf *oldErr = L->errorJmp; | 292 | jmp_buf *volatile oldErr = L->errorJmp; |
293 | L->errorJmp = &myErrorJmp; | 293 | L->errorJmp = &myErrorJmp; |
294 | if (setjmp(myErrorJmp) == 0) { | 294 | if (setjmp(myErrorJmp) == 0) { |
295 | do_callinc(nResults); | 295 | do_callinc(nResults); |
@@ -310,10 +310,10 @@ int luaD_protectedrun (int nResults) | |||
310 | */ | 310 | */ |
311 | static int protectedparser (ZIO *z, int bin) | 311 | static int protectedparser (ZIO *z, int bin) |
312 | { | 312 | { |
313 | int status; | 313 | volatile int status; |
314 | TProtoFunc *tf; | 314 | TProtoFunc *volatile tf; |
315 | jmp_buf myErrorJmp; | 315 | jmp_buf myErrorJmp; |
316 | jmp_buf *oldErr = L->errorJmp; | 316 | jmp_buf *volatile oldErr = L->errorJmp; |
317 | L->errorJmp = &myErrorJmp; | 317 | L->errorJmp = &myErrorJmp; |
318 | if (setjmp(myErrorJmp) == 0) { | 318 | if (setjmp(myErrorJmp) == 0) { |
319 | tf = bin ? luaU_undump1(z) : luaY_parser(z); | 319 | tf = bin ? luaU_undump1(z) : luaY_parser(z); |