_msize does not have equivalent function in Nucleus
"Hendry (Hai) Yang" <[email protected]> Mon, 22 Dec 2008 19:34:24 -0800
| Newsgroups | gmane.text.xml.expat.general |
|---|---|
| Message-ID | <416D5CF71C9F2C438F7049770CDC2AE72504096B07@IRVEXCHCCR02.corp.ad.broadcom.com> |
Hi all,
A standard realization of realloc function in Microsoft VC as below:
void* realloc(void* buf, size_t len)
{
void* newBuf ;
// Get rid of degenerate cases
if (buf == 0) return malloc(len);
if (len == 0)
{
free(buf);
return 0;
}
// Need to move memory, acquire new chunk
newBuf = malloc(len);
if (!newBuf ) return 0;
// Move data to the new location
memcpy(newBuf , buf, min(_msize(buf), len));
free(buf);
return newBuf ;
}
I need to port this function to Nucleus(RTOS) but there is no function equivalent to _msize which return the size of a buffer. Any advice?
Does anyone know how Microsoft return the size of a buffer and why RTOS can not?
Thanks
Hai