Important: The information in this document is obsolete and should not be used for new development.
GetPtrSize
You can use theGetPtrSize
function to find out the logical size of the nonrelocatable block corresponding to a pointer.
FUNCTION GetPtrSize (p: Ptr): Size;
p
- A pointer to a nonrelocatable block.
DESCRIPTION
TheGetPtrSize
function returns the logical size, in bytes, of the nonrelocatable block pointed to byp
. In case of an error,GetPtrSize
returns 0.ASSEMBLY-LANGUAGE INFORMATION
The registers on entry and exit forGetPtrSize
are
Registers on entry A0 Pointer to the nonrelocatable block
Registers on exit D0 If >=0
, number of bytes in nonrelocatable blockIf <0
, result codeThe trap dispatcher sets the condition codes before returning from a trap by testing the low-order word of register D0 with a
TST.W
instruction. Because the block size returned in D0 by_GetPtrSize
is a full 32-bit long word, the word-length test sets the condition codes incorrectly in this case. To branch on the contents of D0, use your ownTST.L
instruction on return from the trap to test the full 32 bits of the register.RESULT CODES
noErr 0 No error memWZErr -111 Attempt to operate on a free block