lua-users home
lua-l archive

Re: Potential bug in Lua when hooking functions

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Mon, Jul 20, 2009 at 2:37 PM, Jonathan
Shaw<Jonathan.Shaw@microsoft.com> wrote:
> Forgive my ignorance, but how would a traditional diff be best displayed in a text only format?
As the plaintext output from the diff program would be one option:
E:\CPP\lua-5.1.4>diff -u src\lvm.c srcnew\lvm.c
--- src\lvm.c Sun Feb 8 13:30:49 2009
+++ srcnew\lvm.c Mon Jul 20 14:41:03 2009
@@ -387,11 +387,14 @@
 StkId ra;
 if ((L->hookmask & (LUA_MASKLINE | LUA_MASKCOUNT)) &&
 (--L->hookcount == 0 || L->hookmask & LUA_MASKLINE)) {
+ const lu_byte saved_status = L->status;
+ L->status = 0;
 traceexec(L, pc);
 if (L->status == LUA_YIELD) { /* did hook yield? */
 L->savedpc = pc - 1;
 return;
 }
+ L->status = saved_status;
 base = L->base;
 }
 /* warning!! several calls may realloc the stack and invalidate `ra' */

AltStyle によって変換されたページ (->オリジナル) /