[Scummvm-cvs-logs] CVS: scummvm/scumm script.cpp,1.47,1.48

Max Horn fingolfin at users.sourceforge.net
Fri Mar 7 15:51:01 CET 2003


Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1:/tmp/cvs-serv22676

Modified Files:
	script.cpp 
Log Message:
added some code to get better valgrind results

Index: script.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script.cpp,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -d -r1.47 -r1.48
--- script.cpp	7 Mar 2003 02:42:39 -0000	1.47
+++ script.cpp	7 Mar 2003 23:49:59 -0000	1.48
@@ -467,8 +467,14 @@
 	writeVar(_resultVarNumber, value);
 }
 
+int my_dummy_global = 0;
+
 void Scumm::push(int a) {
-	assert(_scummStackPos >= 0 && (unsigned int)_scummStackPos <= ARRAYSIZE(_scummStack));
+// HACK to aid valgrind
+if (a > 0)
+	my_dummy_global++;
+
+	assert(_scummStackPos >= 0 && (unsigned int)_scummStackPos < ARRAYSIZE(_scummStack));
 	_scummStack[_scummStackPos++] = a;
 }
 
@@ -477,7 +483,13 @@
 		error("No items on stack to pop() for %s (0x%X) at [%d-%d]", getOpcodeDesc(_opcode), _opcode, _roomResource, vm.slot[_currentScript].number);
 	}
 
-	return _scummStack[--_scummStackPos];
+	int a = _scummStack[--_scummStackPos];
+
+// HACK to aid valgrind
+if (a > 0)
+	my_dummy_global++;
+
+	return a;
 }
 
 void Scumm::drawBox(int x, int y, int x2, int y2, int color) {





More information about the Scummvm-git-logs mailing list