CFDataCreateCopy |
||||
Header: | CFData.h | Carbon status: | Supported | |
Creates an immutable copy of a CFData object.
CFDataRef CFDataCreateCopy ( CFAllocatorRef allocator, CFDataRef data );
A reference to the new immutable CFData object or NULL if there was a problem creating the object.
The CFDataCreateCopy function creates a copy of a CFData object. The resulting object has the same byte contents as the original object, but it is always immutable. If the specified allocator and the allocator of the original object are the same, and the string is already immutable, this function may simply increment the retention count without making a true copy. To the caller, however, the resulting object is a true immutable copy, except the operation was a lot more efficient.
You should use the CFDataCreateCopy function when you pass a CFData into a function and the function needs to hold on to that object's value (and not that particular "instance" of the object). The CFDataCreateCopy function assures that a true, immutable copy is made for that function's own use as efficiently as possible.
Supported in Carbon. Available in Carbon 1.0.2 and later.
© 2000 Apple Computer, Inc. (Last Updated 6/30/2000)