From 578ae5745cecee56d48795cd4ae1eaf13618715c Mon Sep 17 00:00:00 2001 From: Roberto I Date: Tue, 23 Dec 2025 14:44:06 -0300 Subject: Details typo in comment + formatting + logical 'and' was written as a bitwise operation (makes code more fragile) --- lapi.c | 2 +- lgc.c | 2 +- lstrlib.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lapi.c b/lapi.c index 27fa5247..42c8fcdd 100644 --- a/lapi.c +++ b/lapi.c @@ -366,7 +366,7 @@ LUA_API int lua_compare (lua_State *L, int index1, int index2, int op) { } -LUA_API unsigned (lua_numbertocstring) (lua_State *L, int idx, char *buff) { +LUA_API unsigned lua_numbertocstring (lua_State *L, int idx, char *buff) { const TValue *o = index2value(L, idx); if (ttisnumber(o)) { unsigned len = luaO_tostringbuff(o, buff); diff --git a/lgc.c b/lgc.c index c64d74b8..f1d9a7ce 100644 --- a/lgc.c +++ b/lgc.c @@ -1672,7 +1672,7 @@ static l_mem singlestep (lua_State *L, int fast) { GCTM(L); /* call one finalizer */ stepresult = CWUFIN; } - else { /* no more finalizers or emergency mode or no enough stack + else { /* no more finalizers or emergency mode or not enough stack to run finalizers */ g->gcstate = GCSpause; /* finish collection */ stepresult = step2pause; diff --git a/lstrlib.c b/lstrlib.c index 23df839e..e26eb1a8 100644 --- a/lstrlib.c +++ b/lstrlib.c @@ -968,7 +968,7 @@ static int str_gsub (lua_State *L) { reprepstate(&ms); /* (re)prepare state for new match */ if ((e = match(&ms, src, p)) != NULL && e != lastmatch) { /* match? */ n++; - changed = add_value(&ms, &b, src, e, tr) | changed; + changed = add_value(&ms, &b, src, e, tr) || changed; src = lastmatch = e; } else if (src < ms.src_end) /* otherwise, skip one character */ -- cgit v1.2.3-55-g6feb