1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-14 13:30:48 +03:00

0024533: Use 0 to check null handle instead of UndefinedHandleAccess

Handle classes now use 0 as invalid value for pointer instead of custom (and platform-dependent) value like 0xfefd0000.
Compiler macros UndefinedHandleAddress and _OCC64 are eliminated.
This commit is contained in:
Roman Lygin
2014-01-23 13:37:50 +04:00
committed by bugmaster
parent 545ef510a7
commit 4d9421a970
8 changed files with 30 additions and 85 deletions

View File

@@ -26,7 +26,7 @@ void Handle(Standard_Transient)::Dump(Standard_OStream& out) const
void Handle(Standard_Transient)::Assign (const Standard_Transient *anItem)
{
Standard_Transient *anIt = ( anItem ? (Standard_Transient*)anItem : UndefinedHandleAddress );
Standard_Transient *anIt = (Standard_Transient*)anItem;
if ( anIt == entity ) return;
EndScope();
entity = anIt;
@@ -37,7 +37,7 @@ void Handle(Standard_Transient)::Assign (const Standard_Transient *anItem)
void Handle(Standard_Transient)::BeginScope()
{
if (entity != UndefinedHandleAddress)
if (entity != 0)
{
Standard_Atomic_Increment (&entity->count);
}
@@ -47,9 +47,9 @@ void Handle(Standard_Transient)::BeginScope()
void Handle(Standard_Transient)::EndScope()
{
if (entity == UndefinedHandleAddress)
if (entity == 0)
return;
if (Standard_Atomic_Decrement (&entity->count) == 0)
entity->Delete();
entity = UndefinedHandleAddress;
entity = 0;
}