mirror of
https://github.com/Open-Cascade-SAS/OCCT.git
synced 2026-06-14 11:37:02 +08:00
Coding - Remove redundant null checks before deallocation (#1077)
In C++, delete/delete[] on nullptr and free(NULL) are guaranteed no-ops. This removes redundant null-check guards before these calls across 39 files, reducing code noise without behavioral change. Also simplifies map value cleanup in BRepClass3d_SolidExplorer by using iterator reference instead of redundant hash lookups.
This commit is contained in:
@@ -44,11 +44,8 @@ public:
|
||||
//! Destructor
|
||||
~MeshVS_Buffer()
|
||||
{
|
||||
if (myDynData)
|
||||
{
|
||||
Standard::Free(myDynData);
|
||||
myDynData = nullptr;
|
||||
}
|
||||
Standard::Free(myDynData);
|
||||
myDynData = nullptr;
|
||||
}
|
||||
|
||||
//! Cast the buffer to the void pointer
|
||||
|
||||
@@ -608,11 +608,8 @@ void Image_AlienPixMap::Clear()
|
||||
myPalette = NULL;
|
||||
}
|
||||
#elif defined(__EMSCRIPTEN__)
|
||||
if (myLibImage != NULL)
|
||||
{
|
||||
free((void*)myLibImage);
|
||||
myLibImage = NULL;
|
||||
}
|
||||
free((void*)myLibImage);
|
||||
myLibImage = NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user