Clone

« XPCOM API Reference

Summary

The Clone function creates a copy of an existing memory block up to the size specified.

 static void* Clone(
   const void* aPtr,
   size_t aSize
 );

Parameters

aPtr
[in] The address of the memory block to copy. This must be non-null.
aSize
[in] Specifies the new size in bytes of the block of memory to allocate. The buffer at aPtr must be at least aSize bytes in length.

Return Values

This function returns nsnull if the memory allocation fails. Otherwise, it returns a pointer to the newly allocated buffer. The result must be freed with a call to nsMemory::Free when it is no longer needed.

See Also

nsMemory::Free