mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-21 10:13:43 +03:00
0023033: Standard_MMgrOpt::Reallocate behavior must be similar to "realloc"
Changes : Standard_MMgrOpt::Reallocate has been modified to allocate new memory block if NULL pointer has been passed.
This commit is contained in:
parent
2f43ec3255
commit
cf9a910a8a
@ -718,6 +718,12 @@ void Standard_MMgrOpt::FreePools()
|
|||||||
Standard_Address Standard_MMgrOpt::Reallocate(Standard_Address& theStorage,
|
Standard_Address Standard_MMgrOpt::Reallocate(Standard_Address& theStorage,
|
||||||
const Standard_Size theNewSize)
|
const Standard_Size theNewSize)
|
||||||
{
|
{
|
||||||
|
// if theStorage == NULL, just allocate new memory block
|
||||||
|
if (!theStorage)
|
||||||
|
{
|
||||||
|
return Allocate(theNewSize);
|
||||||
|
}
|
||||||
|
|
||||||
Standard_Size * aBlock = GET_BLOCK(theStorage);
|
Standard_Size * aBlock = GET_BLOCK(theStorage);
|
||||||
Standard_Address newStorage = NULL;
|
Standard_Address newStorage = NULL;
|
||||||
|
|
||||||
|
@ -104,7 +104,8 @@ class Standard_MMgrOpt : public Standard_MMgrRoot
|
|||||||
//! Allocate aSize bytes; see class description above
|
//! Allocate aSize bytes; see class description above
|
||||||
Standard_EXPORT virtual Standard_Address Allocate(const Standard_Size aSize);
|
Standard_EXPORT virtual Standard_Address Allocate(const Standard_Size aSize);
|
||||||
|
|
||||||
//! Reallocate previously allocated aPtr to a new size; aPtr is nullified
|
//! Reallocate previously allocated aPtr to a new size; aPtr is nullified.
|
||||||
|
//! In case that aPtr is null, the function behaves exactly as Allocate.
|
||||||
Standard_EXPORT virtual Standard_Address Reallocate(Standard_Address& aPtr,
|
Standard_EXPORT virtual Standard_Address Reallocate(Standard_Address& aPtr,
|
||||||
const Standard_Size aSize);
|
const Standard_Size aSize);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user