driver/main: Use separate variables for error checking in main()

Avoids reusing the same variable for two different areas of behavior and
uses separately named variables. This can help debugging if the first
condition isn't true, but the tool run condition is true, as it provides
an error count to compare against.
This commit is contained in:
Lioncash 2019-08-19 21:57:22 -04:00
parent 7647fa3ca6
commit d3ac48715f
1 changed files with 5 additions and 7 deletions

View File

@ -331,27 +331,25 @@ int main(int argc, const char** argv)
}
/* Construct selected tool */
size_t ErrorRef = logvisor::ErrorCount;
const size_t MakeToolErrorRef = logvisor::ErrorCount;
auto tool = MakeSelectedTool(argv[1], info);
if (logvisor::ErrorCount > ErrorRef) {
if (logvisor::ErrorCount > MakeToolErrorRef) {
#if WIN_PAUSE
system("PAUSE");
#endif
return 1;
}
if (info.verbosityLevel) {
LogModule.report(logvisor::Info, fmt(_SYS_STR("Constructed tool '{}' {}\n")), tool->toolName(),
info.verbosityLevel);
}
/* Run tool */
ErrorRef = logvisor::ErrorCount;
const size_t RunToolErrorRef = logvisor::ErrorCount;
ToolPtr = tool.get();
int retval = tool->run();
const int retval = tool->run();
ToolPtr = nullptr;
if (logvisor::ErrorCount > ErrorRef) {
if (logvisor::ErrorCount > RunToolErrorRef) {
hecl::blender::Connection::Shutdown();
#if WIN_PAUSE
system("PAUSE");