armandas wrote on Friday, February 08, 2019:
The xBufferSizeBytes parameter of the xMessageBufferCreate() needs to be manually increased by sizeof(size_t). Is there a good technical reason why this increment is not done internally?
E.g. inside xStreamBufferGenericCreate() we have an assert to check the buffer size:
if( xIsMessageBuffer == pdTRUE )
{
/* Is a message buffer but not statically allocated. */
ucFlags = sbFLAGS_IS_MESSAGE_BUFFER;
configASSERT( xBufferSizeBytes > sbBYTES_TO_STORE_MESSAGE_LENGTH );
}
when we could simply increment the size:
if( xIsMessageBuffer == pdTRUE )
{
/* Is a message buffer but not statically allocated. */
ucFlags = sbFLAGS_IS_MESSAGE_BUFFER;
xBufferSizeBytes += sbBYTES_TO_STORE_MESSAGE_LENGTH;
}