|
Value: { \
uint32_t tempsize = nelems * sizeof(cast); \
if (ptr == NULL) \
{ \
ptr = (cast *)phCalloc(nelems,sizeof(cast)); \
phCHECK_NULLPTR(ptr,"phCalloc", \
"phCalloc failed(nelems:%lu,size:%lu)",\
(unsigned long)nelems,\
(unsigned long)tempsize); \
cursize = tempsize; \
} \
else \
{ \
if (cursize != tempsize)\
{ \
ptr = (cast *)phRealloc(ptr,tempsize); \
phCHECK_NULLPTR(ptr,"phRealloc",\
"phRealloc failed(nelems:%lu,size:%lu)",\
(unsigned long)nelems,\
(unsigned long)tempsize); \
cursize = tempsize; \
} \
phMemset(ptr,0,cursize); \
} \
}
Will resize to the requested memory size and zeroize memory. This is like calling phCalloc but it will resize to memory automatically. a.k.a: phDALLOC_NELEMS
phDALLOC will ALWAYS return zero'd memory; If you're going to memset, memcpy or otherwise set/reset all the data after resizing/alloc-ing the memory ANYWAY, then use phDALLOC_GROW;
Definition at line 197 of file phMemory.h. |