[PATCH] BUG: Missing 'lua_State' parameter in 'floatforloop'

"'Weixie Cui' via lua-l" <[email protected]>
Newsgroups gmane.comp.lang.lua.general
Message-ID <[email protected]>
From: Weixie Cui <[email protected]>

'floatforloop' uses 'L' in 'luai_numadd(L, idx, step)' but does
not receive it as a parameter. It compiles only because the default
'luai_numadd' macro ignores 'L'; custom redefinitions would break.
The sibling function 'forprep' correctly takes 'lua_State *L'.
---
 lvm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lvm.c b/lvm.c
index c70e2b8a..612369cb 100644
--- a/lvm.c
+++ b/lvm.c
@@ -270,7 +270,7 @@ static int forprep (lua_State *L, StkId ra) {
 ** true iff the loop must continue. (The integer case is
 ** written online with opcode OP_FORLOOP, for performance.)
 */
-static int floatforloop (StkId ra) {
+static int floatforloop (lua_State *L, StkId ra) {
   lua_Number step = fltvalue(s2v(ra + 1));
   lua_Number limit = fltvalue(s2v(ra));
   lua_Number idx = fltvalue(s2v(ra + 2));  /* control variable */
@@ -1841,7 +1841,7 @@ void luaV_execute (lua_State *L, CallInfo *ci) {
             pc -= GETARG_Bx(i);  /* jump back */
           }
         }
-        else if (floatforloop(ra))  /* float loop */
+        else if (floatforloop(L, ra))  /* float loop */
           pc -= GETARG_Bx(i);  /* jump back */
         updatetrap(ci);  /* allows a signal to break the loop */
         vmbreak;
-- 
2.39.5 (Apple Git-154)

-- 
You received this message because you are subscribed to the Google Groups "lua-l" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion visit https://groups.google.com/d/msgid/lua-l/tencent_2EA63074D0365051FEE070E8C5AF32CF9307%40qq.com.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.