/** * Re-allocate memory. * * @param[in] portLibrary The port library * @param[in] memoryPointer Base address of memory to be re-allocated. * @param[in] byteAmount Number of bytes to re-allocated. * * @return pointer to memory on success, NULL on error. * * @internal @warning Do not call error handling code @ref hyerror upon error as * the error handling code uses per thread buffers to store the last error. If memory * can not be allocated the result would be an infinite loop. */ void *VMCALL hymem_reallocate_memory (struct HyPortLibrary *portLibrary, void *memoryPointer, UDATA byteAmount) { void *ptr = NULL; Trc_PRT_mem_hymem_reallocate_memory_Entry (memoryPointer, byteAmount); ptr = HeapReAlloc (PPG_mem_heap, 0, memoryPointer, byteAmount); Trc_PRT_mem_hymem_reallocate_memory_Exit (ptr); return ptr; }
/** * Re-allocate memory. * * @param[in] portLibrary The port library * @param[in] memoryPointer Base address of memory to be re-allocated. * @param[in] byteAmount Number of bytes to re-allocated. * * @return pointer to memory on success, NULL on error. * * @internal @warning Do not call error handling code @ref hyerror upon error as * the error handling code uses per thread buffers to store the last error. If memory * can not be allocated the result would be an infinite loop. */ void *VMCALL hymem_reallocate_memory (struct HyPortLibrary *portLibrary, void *memoryPointer, UDATA byteAmount) { void *ptr = NULL; Trc_PRT_mem_hymem_reallocate_memory_Entry (memoryPointer, byteAmount); ptr = realloc (memoryPointer, byteAmount); #if defined(HYS390) ptr = (void *) (((UDATA) ptr) & 0x7FFFFFFF); #endif Trc_PRT_mem_hymem_reallocate_memory_Exit (ptr); return ptr; }