mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-09-12 17:17:44 -04:00
adjustments for consistency
This commit is contained in:
parent
3c56f1186a
commit
5e31a2f074
4 changed files with 15 additions and 12 deletions
|
@ -72,16 +72,18 @@ void * pvPortMalloc( size_t xWantedSize )
|
||||||
void * pvReturn = NULL;
|
void * pvReturn = NULL;
|
||||||
static uint8_t * pucAlignedHeap = NULL;
|
static uint8_t * pucAlignedHeap = NULL;
|
||||||
|
|
||||||
/* Ensure that blocks are always aligned to the required number of bytes. */
|
/* Ensure that blocks are always aligned. */
|
||||||
#if ( portBYTE_ALIGNMENT != 1 )
|
#if ( portBYTE_ALIGNMENT != 1 )
|
||||||
{
|
{
|
||||||
if( xWantedSize & portBYTE_ALIGNMENT_MASK )
|
if( xWantedSize & portBYTE_ALIGNMENT_MASK )
|
||||||
{
|
{
|
||||||
/* Byte alignment required, check for overflow first */
|
/* Byte alignment required. Check for overflow. */
|
||||||
if ( (xWantedSize + ( portBYTE_ALIGNMENT - ( xWantedSize & portBYTE_ALIGNMENT_MASK ) )) > xWantedSize )
|
if ( (xWantedSize + ( portBYTE_ALIGNMENT - ( xWantedSize & portBYTE_ALIGNMENT_MASK ) )) > xWantedSize )
|
||||||
{
|
{
|
||||||
xWantedSize += ( portBYTE_ALIGNMENT - ( xWantedSize & portBYTE_ALIGNMENT_MASK ) );
|
xWantedSize += ( portBYTE_ALIGNMENT - ( xWantedSize & portBYTE_ALIGNMENT_MASK ) );
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
xWantedSize = 0;
|
xWantedSize = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -139,7 +139,7 @@ void * pvPortMalloc( size_t xWantedSize )
|
||||||
{
|
{
|
||||||
xWantedSize += heapSTRUCT_SIZE;
|
xWantedSize += heapSTRUCT_SIZE;
|
||||||
|
|
||||||
/* Byte alignment required. (check for overflow again) */
|
/* Byte alignment required. Check for overflow. */
|
||||||
if( ( xWantedSize + ( portBYTE_ALIGNMENT - ( xWantedSize & portBYTE_ALIGNMENT_MASK ) ) )
|
if( ( xWantedSize + ( portBYTE_ALIGNMENT - ( xWantedSize & portBYTE_ALIGNMENT_MASK ) ) )
|
||||||
> xWantedSize )
|
> xWantedSize )
|
||||||
{
|
{
|
||||||
|
@ -150,8 +150,9 @@ void * pvPortMalloc( size_t xWantedSize )
|
||||||
{
|
{
|
||||||
xWantedSize = 0;
|
xWantedSize = 0;
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
/* If the requested size is too large to handle we force an error */
|
else
|
||||||
|
{
|
||||||
xWantedSize = 0;
|
xWantedSize = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -143,10 +143,10 @@ void * pvPortMalloc( size_t xWantedSize )
|
||||||
{
|
{
|
||||||
xWantedSize += xHeapStructSize;
|
xWantedSize += xHeapStructSize;
|
||||||
|
|
||||||
/* Ensure that blocks are always aligned */
|
/* Ensure that blocks are always aligned. */
|
||||||
if( ( xWantedSize & portBYTE_ALIGNMENT_MASK ) != 0x00 )
|
if( ( xWantedSize & portBYTE_ALIGNMENT_MASK ) != 0x00 )
|
||||||
{
|
{
|
||||||
/* Byte alignment required. (check for overflow again) */
|
/* Byte alignment required. Check for overflow. */
|
||||||
if( ( xWantedSize + ( portBYTE_ALIGNMENT - ( xWantedSize & portBYTE_ALIGNMENT_MASK ) ) )
|
if( ( xWantedSize + ( portBYTE_ALIGNMENT - ( xWantedSize & portBYTE_ALIGNMENT_MASK ) ) )
|
||||||
> xWantedSize )
|
> xWantedSize )
|
||||||
{
|
{
|
||||||
|
|
|
@ -150,15 +150,15 @@ void * pvPortMalloc( size_t xWantedSize )
|
||||||
{
|
{
|
||||||
/* The wanted size is increased so it can contain a BlockLink_t
|
/* The wanted size is increased so it can contain a BlockLink_t
|
||||||
* structure in addition to the requested amount of bytes. */
|
* structure in addition to the requested amount of bytes. */
|
||||||
if( ( xWantedSize > 0 ) && ( ( xWantedSize + xHeapStructSize ) > xWantedSize ) )
|
if( ( xWantedSize > 0 ) &&
|
||||||
|
( ( xWantedSize + xHeapStructSize ) > xWantedSize ) ) /* Overflow check */
|
||||||
{
|
{
|
||||||
xWantedSize += xHeapStructSize;
|
xWantedSize += xHeapStructSize;
|
||||||
|
|
||||||
/* Ensure that blocks are always aligned to the required number
|
/* Ensure that blocks are always aligned */
|
||||||
* of bytes. */
|
|
||||||
if( ( xWantedSize & portBYTE_ALIGNMENT_MASK ) != 0x00 )
|
if( ( xWantedSize & portBYTE_ALIGNMENT_MASK ) != 0x00 )
|
||||||
{
|
{
|
||||||
/* Byte alignment required. */
|
/* Byte alignment required. Check for overflow */
|
||||||
if( ( xWantedSize + ( portBYTE_ALIGNMENT - ( xWantedSize & portBYTE_ALIGNMENT_MASK ) ) ) >
|
if( ( xWantedSize + ( portBYTE_ALIGNMENT - ( xWantedSize & portBYTE_ALIGNMENT_MASK ) ) ) >
|
||||||
xWantedSize )
|
xWantedSize )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue