diff options
| author | Max Horn | 2003-05-21 18:09:49 +0000 |
|---|---|---|
| committer | Max Horn | 2003-05-21 18:09:49 +0000 |
| commit | 86d57f3c7af8fd0d4c6a4d1751ccdaac77c3b2e8 (patch) | |
| tree | aa7c2126baa9dd2ca7dd80910f5835b6aa861294 /scumm/debugger.cpp | |
| parent | 11d29b71ab4400e6e732ba7cd49a343150360eaf (diff) | |
| download | scummvm-rg350-86d57f3c7af8fd0d4c6a4d1751ccdaac77c3b2e8.tar.gz scummvm-rg350-86d57f3c7af8fd0d4c6a4d1751ccdaac77c3b2e8.tar.bz2 scummvm-rg350-86d57f3c7af8fd0d4c6a4d1751ccdaac77c3b2e8.zip | |
many pedantic warning fixes (and some actual potential buglets fixed, too)
svn-id: r7795
Diffstat (limited to 'scumm/debugger.cpp')
| -rw-r--r-- | scumm/debugger.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/scumm/debugger.cpp b/scumm/debugger.cpp index 139ca5bb37..95f8ec0764 100644 --- a/scumm/debugger.cpp +++ b/scumm/debugger.cpp @@ -143,7 +143,7 @@ void ScummDebugger::on_frame() { bool ScummDebugger::debuggerInputCallback(ConsoleDialog *console, const char *input, void *refCon) { ScummDebugger *debugger = (ScummDebugger *)refCon; - return debugger->RunCommand((char*)input); + return debugger->RunCommand(input); } @@ -229,10 +229,11 @@ void ScummDebugger::enter() { } // Command execution loop -bool ScummDebugger::RunCommand(char *input) { +bool ScummDebugger::RunCommand(const char *inputOrig) { int i = 0, num_params = 0; const char *param[256]; - + char *input = strdup(inputOrig); // One of the rare occasions using strdup is OK (although avoiding strtok might be more elegant here). + // Parse out any params char *tok = strtok(input, " "); if (tok) { @@ -245,6 +246,7 @@ bool ScummDebugger::RunCommand(char *input) { for(i=0; i < _dcmd_count; i++) { if (!strcmp(_dcmds[i].name, param[0])) { + free(input); return (this->*_dcmds[i].function)(num_params, param); } } @@ -321,11 +323,13 @@ bool ScummDebugger::RunCommand(char *input) { } } + free(input); return true; } } Debug_Printf("Unknown command or variable\n"); + free(input); return true; } |
