[Scummvm-git-logs] scummvm master -> 7412bec1400a0d939b3c9fc47c236109dad50500
bluegr
noreply at scummvm.org
Mon Dec 8 21:00:08 UTC 2025
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:
7412bec140 SCI: Reduce stack usage in Console::cmdShowInstruments()
Commit: 7412bec1400a0d939b3c9fc47c236109dad50500
https://github.com/scummvm/scummvm/commit/7412bec1400a0d939b3c9fc47c236109dad50500
Author: Donovan Watteau (contrib at dwatteau.fr)
Date: 2025-12-08T23:00:03+02:00
Commit Message:
SCI: Reduce stack usage in Console::cmdShowInstruments()
For the `show_instruments` command of the debugger console, some values
are put into the `bool instrumentsSongs[128][1000]` variable on the
stack.
But this may trigger the `-Wframe-larger-than=307200` warning on
platforms where `bool` may be large (e.g. older OSXPPC, where
`sizeof(bool) == 4`).
So, just use `uint8` instead of `bool`, since it's a large array.
Changed paths:
engines/sci/console.cpp
diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp
index 16c929df588..71774e4d618 100644
--- a/engines/sci/console.cpp
+++ b/engines/sci/console.cpp
@@ -1329,14 +1329,14 @@ bool Console::cmdShowInstruments(int argc, const char **argv) {
Common::List<ResourceId> resources = _engine->getResMan()->listResources(kResourceTypeSound);
Common::sort(resources.begin(), resources.end());
int instruments[128];
- bool instrumentsSongs[128][1000];
+ uint8 instrumentsSongs[128][1000 / 8];
for (int i = 0; i < 128; i++)
instruments[i] = 0;
for (int i = 0; i < 128; i++)
- for (int j = 0; j < 1000; j++)
- instrumentsSongs[i][j] = false;
+ for (int j = 0; j < 1000 / 8; j++)
+ instrumentsSongs[i][j] = 0;
if (songNumber == -1) {
debugPrintf("%d sounds found, checking their instrument mappings...\n", resources.size());
@@ -1396,7 +1396,7 @@ bool Console::cmdShowInstruments(int argc, const char **argv) {
debugPrintf(" %d", instrument);
instruments[instrument]++;
- instrumentsSongs[instrument][itr->getNumber()] = true;
+ instrumentsSongs[instrument][itr->getNumber() >> 3] |= 1 << (itr->getNumber() & 7);
} else {
channelData++;
}
@@ -1462,7 +1462,7 @@ bool Console::cmdShowInstruments(int argc, const char **argv) {
if (instruments[i] > 0) {
debugPrintf("Instrument %d: ", i);
for (int j = 0; j < 1000; j++) {
- if (instrumentsSongs[i][j])
+ if ((instrumentsSongs[i][j >> 3] & (1 << (j & 7))) != 0)
debugPrintf("%d, ", j);
}
debugPrintf("\n");
More information about the Scummvm-git-logs
mailing list