Skip to content

Commit ac43135

Browse files
chinglee-iotUbuntukar-rahul-awsaggarg
authored
Not to use object modified in the loop body (FreeRTOS#861)
Co-authored-by: Ubuntu <[email protected]> Co-authored-by: Rahul Kar <[email protected]> Co-authored-by: Gaurav-Aggarwal-AWS <[email protected]>
1 parent 09c4c4b commit ac43135

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

tasks.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7231,7 +7231,7 @@ static void prvResetNextTaskUnblockTime( void )
72317231
uxArraySize = uxTaskGetSystemState( pxTaskStatusArray, uxArraySize, NULL );
72327232

72337233
/* Create a human readable table from the binary data. */
7234-
for( x = 0; ( x < uxArraySize ) && ( xOutputBufferFull == pdFALSE ); x++ )
7234+
for( x = 0; x < uxArraySize; x++ )
72357235
{
72367236
switch( pxTaskStatusArray[ x ].eCurrentState )
72377237
{
@@ -7310,6 +7310,11 @@ static void prvResetNextTaskUnblockTime( void )
73107310
{
73117311
xOutputBufferFull = pdTRUE;
73127312
}
7313+
7314+
if( xOutputBufferFull == pdTRUE )
7315+
{
7316+
break;
7317+
}
73137318
}
73147319

73157320
/* Free the array again. NOTE! If configSUPPORT_DYNAMIC_ALLOCATION
@@ -7391,7 +7396,7 @@ static void prvResetNextTaskUnblockTime( void )
73917396
if( ulTotalTime > 0UL )
73927397
{
73937398
/* Create a human readable table from the binary data. */
7394-
for( x = 0; ( x < uxArraySize ) && ( xOutputBufferFull == pdFALSE ); x++ )
7399+
for( x = 0; x < uxArraySize; x++ )
73957400
{
73967401
/* What percentage of the total run time has the task used?
73977402
* This will always be rounded down to the nearest integer.
@@ -7472,6 +7477,11 @@ static void prvResetNextTaskUnblockTime( void )
74727477
{
74737478
xOutputBufferFull = pdTRUE;
74747479
}
7480+
7481+
if( xOutputBufferFull == pdTRUE )
7482+
{
7483+
break;
7484+
}
74757485
}
74767486
}
74777487
else

0 commit comments

Comments
 (0)