Jump to content

Removing redundant if statements


Recommended Posts

Turns out that MTA has a lot of redundant if statements like:

if ( pPed )

{

// Blah

}

else

m_pScriptDebugging->LogBadPointer ( luaVM, "ped", 1 );

These checks have been unnecessary since the introduction of argStream and I'm guessing they're only still in the code because it's so time consuming to remove them all.

I volunteer to go through all the files and delete any of these unnecessary checks but before I do that I want a developer with access to confirm that if I do this, they will merge my pull request(s).

I have done 1 file reducing the file by 286 lines:

https://github.com/ArranTuna/mtasa-blue/commit/ef83cee0b6024e73230d77b6225debc81e3d6492

I'm guessing removing them will have virtually no performance impact but removing so many redundant lines definitely improves code readability and I am happy to spend many hours finding and removing all of these statements I just need a confirmation from a developer.

  • Like 1
Link to comment
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...