[Scummvm-git-logs] scummvm master -> 67a7816b96bbe36e8e9a85fa1fee74b4d55162f0

bluegr noreply at scummvm.org
Sun Feb 15 20:42:13 UTC 2026


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .

Summary:
67a7816b96 JANITORIAL: GRIM: use ARRAYSIZE macro


Commit: 67a7816b96bbe36e8e9a85fa1fee74b4d55162f0
    https://github.com/scummvm/scummvm/commit/67a7816b96bbe36e8e9a85fa1fee74b4d55162f0
Author: Michael Kuerbis (michael_kuerbis at web.de)
Date: 2026-02-15T22:42:10+02:00

Commit Message:
JANITORIAL: GRIM: use ARRAYSIZE macro

Changed paths:
    engines/grim/lipsync.cpp
    engines/grim/lua/lbuiltin.cpp
    engines/grim/lua/liolib.cpp
    engines/grim/lua/llex.cpp
    engines/grim/lua/lmathlib.cpp
    engines/grim/lua/lstate.cpp
    engines/grim/lua/lstrlib.cpp
    engines/grim/lua/ltm.cpp
    engines/grim/movie/codecs/vima.cpp


diff --git a/engines/grim/lipsync.cpp b/engines/grim/lipsync.cpp
index 5375593b01a..12e0ef4dcc0 100644
--- a/engines/grim/lipsync.cpp
+++ b/engines/grim/lipsync.cpp
@@ -106,6 +106,6 @@ const LipSync::PhonemeAnim LipSync::_animTable[] = {
 	{0x0292, 2}, {0x002E, 2}, {0x0000, 0}
 };
 
-const int LipSync::_animTableSize = sizeof(LipSync::_animTable) / sizeof(LipSync::_animTable[0]);
+const int LipSync::_animTableSize = ARRAYSIZE(LipSync::_animTable);
 
 } // end of namespace Grim
diff --git a/engines/grim/lua/lbuiltin.cpp b/engines/grim/lua/lbuiltin.cpp
index 4288df81320..3d47d05e740 100644
--- a/engines/grim/lua/lbuiltin.cpp
+++ b/engines/grim/lua/lbuiltin.cpp
@@ -523,7 +523,7 @@ void luaB_predefine() {
 	// pre-register mem error messages, to avoid loop when error arises
 	luaS_newfixedstring(tableEM);
 	luaS_newfixedstring(memEM);
-	luaL_openlib(int_funcs, sizeof(int_funcs) / sizeof(int_funcs[0]));
+	luaL_openlib(int_funcs, ARRAYSIZE(int_funcs));
 	lua_pushstring(LUA_VERSION);
 	lua_setglobal("_VERSION");
 }
diff --git a/engines/grim/lua/liolib.cpp b/engines/grim/lua/liolib.cpp
index 434190bc2c2..5c9c1ab5768 100644
--- a/engines/grim/lua/liolib.cpp
+++ b/engines/grim/lua/liolib.cpp
@@ -416,7 +416,7 @@ static struct luaL_reg iolibtag[] = {
 static void openwithtags() {
 	int32 iotag = lua_newtag();
 	int32 closedtag = lua_newtag();
-	for (uint32 i = 0; i < sizeof(iolibtag) / sizeof(iolibtag[0]); i++) {
+	for (uint32 i = 0; i < ARRAYSIZE(iolibtag); i++) {
 		// put both tags as upvalues for these functions
 		lua_pushnumber(iotag);
 		lua_pushnumber(closedtag);
@@ -449,8 +449,8 @@ static void openwithtags() {
 void lua_iolibopen() {
 	g_files = new Common::HashMap<int32, LuaFile *>();
 
-	luaL_openlib(iolib, (sizeof(iolib) / sizeof(iolib[0])));
-	luaL_addlibtolist(iolibtag, (sizeof(iolibtag) / sizeof(iolibtag[0])));
+	luaL_openlib(iolib, ARRAYSIZE(iolib));
+	luaL_addlibtolist(iolibtag, ARRAYSIZE(iolibtag));
 	openwithtags();
 	lua_pushcfunction(errorfb);
 	lua_seterrormethod();
diff --git a/engines/grim/lua/llex.cpp b/engines/grim/lua/llex.cpp
index ca3b65f73dc..faf5b7e657e 100644
--- a/engines/grim/lua/llex.cpp
+++ b/engines/grim/lua/llex.cpp
@@ -37,7 +37,7 @@ static struct {
 
 void luaX_init() {
 	uint32 i;
-	for (i = 0; i < (sizeof(reserved) / sizeof(reserved[0])); i++) {
+	for (i = 0; i < ARRAYSIZE(reserved); i++) {
 		TaggedString *ts = luaS_new(reserved[i].name);
 		ts->head.marked = reserved[i].token;  /* reserved word  (always > 255) */
 	}
diff --git a/engines/grim/lua/lmathlib.cpp b/engines/grim/lua/lmathlib.cpp
index a5f704546f6..fd4e3ce96ee 100644
--- a/engines/grim/lua/lmathlib.cpp
+++ b/engines/grim/lua/lmathlib.cpp
@@ -139,8 +139,8 @@ static luaL_reg powFunc[] = {
 ** Open math library
 */
 void lua_mathlibopen() {
-	luaL_openlib(mathlib, (sizeof(mathlib) / sizeof(mathlib[0])));
-	luaL_addlibtolist(powFunc, (sizeof(powFunc) / sizeof(powFunc[0])));
+	luaL_openlib(mathlib, ARRAYSIZE(mathlib));
+	luaL_addlibtolist(powFunc, ARRAYSIZE(powFunc));
 	lua_pushstring("deg");
 	lua_setglobal("_TRIGMODE");
 	lua_pushcfunction(math_pow);
diff --git a/engines/grim/lua/lstate.cpp b/engines/grim/lua/lstate.cpp
index f5e8bce9455..cfe6bedcfa2 100644
--- a/engines/grim/lua/lstate.cpp
+++ b/engines/grim/lua/lstate.cpp
@@ -212,7 +212,7 @@ void lua_open() {
 	lua_resetglobals();
 	luaT_init();
 	luaB_predefine();
-	luaL_addlibtolist(stdErrorRimFunc, (sizeof(stdErrorRimFunc) / sizeof(stdErrorRimFunc[0])));
+	luaL_addlibtolist(stdErrorRimFunc, ARRAYSIZE(stdErrorRimFunc));
 	if (Debug::isChannelEnabled(Debug::Lua))
 		lua_callhook = callHook;
 }
diff --git a/engines/grim/lua/lstrlib.cpp b/engines/grim/lua/lstrlib.cpp
index 76a30f76805..d56e0ad12ae 100644
--- a/engines/grim/lua/lstrlib.cpp
+++ b/engines/grim/lua/lstrlib.cpp
@@ -497,7 +497,7 @@ static struct luaL_reg strlib[] = {
 ** Open string library
 */
 void strlib_open() {
-	luaL_openlib(strlib, (sizeof(strlib) / sizeof(strlib[0])));
+	luaL_openlib(strlib, ARRAYSIZE(strlib));
 }
 
 } // end of namespace Grim
diff --git a/engines/grim/lua/ltm.cpp b/engines/grim/lua/ltm.cpp
index 2f3672d74e7..a64c769595b 100644
--- a/engines/grim/lua/ltm.cpp
+++ b/engines/grim/lua/ltm.cpp
@@ -188,7 +188,7 @@ void luaT_setfallback() {
 	TObject oldfunc;
 	lua_CFunction replace;
 	if (!tmFBAdded) {
-		luaL_addlibtolist(tmFB, (sizeof(tmFB) / sizeof(tmFB[0])));
+		luaL_addlibtolist(tmFB, ARRAYSIZE(tmFB));
 		tmFBAdded = true;
 	}
 	const char *name = luaL_check_string(1);
diff --git a/engines/grim/movie/codecs/vima.cpp b/engines/grim/movie/codecs/vima.cpp
index 85b880cd852..b3ef91c0d12 100644
--- a/engines/grim/movie/codecs/vima.cpp
+++ b/engines/grim/movie/codecs/vima.cpp
@@ -105,7 +105,7 @@ void vimaInit(uint16 *destTable) {
 	for (destTableStartPos = 0, incer = 0; destTableStartPos < 64; destTableStartPos++, incer++) {
 		unsigned int destTablePos, imcTable1Pos;
 		for (imcTable1Pos = 0, destTablePos = destTableStartPos;
-				imcTable1Pos < sizeof(imcTable1) / sizeof(imcTable1[0]); imcTable1Pos++, destTablePos += 64) {
+				imcTable1Pos < ARRAYSIZE(imcTable1); imcTable1Pos++, destTablePos += 64) {
 			int put = 0, count, tableValue;
 			for (count = 32, tableValue = imcTable1[imcTable1Pos]; count != 0; count >>= 1, tableValue >>= 1) {
 				if (incer & count) {




More information about the Scummvm-git-logs mailing list