[Expat-discuss] _msize does not have equivalent function in Nucleus
Hendry (Hai) Yang
haiyang at broadcom.com
Tue Dec 23 04:34:24 CET 2008
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
More information about the Expat-discuss
mailing list