summaryrefslogtreecommitdiff
path: root/ldo.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2009-04-26 18:55:35 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2009-04-26 18:55:35 -0300
commite5249b9fb54fce969dbdfffaaee3deff9e58e096 (patch)
treedb698b33f951d7e54fe17e3a09e2a69111edbfc6 /ldo.c
parentd3037d97ec192e7719de485f15dacb473bf96528 (diff)
downloadlua-e5249b9fb54fce969dbdfffaaee3deff9e58e096.tar.gz
lua-e5249b9fb54fce969dbdfffaaee3deff9e58e096.tar.bz2
lua-e5249b9fb54fce969dbdfffaaee3deff9e58e096.zip
'exit' changed to 'abort' in case of panic (+ some extra comments)
'abort' seems more in line with panic ("abnormal termination")
Diffstat (limited to 'ldo.c')
-rw-r--r--ldo.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/ldo.c b/ldo.c
index 040b8cdb..60b57ced 100644
--- a/ldo.c
+++ b/ldo.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ldo.c,v 2.60 2009/04/17 14:28:06 roberto Exp roberto $ 2** $Id: ldo.c,v 2.61 2009/04/17 22:00:01 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*/
@@ -76,22 +76,22 @@ static void restore_stack_limit (lua_State *L) {
76 76
77 77
78void luaD_throw (lua_State *L, int errcode) { 78void luaD_throw (lua_State *L, int errcode) {
79 if (L->errorJmp) { 79 if (L->errorJmp) { /* thread has an error handler? */
80 L->errorJmp->status = errcode; 80 L->errorJmp->status = errcode; /* set status */
81 LUAI_THROW(L, L->errorJmp); 81 LUAI_THROW(L, L->errorJmp); /* jump to it */
82 } 82 }
83 else { /* thread has no error handler */ 83 else { /* thread has no error handler */
84 L->status = cast_byte(errcode); /* mark it as dead */ 84 L->status = cast_byte(errcode); /* mark it as dead */
85 if (G(L)->mainthread->errorJmp) { /* main thread has a handler? */ 85 if (G(L)->mainthread->errorJmp) { /* main thread has a handler? */
86 setobjs2s(L, G(L)->mainthread->top++, L->top - 1); /* copy error obj. */ 86 setobjs2s(L, G(L)->mainthread->top++, L->top - 1); /* copy error obj. */
87 luaD_throw(G(L)->mainthread, errcode); /* jump to it */ 87 luaD_throw(G(L)->mainthread, errcode); /* re-throw in main thread */
88 } 88 }
89 else { 89 else { /* no handler at all; abort */
90 if (G(L)->panic) { 90 if (G(L)->panic) { /* panic function? */
91 lua_unlock(L); 91 lua_unlock(L);
92 G(L)->panic(L); 92 G(L)->panic(L); /* call it (last chance to jump out) */
93 } 93 }
94 exit(EXIT_FAILURE); 94 abort();
95 } 95 }
96 } 96 }
97} 97}