mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
0024489: Avoid type casts in call to Standard::Free()
Method Standard::Free() is converted to template, so that pointer is nullified using its proper type. Unnecessary type cases in calls to Standard::Free(), Standard::Reallocate(), and NCollection_BaseAllocator::Free() eliminated throughout OCCT code.
This commit is contained in:
@@ -43,7 +43,7 @@ void* NCollection_BaseAllocator::Allocate(const size_t size)
|
||||
|
||||
void NCollection_BaseAllocator::Free(void *anAddress)
|
||||
{
|
||||
if (anAddress) Standard::Free((Standard_Address&)anAddress);
|
||||
if (anAddress) Standard::Free(anAddress);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
|
@@ -65,7 +65,7 @@ protected:
|
||||
void Deallocate()
|
||||
{
|
||||
if (myPtr != myBuffer)
|
||||
Standard::Free (*(Standard_Address*)&myPtr);
|
||||
Standard::Free (myPtr);
|
||||
}
|
||||
|
||||
protected:
|
||||
|
@@ -232,9 +232,7 @@ private: //! @name low-level methods
|
||||
//! Release string buffer and nullify the pointer.
|
||||
static void strFree (Type*& thePtr)
|
||||
{
|
||||
void* aPtr = thePtr;
|
||||
Standard::Free (aPtr);
|
||||
thePtr = NULL;
|
||||
Standard::Free (thePtr);
|
||||
}
|
||||
|
||||
//! Provides bytes interface to avoid incorrect pointer arithmetics.
|
||||
|
Reference in New Issue
Block a user