Skip to content

Commit

Permalink
Fix nasa#1002, remove extra newlines in utassert logs
Browse files Browse the repository at this point in the history
If messages (e.g. from UtPrintf, etc) already have a newline,
do not add another.
  • Loading branch information
jphickey committed May 12, 2021
1 parent a61ed02 commit 51e4f85
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions ut_assert/src/utbsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ void UT_BSP_DoText(uint8 MessageType, const char *OutputMessage)
{
const char *Prefix;
char Buffer[16];
size_t MsgLen;
uint32 TermModeBits = OS_BSP_CONSOLEMODE_NORMAL;
uint32 MsgEnabled = BSP_UT_Global.CurrVerbosity >> MessageType;

Expand Down Expand Up @@ -182,8 +183,12 @@ void UT_BSP_DoText(uint8 MessageType, const char *OutputMessage)
}

OS_BSP_ConsoleOutput_Impl(" ", 1);
OS_BSP_ConsoleOutput_Impl(OutputMessage, strlen(OutputMessage));
OS_BSP_ConsoleOutput_Impl("\n", 1);
MsgLen = strlen(OutputMessage);
OS_BSP_ConsoleOutput_Impl(OutputMessage, MsgLen);
if (MsgLen == 0 || OutputMessage[MsgLen - 1] != '\n')
{
OS_BSP_ConsoleOutput_Impl("\n", 1);
}

OS_BSP_Unlock_Impl();
}
Expand Down

0 comments on commit 51e4f85

Please sign in to comment.