mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-13 03:33:48 +00:00
Issue found with PVS-Studio:
Many instances where we would create a object via a new call, and then check that it was non-null. This is redundant, as if we ever were in a situation where new failed, we'd be crashing left and right already, so the additional check is wasted processing.
This commit is contained in:
parent
db532c0e1a
commit
527c3790d6
15 changed files with 164 additions and 262 deletions
|
|
@ -50,24 +50,21 @@ bool addConsoleParser(char *ext, fnGetCurrentFile gcf, fnGetCurrentLine gcl, fnP
|
|||
AssertFatal(ext && gcf && gcl && p && r, "AddConsoleParser called with one or more NULL arguments");
|
||||
|
||||
ConsoleParser * pParser = new ConsoleParser;
|
||||
if(pParser != NULL)
|
||||
{
|
||||
pParser->ext = ext;
|
||||
pParser->getCurrentFile = gcf;
|
||||
pParser->getCurrentLine = gcl;
|
||||
pParser->parse = p;
|
||||
pParser->restart = r;
|
||||
pParser->setScanBuffer = ssb;
|
||||
|
||||
if(def)
|
||||
gDefaultParser = pParser;
|
||||
pParser->ext = ext;
|
||||
pParser->getCurrentFile = gcf;
|
||||
pParser->getCurrentLine = gcl;
|
||||
pParser->parse = p;
|
||||
pParser->restart = r;
|
||||
pParser->setScanBuffer = ssb;
|
||||
|
||||
pParser->next = gParserList;
|
||||
gParserList = pParser;
|
||||
if (def)
|
||||
gDefaultParser = pParser;
|
||||
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
pParser->next = gParserList;
|
||||
gParserList = pParser;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
ConsoleParser * getParserForFile(const char *filename)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue