Skip to content

Commit 30eddf4

Browse files
Revert "Fix MISRA C 2012 Rule 13.3 Violations (#988)"
This reverts commit 4d34700.
1 parent 4d34700 commit 30eddf4

File tree

3 files changed

+22
-21
lines changed

3 files changed

+22
-21
lines changed

include/list.h

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ typedef struct xLIST
326326
} \
327327
\
328328
( pxItemToRemove )->pxContainer = NULL; \
329-
( ( pxList )->uxNumberOfItems ) -= ( UBaseType_t ) 1U; \
329+
( pxList->uxNumberOfItems )--; \
330330
} while( 0 )
331331

332332
/*
@@ -363,17 +363,17 @@ typedef struct xLIST
363363
\
364364
/* Insert a new list item into ( pxList ), but rather than sort the list, \
365365
* makes the new list item the last item to be removed by a call to \
366-
* listGET_OWNER_OF_NEXT_ENTRY(). */ \
367-
( pxNewListItem )->pxNext = pxIndex; \
368-
( pxNewListItem )->pxPrevious = pxIndex->pxPrevious; \
369-
\
370-
pxIndex->pxPrevious->pxNext = ( pxNewListItem ); \
371-
pxIndex->pxPrevious = ( pxNewListItem ); \
372-
\
373-
/* Remember which list the item is in. */ \
374-
( pxNewListItem )->pxContainer = ( pxList ); \
375-
\
376-
( ( pxList )->uxNumberOfItems ) += ( UBaseType_t ) 1U; \
366+
* listGET_OWNER_OF_NEXT_ENTRY(). */ \
367+
( pxNewListItem )->pxNext = pxIndex; \
368+
( pxNewListItem )->pxPrevious = pxIndex->pxPrevious; \
369+
\
370+
pxIndex->pxPrevious->pxNext = ( pxNewListItem ); \
371+
pxIndex->pxPrevious = ( pxNewListItem ); \
372+
\
373+
/* Remember which list the item is in. */ \
374+
( pxNewListItem )->pxContainer = ( pxList ); \
375+
\
376+
( ( pxList )->uxNumberOfItems )++; \
377377
} while( 0 )
378378

379379
/*

list.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ void vListInsertEnd( List_t * const pxList,
130130
/* Remember which list the item is in. */
131131
pxNewListItem->pxContainer = pxList;
132132

133-
( pxList->uxNumberOfItems ) += ( UBaseType_t ) 1U;
133+
( pxList->uxNumberOfItems )++;
134134

135135
traceRETURN_vListInsertEnd();
136136
}
@@ -205,13 +205,12 @@ void vListInsert( List_t * const pxList,
205205
* item later. */
206206
pxNewListItem->pxContainer = pxList;
207207

208-
( pxList->uxNumberOfItems ) += ( UBaseType_t ) 1U;
208+
( pxList->uxNumberOfItems )++;
209209

210210
traceRETURN_vListInsert();
211211
}
212212
/*-----------------------------------------------------------*/
213213

214-
215214
UBaseType_t uxListRemove( ListItem_t * const pxItemToRemove )
216215
{
217216
/* 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 )
220219

221220
traceENTER_uxListRemove( pxItemToRemove );
222221

222+
223+
223224
pxItemToRemove->pxNext->pxPrevious = pxItemToRemove->pxPrevious;
224225
pxItemToRemove->pxPrevious->pxNext = pxItemToRemove->pxNext;
225226

@@ -237,7 +238,7 @@ UBaseType_t uxListRemove( ListItem_t * const pxItemToRemove )
237238
}
238239

239240
pxItemToRemove->pxContainer = NULL;
240-
( pxList->uxNumberOfItems ) -= ( UBaseType_t ) 1U;
241+
( pxList->uxNumberOfItems )--;
241242

242243
traceRETURN_uxListRemove( pxList->uxNumberOfItems );
243244

tasks.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@
255255
pxTemp = pxDelayedTaskList; \
256256
pxDelayedTaskList = pxOverflowDelayedTaskList; \
257257
pxOverflowDelayedTaskList = pxTemp; \
258-
xNumOfOverflows += ( BaseType_t ) 1; \
258+
xNumOfOverflows++; \
259259
prvResetNextTaskUnblockTime(); \
260260
} while( 0 )
261261

@@ -2021,7 +2021,7 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode,
20212021
* updated. */
20222022
taskENTER_CRITICAL();
20232023
{
2024-
uxCurrentNumberOfTasks += ( UBaseType_t ) 1U;
2024+
uxCurrentNumberOfTasks++;
20252025

20262026
if( pxCurrentTCB == NULL )
20272027
{
@@ -3815,7 +3815,7 @@ void vTaskSuspendAll( void )
38153815

38163816
/* The scheduler is suspended if uxSchedulerSuspended is non-zero. An increment
38173817
* is used to allow calls to vTaskSuspendAll() to nest. */
3818-
uxSchedulerSuspended += ( UBaseType_t ) 1U;
3818+
++uxSchedulerSuspended;
38193819

38203820
/* Enforces ordering for ports and optimised compilers that may otherwise place
38213821
* the above increment elsewhere. */
@@ -3968,7 +3968,7 @@ BaseType_t xTaskResumeAll( void )
39683968
* previous call to vTaskSuspendAll(). */
39693969
configASSERT( uxSchedulerSuspended != 0U );
39703970

3971-
uxSchedulerSuspended -= ( UBaseType_t ) 1U;
3971+
--uxSchedulerSuspended;
39723972
portRELEASE_TASK_LOCK();
39733973

39743974
if( uxSchedulerSuspended == ( UBaseType_t ) 0U )
@@ -4968,7 +4968,7 @@ BaseType_t xTaskIncrementTick( void )
49684968
}
49694969
else
49704970
{
4971-
xPendedTicks += 1U;
4971+
++xPendedTicks;
49724972

49734973
/* The tick hook gets called at regular intervals, even if the
49744974
* scheduler is locked. */

0 commit comments

Comments
 (0)