[Scummvm-cvs-logs] SF.net SVN: scummvm:[54819] tools/branches/gsoc2010-decompiler/decompiler

pidgeot at users.sourceforge.net pidgeot at users.sourceforge.net
Tue Dec 7 23:30:29 CET 2010


Revision: 54819
          http://scummvm.svn.sourceforge.net/scummvm/?rev=54819&view=rev
Author:   pidgeot
Date:     2010-12-07 22:30:28 +0000 (Tue, 07 Dec 2010)

Log Message:
-----------
DECOMPILER: Minor code cleanup.

Modified Paths:
--------------
    tools/branches/gsoc2010-decompiler/decompiler/kyra/disassembler.cpp
    tools/branches/gsoc2010-decompiler/decompiler/simple_disassembler.cpp
    tools/branches/gsoc2010-decompiler/decompiler/simple_disassembler.h

Modified: tools/branches/gsoc2010-decompiler/decompiler/kyra/disassembler.cpp
===================================================================
--- tools/branches/gsoc2010-decompiler/decompiler/kyra/disassembler.cpp	2010-12-07 20:58:27 UTC (rev 54818)
+++ tools/branches/gsoc2010-decompiler/decompiler/kyra/disassembler.cpp	2010-12-07 22:30:28 UTC (rev 54819)
@@ -389,7 +389,7 @@
 		}
 
 #define ADD_INST _insts.insert(_insts.end(), Instruction());
-#define LAST_INST (_insts[_insts.size()-1])
+#define LAST_INST (_insts.back())
 #define OPCODE_MD(name, category, stackChange, hasParam, isSigned, codeGenData) \
 		ADD_INST; \
 		LAST_INST._opcode = opcode; \

Modified: tools/branches/gsoc2010-decompiler/decompiler/simple_disassembler.cpp
===================================================================
--- tools/branches/gsoc2010-decompiler/decompiler/simple_disassembler.cpp	2010-12-07 20:58:27 UTC (rev 54818)
+++ tools/branches/gsoc2010-decompiler/decompiler/simple_disassembler.cpp	2010-12-07 22:30:28 UTC (rev 54819)
@@ -25,11 +25,11 @@
 SimpleDisassembler::SimpleDisassembler(std::vector<Instruction> &insts) : Disassembler(insts) {
 }
 
-void SimpleDisassembler::readParams(Instruction *inst, char *typeString) {
+void SimpleDisassembler::readParams(Instruction &inst, const char *typeString) {
 	while (*typeString) {
 		Parameter p;
 		readParameter(&p, *typeString);
-		inst->_params.push_back(p);
+		inst._params.push_back(p);
 		typeString++;
 	}
 }

Modified: tools/branches/gsoc2010-decompiler/decompiler/simple_disassembler.h
===================================================================
--- tools/branches/gsoc2010-decompiler/decompiler/simple_disassembler.h	2010-12-07 20:58:27 UTC (rev 54818)
+++ tools/branches/gsoc2010-decompiler/decompiler/simple_disassembler.h	2010-12-07 22:30:28 UTC (rev 54819)
@@ -35,10 +35,10 @@
 	/**
 	 * Read parameters and associate them with an instruction.
 	 *
-	 * @param inst       Pointer to the instruction to associate the parameters with.
+	 * @param inst       The instruction to associate the parameters with.
 	 * @param typeString NUL-terminated string describing the type of each parameter.
 	 */
-	void readParams(Instruction *inst, char *typeString);
+	void readParams(Instruction &inst, const char *typeString);
 
 	/**
 	 * Reads data for a single parameter.
@@ -59,7 +59,7 @@
 
 #define INC_ADDR _address++;
 #define ADD_INST _insts.push_back(Instruction());
-#define LAST_INST (_insts[_insts.size()-1])
+#define LAST_INST (_insts.back())
 
 #define START_OPCODES \
 	_address = _addressBase; \
@@ -89,7 +89,7 @@
 		LAST_INST._name = opcodePrefix + std::string(name); \
 		LAST_INST._type = category; \
 		LAST_INST._codeGenData = codeGenData; \
-		readParams(&LAST_INST, (char*)params); \
+		readParams(LAST_INST, params); \
 
 #define OPCODE_MD(val, name, category, stackChange, params, codeGenData) \
 	OPCODE_BASE(val)\


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list