ReAlloc
(Available in 00 TS Tools(Base) - TS_Tools_PointerSafe)
Purpose
Change the size of the allocated memory
Syntax
IF !oPointerSafe:ReAlloc( oPointerSafe:ItemMax+100 )
Arguments
Description
Change the size of the allocated memory all previously allocated data is preserved. The method will return TRUE if it succeeded.
Note: This method will not decrease the amount of allocated memory.
Returns
TRUE if succeeded
Example
oPointerSafe:=TS_PointerSafe{ oOwner, 10, _SIZEOF( _WinGUID ) }
FOR X:=1 UPTO 100
IF X>oPointerSafe:ItemMax
IF !oPointerSafe:ReAlloc( oPointerSafe:ItemMax+10 )
TSTrace Fatal "!oPointerSafe:ReAlloc(oPointerSafe:ItemMax+10)"
END
END
pGUID:=oPointerSafe:ItemPointer( X )
// Do something with the GUID-pointer
...
NEXT
Source
METHOD ReAlloc( dwItemMax AS DWORD ) AS LOGIC PASCAL CLASS TS_PointerSafe
LOCAL oPointerSafe AS TS_PointerSafe
LOCAL lRetVal AS LOGIC
TSTrace Enter
DO CASE
CASE dwItemMax<=SELF:_ItemMax
lRetVal:=TRUE
CASE SELF:_BytesPointer==NULL_PTR .OR. SELF:_BytesAllocated ; ...
... ==