Added better pointer declaration readability (#567)

* Add better pointer declaration readability

I revised the declaration of single-line pointers by splitting it into
multiple lines. Now, every pointer is declared (and initialized
accordingly) on its own line. This refactoring should enhance
readability and decrease the probability of error when a new pointer is
added/removed or a current one has its initialization value modified.

Signed-off-by: Cristian Cristea <cristiancristea00@gmail.com>

* Remove unnecessary whitespace characters and lines

It removes whitespace characters at the end of lines (empty or
othwerwise) and clear lines at the end of the file (only one remains).
It is an automatic operation done by git.

Signed-off-by: Cristian Cristea <cristiancristea00@gmail.com>

Signed-off-by: Cristian Cristea <cristiancristea00@gmail.com>
This commit is contained in:
Cristian Cristea 2022-09-27 00:43:30 +03:00 committed by GitHub
parent f789a0e790
commit 24ade42a37
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
20 changed files with 92 additions and 55 deletions

View File

@ -533,7 +533,8 @@ EventBits_t xEventGroupGetBitsFromISR( EventGroupHandle_t xEventGroup )
EventBits_t xEventGroupSetBits( EventGroupHandle_t xEventGroup,
const EventBits_t uxBitsToSet )
{
ListItem_t * pxListItem, * pxNext;
ListItem_t * pxListItem;
ListItem_t * pxNext;
ListItem_t const * pxListEnd;
List_t const * pxList;
EventBits_t uxBitsToClear = 0, uxBitsWaitedFor, uxControlBits;

View File

@ -113,7 +113,8 @@ static const size_t xHeapStructSize = ( sizeof( BlockLink_t ) + ( ( size_t ) ( s
/**
* @brief Create a couple of list links to mark the start and end of the list.
*/
static BlockLink_t xStart, * pxEnd = NULL;
static BlockLink_t xStart;
static BlockLink_t * pxEnd = NULL;
/**
* @brief Keeps track of the number of free bytes remaining, but says nothing
@ -245,7 +246,9 @@ static void prvInsertBlockIntoFreeList( BlockLink_t * pxBlockToInsert )
void * pvPortMalloc( size_t xWantedSize )
{
BlockLink_t * pxBlock, * pxPreviousBlock, * pxNewBlockLink;
BlockLink_t * pxBlock;
BlockLink_t * pxPreviousBlock;
BlockLink_t * pxNewBlockLink;
void * pvReturn = NULL;
/* If this is the first call to malloc then the heap will require

View File

@ -113,7 +113,8 @@ static const size_t xHeapStructSize = ( sizeof( BlockLink_t ) + ( ( size_t ) ( s
/**
* @brief Create a couple of list links to mark the start and end of the list.
*/
static BlockLink_t xStart, * pxEnd = NULL;
static BlockLink_t xStart;
static BlockLink_t * pxEnd = NULL;
/**
* @brief Keeps track of the number of free bytes remaining, but says nothing
@ -245,7 +246,9 @@ static void prvInsertBlockIntoFreeList( BlockLink_t * pxBlockToInsert )
void * pvPortMalloc( size_t xWantedSize )
{
BlockLink_t * pxBlock, * pxPreviousBlock, * pxNewBlockLink;
BlockLink_t * pxBlock;
BlockLink_t * pxPreviousBlock;
BlockLink_t * pxNewBlockLink;
void * pvReturn = NULL;
/* If this is the first call to malloc then the heap will require

View File

@ -113,7 +113,8 @@ static const size_t xHeapStructSize = ( sizeof( BlockLink_t ) + ( ( size_t ) ( s
/**
* @brief Create a couple of list links to mark the start and end of the list.
*/
static BlockLink_t xStart, * pxEnd = NULL;
static BlockLink_t xStart;
static BlockLink_t * pxEnd = NULL;
/**
* @brief Keeps track of the number of free bytes remaining, but says nothing
@ -245,7 +246,9 @@ static void prvInsertBlockIntoFreeList( BlockLink_t * pxBlockToInsert )
void * pvPortMalloc( size_t xWantedSize )
{
BlockLink_t * pxBlock, * pxPreviousBlock, * pxNewBlockLink;
BlockLink_t * pxBlock;
BlockLink_t * pxPreviousBlock;
BlockLink_t * pxNewBlockLink;
void * pvReturn = NULL;
/* If this is the first call to malloc then the heap will require

View File

@ -113,7 +113,8 @@ static const size_t xHeapStructSize = ( sizeof( BlockLink_t ) + ( ( size_t ) ( s
/**
* @brief Create a couple of list links to mark the start and end of the list.
*/
static BlockLink_t xStart, * pxEnd = NULL;
static BlockLink_t xStart;
static BlockLink_t * pxEnd = NULL;
/**
* @brief Keeps track of the number of free bytes remaining, but says nothing
@ -245,7 +246,9 @@ static void prvInsertBlockIntoFreeList( BlockLink_t * pxBlockToInsert )
void * pvPortMalloc( size_t xWantedSize )
{
BlockLink_t * pxBlock, * pxPreviousBlock, * pxNewBlockLink;
BlockLink_t * pxBlock;
BlockLink_t * pxPreviousBlock;
BlockLink_t * pxNewBlockLink;
void * pvReturn = NULL;
/* If this is the first call to malloc then the heap will require

View File

@ -113,7 +113,8 @@ static const size_t xHeapStructSize = ( sizeof( BlockLink_t ) + ( ( size_t ) ( s
/**
* @brief Create a couple of list links to mark the start and end of the list.
*/
static BlockLink_t xStart, * pxEnd = NULL;
static BlockLink_t xStart;
static BlockLink_t * pxEnd = NULL;
/**
* @brief Keeps track of the number of free bytes remaining, but says nothing
@ -245,7 +246,9 @@ static void prvInsertBlockIntoFreeList( BlockLink_t * pxBlockToInsert )
void * pvPortMalloc( size_t xWantedSize )
{
BlockLink_t * pxBlock, * pxPreviousBlock, * pxNewBlockLink;
BlockLink_t * pxBlock;
BlockLink_t * pxPreviousBlock;
BlockLink_t * pxNewBlockLink;
void * pvReturn = NULL;
/* If this is the first call to malloc then the heap will require

View File

@ -88,7 +88,8 @@ static void prvSetupTimerInterrupt( void );
*/
StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, TaskFunction_t pxCode, void *pvParameters )
{
extern void *_SDA2_BASE_, *_SDA_BASE_;
extern void * _SDA2_BASE_;
extern void * _SDA_BASE_;
const uint32_t ulR2 = ( uint32_t ) &_SDA2_BASE_;
const uint32_t ulR13 = ( uint32_t ) &_SDA_BASE_;
@ -327,8 +328,3 @@ uint32_t ulCSR;
XTmrCtr_mSetControlStatusReg( XPAR_OPB_TIMER_1_BASEADDR, portCOUNTER_0, ulCSR );
}
/*-----------------------------------------------------------*/

View File

@ -48,7 +48,7 @@ the scheduler being commenced interrupts should not be enabled, so the critical
nesting variable is initialised to a non-zero value. */
#define portINITIAL_NESTING_VALUE ( 0xff )
/* The bit within the MSR register that enabled/disables interrupts and
/* The bit within the MSR register that enabled/disables interrupts and
exceptions respectively. */
#define portMSR_IE ( 0x02U )
#define portMSR_EE ( 0x100U )
@ -106,7 +106,8 @@ static XIntc xInterruptControllerInstance;
*/
StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, TaskFunction_t pxCode, void *pvParameters )
{
extern void *_SDA2_BASE_, *_SDA_BASE_;
extern void * _SDA2_BASE_;
extern void * _SDA_BASE_;
const uint32_t ulR2 = ( uint32_t ) &_SDA2_BASE_;
const uint32_t ulR13 = ( uint32_t ) &_SDA_BASE_;
@ -130,7 +131,7 @@ const uint32_t ulR13 = ( uint32_t ) &_SDA_BASE_;
disabled. Each task will enable interrupts automatically when it enters
the running state for the first time. */
*pxTopOfStack = mfmsr() & ~portMSR_IE;
#if( MICROBLAZE_EXCEPTIONS_ENABLED == 1 )
{
/* Ensure exceptions are enabled for the task. */
@ -449,5 +450,3 @@ int32_t lStatus;
return lStatus;
}
/*-----------------------------------------------------------*/

View File

@ -111,7 +111,8 @@ StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, StackType_t *pxEn
StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, TaskFunction_t pxCode, void *pvParameters )
#endif
{
extern void *_SDA2_BASE_, *_SDA_BASE_;
extern void * _SDA2_BASE_;
extern void * _SDA_BASE_;
const uint32_t ulR2 = ( uint32_t ) &_SDA2_BASE_;
const uint32_t ulR13 = ( uint32_t ) &_SDA_BASE_;
extern void _start1( void );
@ -487,5 +488,3 @@ int32_t lStatus;
return lStatus;
}
/*-----------------------------------------------------------*/

View File

@ -113,7 +113,8 @@ static const size_t xHeapStructSize = ( sizeof( BlockLink_t ) + ( ( size_t ) ( s
/**
* @brief Create a couple of list links to mark the start and end of the list.
*/
static BlockLink_t xStart, * pxEnd = NULL;
static BlockLink_t xStart;
static BlockLink_t * pxEnd = NULL;
/**
* @brief Keeps track of the number of free bytes remaining, but says nothing
@ -245,7 +246,9 @@ static void prvInsertBlockIntoFreeList( BlockLink_t * pxBlockToInsert )
void * pvPortMalloc( size_t xWantedSize )
{
BlockLink_t * pxBlock, * pxPreviousBlock, * pxNewBlockLink;
BlockLink_t * pxBlock;
BlockLink_t * pxPreviousBlock;
BlockLink_t * pxNewBlockLink;
void * pvReturn = NULL;
/* If this is the first call to malloc then the heap will require

View File

@ -113,7 +113,8 @@ static const size_t xHeapStructSize = ( sizeof( BlockLink_t ) + ( ( size_t ) ( s
/**
* @brief Create a couple of list links to mark the start and end of the list.
*/
static BlockLink_t xStart, * pxEnd = NULL;
static BlockLink_t xStart;
static BlockLink_t * pxEnd = NULL;
/**
* @brief Keeps track of the number of free bytes remaining, but says nothing
@ -245,7 +246,9 @@ static void prvInsertBlockIntoFreeList( BlockLink_t * pxBlockToInsert )
void * pvPortMalloc( size_t xWantedSize )
{
BlockLink_t * pxBlock, * pxPreviousBlock, * pxNewBlockLink;
BlockLink_t * pxBlock;
BlockLink_t * pxPreviousBlock;
BlockLink_t * pxNewBlockLink;
void * pvReturn = NULL;
/* If this is the first call to malloc then the heap will require

View File

@ -113,7 +113,8 @@ static const size_t xHeapStructSize = ( sizeof( BlockLink_t ) + ( ( size_t ) ( s
/**
* @brief Create a couple of list links to mark the start and end of the list.
*/
static BlockLink_t xStart, * pxEnd = NULL;
static BlockLink_t xStart;
static BlockLink_t * pxEnd = NULL;
/**
* @brief Keeps track of the number of free bytes remaining, but says nothing
@ -245,7 +246,9 @@ static void prvInsertBlockIntoFreeList( BlockLink_t * pxBlockToInsert )
void * pvPortMalloc( size_t xWantedSize )
{
BlockLink_t * pxBlock, * pxPreviousBlock, * pxNewBlockLink;
BlockLink_t * pxBlock;
BlockLink_t * pxPreviousBlock;
BlockLink_t * pxNewBlockLink;
void * pvReturn = NULL;
/* If this is the first call to malloc then the heap will require

View File

@ -113,7 +113,8 @@ static const size_t xHeapStructSize = ( sizeof( BlockLink_t ) + ( ( size_t ) ( s
/**
* @brief Create a couple of list links to mark the start and end of the list.
*/
static BlockLink_t xStart, * pxEnd = NULL;
static BlockLink_t xStart;
static BlockLink_t * pxEnd = NULL;
/**
* @brief Keeps track of the number of free bytes remaining, but says nothing
@ -245,7 +246,9 @@ static void prvInsertBlockIntoFreeList( BlockLink_t * pxBlockToInsert )
void * pvPortMalloc( size_t xWantedSize )
{
BlockLink_t * pxBlock, * pxPreviousBlock, * pxNewBlockLink;
BlockLink_t * pxBlock;
BlockLink_t * pxPreviousBlock;
BlockLink_t * pxNewBlockLink;
void * pvReturn = NULL;
/* If this is the first call to malloc then the heap will require

View File

@ -152,7 +152,9 @@ static void prvHeapInit( void ) PRIVILEGED_FUNCTION;
void * pvPortMalloc( size_t xWantedSize )
{
BlockLink_t * pxBlock, * pxPreviousBlock, * pxNewBlockLink;
BlockLink_t * pxBlock;
BlockLink_t * pxPreviousBlock;
BlockLink_t * pxNewBlockLink;
PRIVILEGED_DATA static BaseType_t xHeapHasBeenInitialised = pdFALSE;
void * pvReturn = NULL;
size_t xAdditionalRequiredSize;

View File

@ -123,7 +123,8 @@ static void prvHeapInit( void ) PRIVILEGED_FUNCTION;
static const size_t xHeapStructSize = ( sizeof( BlockLink_t ) + ( ( size_t ) ( portBYTE_ALIGNMENT - 1 ) ) ) & ~( ( size_t ) portBYTE_ALIGNMENT_MASK );
/* Create a couple of list links to mark the start and end of the list. */
PRIVILEGED_DATA static BlockLink_t xStart, * pxEnd = NULL;
PRIVILEGED_DATA static BlockLink_t xStart;
PRIVILEGED_DATA static BlockLink_t * pxEnd = NULL;
/* Keeps track of the number of calls to allocate and free memory as well as the
* number of free bytes remaining, but says nothing about fragmentation. */
@ -136,7 +137,9 @@ PRIVILEGED_DATA static size_t xNumberOfSuccessfulFrees = 0;
void * pvPortMalloc( size_t xWantedSize )
{
BlockLink_t * pxBlock, * pxPreviousBlock, * pxNewBlockLink;
BlockLink_t * pxBlock;
BlockLink_t * pxPreviousBlock;
BlockLink_t * pxNewBlockLink;
void * pvReturn = NULL;
size_t xAdditionalRequiredSize;

View File

@ -141,7 +141,8 @@ static void prvInsertBlockIntoFreeList( BlockLink_t * pxBlockToInsert );
static const size_t xHeapStructSize = ( sizeof( BlockLink_t ) + ( ( size_t ) ( portBYTE_ALIGNMENT - 1 ) ) ) & ~( ( size_t ) portBYTE_ALIGNMENT_MASK );
/* Create a couple of list links to mark the start and end of the list. */
static BlockLink_t xStart, * pxEnd = NULL;
static BlockLink_t xStart;
static BlockLink_t * pxEnd = NULL;
/* Keeps track of the number of calls to allocate and free memory as well as the
* number of free bytes remaining, but says nothing about fragmentation. */
@ -154,7 +155,9 @@ static size_t xNumberOfSuccessfulFrees = 0;
void * pvPortMalloc( size_t xWantedSize )
{
BlockLink_t * pxBlock, * pxPreviousBlock, * pxNewBlockLink;
BlockLink_t * pxBlock;
BlockLink_t * pxPreviousBlock;
BlockLink_t * pxNewBlockLink;
void * pvReturn = NULL;
size_t xAdditionalRequiredSize;
@ -441,7 +444,8 @@ static void prvInsertBlockIntoFreeList( BlockLink_t * pxBlockToInsert )
void vPortDefineHeapRegions( const HeapRegion_t * const pxHeapRegions )
{
BlockLink_t * pxFirstFreeBlockInRegion = NULL, * pxPreviousFreeBlock;
BlockLink_t * pxFirstFreeBlockInRegion = NULL;
BlockLink_t * pxPreviousFreeBlock;
portPOINTER_SIZE_TYPE xAlignedHeap;
size_t xTotalRegionSize, xTotalHeapSize = 0;
BaseType_t xDefinedRegions = 0;

View File

@ -140,7 +140,8 @@ void _xt_user_exit( void );
#endif
/* *INDENT-ON* */
{
StackType_t * sp, * tp;
StackType_t * sp;
StackType_t * tp;
XtExcFrame * frame;
#if XCHAL_CP_NUM > 0

View File

@ -67,7 +67,8 @@ StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, TaskFunction_t px
StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, TaskFunction_t pxCode, void *pvParameters )
#endif
{
StackType_t * sp, * tp;
StackType_t * sp;
StackType_t * tp;
XtExcFrame * frame;
#if XCHAL_CP_NUM > 0

View File

@ -28,8 +28,8 @@
/*
Changes from V1.00:
+ pxPortInitialiseStack() now initialises the stack of new tasks to the
+ pxPortInitialiseStack() now initialises the stack of new tasks to the
same format used by the compiler. This allows the compiler generated
interrupt mechanism to be used for context switches.
@ -43,7 +43,7 @@ Changes from V2.6.1:
+ usPortCheckFreeStackSpace() has been moved to tasks.c.
*/
#include <stdlib.h>
#include "FreeRTOS.h"
@ -53,9 +53,10 @@ Changes from V2.6.1:
/* See header file for description. */
StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, TaskFunction_t pxCode, void *pvParameters )
{
StackType_t DS_Reg = 0, *pxOriginalSP;
StackType_t DS_Reg = 0;
StackType_t * pxOriginalSP;
/* Place a few bytes of known values on the bottom of the stack.
/* Place a few bytes of known values on the bottom of the stack.
This is just useful for debugging. */
*pxTopOfStack = 0x1111;
@ -74,9 +75,9 @@ StackType_t DS_Reg = 0, *pxOriginalSP;
/* We are going to start the scheduler using a return from interrupt
instruction to load the program counter, so first there would be the
status register and interrupt return address. We make this the start
status register and interrupt return address. We make this the start
of the task. */
*pxTopOfStack = portINITIAL_SW;
*pxTopOfStack = portINITIAL_SW;
pxTopOfStack--;
*pxTopOfStack = FP_SEG( pxCode );
pxTopOfStack--;
@ -86,11 +87,11 @@ StackType_t DS_Reg = 0, *pxOriginalSP;
/* We are going to setup the stack for the new task to look like
the stack frame was setup by a compiler generated ISR. We need to know
the address of the existing stack top to place in the SP register within
the stack frame. pxOriginalSP holds SP before (simulated) pusha was
the stack frame. pxOriginalSP holds SP before (simulated) pusha was
called. */
pxOriginalSP = pxTopOfStack;
/* The remaining registers would be pushed on the stack by our context
/* The remaining registers would be pushed on the stack by our context
switch function. These are loaded with values simply to make debugging
easier. */
*pxTopOfStack = FP_OFF( pvParameters ); /* AX */
@ -138,5 +139,3 @@ StackType_t DS_Reg = 0, *pxOriginalSP;
return pxTopOfStack;
}
/*-----------------------------------------------------------*/

11
tasks.c
View File

@ -1346,7 +1346,9 @@ static void prvAddNewTaskToReadyList( TCB_t * pxNewTCB )
eTaskState eTaskGetState( TaskHandle_t xTask )
{
eTaskState eReturn;
List_t const * pxStateList, * pxDelayedList, * pxOverflowedDelayedList;
List_t const * pxStateList;
List_t const * pxDelayedList;
List_t const * pxOverflowedDelayedList;
const TCB_t * const pxTCB = xTask;
configASSERT( pxTCB );
@ -2352,7 +2354,9 @@ char * pcTaskGetName( TaskHandle_t xTaskToQuery ) /*lint !e971 Unqualified char
static TCB_t * prvSearchForNameWithinSingleList( List_t * pxList,
const char pcNameToQuery[] )
{
TCB_t * pxNextTCB, * pxFirstTCB, * pxReturn = NULL;
TCB_t * pxNextTCB;
TCB_t * pxFirstTCB;
TCB_t * pxReturn = NULL;
UBaseType_t x;
char cNextChar;
BaseType_t xBreakLoop;
@ -3815,7 +3819,8 @@ static void prvCheckTasksWaitingTermination( void )
List_t * pxList,
eTaskState eState )
{
configLIST_VOLATILE TCB_t * pxNextTCB, * pxFirstTCB;
configLIST_VOLATILE TCB_t * pxNextTCB;
configLIST_VOLATILE TCB_t * pxFirstTCB;
UBaseType_t uxTask = 0;
if( listCURRENT_LIST_LENGTH( pxList ) > ( UBaseType_t ) 0 )