Skip to content

Commit 68bc14f

Browse files
Simplified the use of the ternary operator.
1 parent 591de8e commit 68bc14f

File tree

1 file changed

+10
-2
lines changed
  • secure_boot_and_secure_firmware_upgrade_over_canfd/icsp_inhibit.X

1 file changed

+10
-2
lines changed

secure_boot_and_secure_firmware_upgrade_over_canfd/icsp_inhibit.X/main.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,16 @@ static void ResetWindowOnMismatch(char *window, int *windowIndex, char receivedC
104104
MoveCursor(5);
105105
ClearTerminalLine();
106106
printf("Incorrect command received. Try again.");
107-
*windowIndex = (receivedChar == UNLOCK_COMMAND[0]) ? 1 : 0;
108-
window[0] = (*windowIndex == 1) ? receivedChar : '\0';
107+
if(receivedChar == UNLOCK_COMMAND[0])
108+
{
109+
*windowIndex = 1;
110+
window[0] = receivedChar;
111+
}
112+
else
113+
{
114+
*windowIndex = 0;
115+
window[0] = '\0';
116+
}
109117
}
110118

111119
static void CheckForUnlockCommand(char *window, int windowIndex)

0 commit comments

Comments
 (0)