Carbon


NewPtrClear

Header: MacMemory.h Carbon status: Supported

Allocates a nonrelocatable block of memory of a specified size with all its bytes set to 0.

Ptr NewPtrClear (
    Size byteCount
);
byteCount

The requested size (in bytes) of the nonrelocatable block.

function result

A pointer to the new block. If NewPtrClear fails to allocate a block of the requested size, it returns NULL.

DISCUSSION

The NewPtrClear function works much as the NewPtr function does, but sets all bytes in the new block to 0 instead of leaving the contents of the block undefined.

Currently, NewPtrClear clears the block one byte at a time. For a large block, it might be faster to write your own code to clear the block.

Call the function MemError to get the result code. See “Result Codes”.

Because NewPtrClear allocates memory, you should not call it at interrupt time.

AVAILABILITY

Supported in Carbon. Available in CarbonLib 1.0 and later when InterfaceLib 7.1 or later is installed. Exported by CarbonLib 1.0 and later and by InterfaceLib 7.1 and later.


© 2000 Apple Computer, Inc. — (Last Updated 4/6/2000)