From 30eddf41e751fcd80afe609dd6128a2f9a238bd7 Mon Sep 17 00:00:00 2001 From: bradleysmith23 <74752142+bradleysmith23@users.noreply.github.com> Date: Wed, 14 Feb 2024 12:10:29 -0800 Subject: [PATCH] Revert "Fix MISRA C 2012 Rule 13.3 Violations (#988)" This reverts commit 4d34700bccbd8bcd09dca93e93ebabd692b2f185. --- include/list.h | 24 ++++++++++++------------ list.c | 9 +++++---- tasks.c | 10 +++++----- 3 files changed, 22 insertions(+), 21 deletions(-) diff --git a/include/list.h b/include/list.h index 9b96ab1377..7084834dc8 100644 --- a/include/list.h +++ b/include/list.h @@ -326,7 +326,7 @@ typedef struct xLIST } \ \ ( pxItemToRemove )->pxContainer = NULL; \ - ( ( pxList )->uxNumberOfItems ) -= ( UBaseType_t ) 1U; \ + ( pxList->uxNumberOfItems )--; \ } while( 0 ) /* @@ -363,17 +363,17 @@ typedef struct xLIST \ /* Insert a new list item into ( pxList ), but rather than sort the list, \ * makes the new list item the last item to be removed by a call to \ - * listGET_OWNER_OF_NEXT_ENTRY(). */ \ - ( pxNewListItem )->pxNext = pxIndex; \ - ( pxNewListItem )->pxPrevious = pxIndex->pxPrevious; \ - \ - pxIndex->pxPrevious->pxNext = ( pxNewListItem ); \ - pxIndex->pxPrevious = ( pxNewListItem ); \ - \ - /* Remember which list the item is in. */ \ - ( pxNewListItem )->pxContainer = ( pxList ); \ - \ - ( ( pxList )->uxNumberOfItems ) += ( UBaseType_t ) 1U; \ + * listGET_OWNER_OF_NEXT_ENTRY(). */ \ + ( pxNewListItem )->pxNext = pxIndex; \ + ( pxNewListItem )->pxPrevious = pxIndex->pxPrevious; \ + \ + pxIndex->pxPrevious->pxNext = ( pxNewListItem ); \ + pxIndex->pxPrevious = ( pxNewListItem ); \ + \ + /* Remember which list the item is in. */ \ + ( pxNewListItem )->pxContainer = ( pxList ); \ + \ + ( ( pxList )->uxNumberOfItems )++; \ } while( 0 ) /* diff --git a/list.c b/list.c index 0ac5b04a0d..9073008968 100644 --- a/list.c +++ b/list.c @@ -130,7 +130,7 @@ void vListInsertEnd( List_t * const pxList, /* Remember which list the item is in. */ pxNewListItem->pxContainer = pxList; - ( pxList->uxNumberOfItems ) += ( UBaseType_t ) 1U; + ( pxList->uxNumberOfItems )++; traceRETURN_vListInsertEnd(); } @@ -205,13 +205,12 @@ void vListInsert( List_t * const pxList, * item later. */ pxNewListItem->pxContainer = pxList; - ( pxList->uxNumberOfItems ) += ( UBaseType_t ) 1U; + ( pxList->uxNumberOfItems )++; traceRETURN_vListInsert(); } /*-----------------------------------------------------------*/ - UBaseType_t uxListRemove( ListItem_t * const pxItemToRemove ) { /* The list item knows which list it is in. Obtain the list from the list @@ -220,6 +219,8 @@ UBaseType_t uxListRemove( ListItem_t * const pxItemToRemove ) traceENTER_uxListRemove( pxItemToRemove ); + + pxItemToRemove->pxNext->pxPrevious = pxItemToRemove->pxPrevious; pxItemToRemove->pxPrevious->pxNext = pxItemToRemove->pxNext; @@ -237,7 +238,7 @@ UBaseType_t uxListRemove( ListItem_t * const pxItemToRemove ) } pxItemToRemove->pxContainer = NULL; - ( pxList->uxNumberOfItems ) -= ( UBaseType_t ) 1U; + ( pxList->uxNumberOfItems )--; traceRETURN_uxListRemove( pxList->uxNumberOfItems ); diff --git a/tasks.c b/tasks.c index c51c155a7f..95f60b1fb6 100644 --- a/tasks.c +++ b/tasks.c @@ -255,7 +255,7 @@ pxTemp = pxDelayedTaskList; \ pxDelayedTaskList = pxOverflowDelayedTaskList; \ pxOverflowDelayedTaskList = pxTemp; \ - xNumOfOverflows += ( BaseType_t ) 1; \ + xNumOfOverflows++; \ prvResetNextTaskUnblockTime(); \ } while( 0 ) @@ -2021,7 +2021,7 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode, * updated. */ taskENTER_CRITICAL(); { - uxCurrentNumberOfTasks += ( UBaseType_t ) 1U; + uxCurrentNumberOfTasks++; if( pxCurrentTCB == NULL ) { @@ -3815,7 +3815,7 @@ void vTaskSuspendAll( void ) /* The scheduler is suspended if uxSchedulerSuspended is non-zero. An increment * is used to allow calls to vTaskSuspendAll() to nest. */ - uxSchedulerSuspended += ( UBaseType_t ) 1U; + ++uxSchedulerSuspended; /* Enforces ordering for ports and optimised compilers that may otherwise place * the above increment elsewhere. */ @@ -3968,7 +3968,7 @@ BaseType_t xTaskResumeAll( void ) * previous call to vTaskSuspendAll(). */ configASSERT( uxSchedulerSuspended != 0U ); - uxSchedulerSuspended -= ( UBaseType_t ) 1U; + --uxSchedulerSuspended; portRELEASE_TASK_LOCK(); if( uxSchedulerSuspended == ( UBaseType_t ) 0U ) @@ -4968,7 +4968,7 @@ BaseType_t xTaskIncrementTick( void ) } else { - xPendedTicks += 1U; + ++xPendedTicks; /* The tick hook gets called at regular intervals, even if the * scheduler is locked. */