Skip to content

Commit

Permalink
Merge pull request #1120 from skliper/fix986-tbl_msg_init
Browse files Browse the repository at this point in the history
Fix #986, Remove unnecessary CFE_MSG_Init in TBL
  • Loading branch information
astrogeco committed Feb 3, 2021
2 parents 2f5dfb3 + 4a86e23 commit e739c3e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 21 deletions.
22 changes: 2 additions & 20 deletions fsw/cfe-core/src/tbl/cfe_tbl_internal.c
Original file line number Diff line number Diff line change
Expand Up @@ -139,20 +139,6 @@ int32 CFE_TBL_EarlyInit (void)
return Status;
}/* end if */

/*
** Initialize housekeeping packet (clear user data area)...
*/
CFE_MSG_Init(&CFE_TBL_TaskData.HkPacket.TlmHeader.Msg,
CFE_SB_ValueToMsgId(CFE_TBL_HK_TLM_MID),
sizeof(CFE_TBL_TaskData.HkPacket));

/*
** Initialize table registry report packet (clear user data area)...
*/
CFE_MSG_Init(&CFE_TBL_TaskData.TblRegPacket.TlmHeader.Msg,
CFE_SB_ValueToMsgId(CFE_TBL_REG_TLM_MID),
sizeof(CFE_TBL_TaskData.TblRegPacket));

/* Initialize memory partition and allocate shared table buffers. */
Status = CFE_ES_PoolCreate(&CFE_TBL_TaskData.Buf.PoolHdl,
CFE_TBL_TaskData.Buf.Partition.Data,
Expand Down Expand Up @@ -1510,12 +1496,8 @@ int32 CFE_TBL_SendNotificationMsg(CFE_TBL_RegistryRec_t *RegRecPtr)
/* First, determine if a message should be sent */
if (RegRecPtr->NotifyByMsg)
{
/*
** Initialize notification message packet (clear user data area)...
*/
CFE_MSG_Init(&CFE_TBL_TaskData.NotifyMsg.CmdHeader.Msg,
RegRecPtr->NotificationMsgId,
sizeof(CFE_TBL_TaskData.NotifyMsg));
/* Set the message ID */
CFE_MSG_SetMsgId(&CFE_TBL_TaskData.NotifyMsg.CmdHeader.Msg, RegRecPtr->NotificationMsgId);

/* Set the command code */
CFE_MSG_SetFcnCode(&CFE_TBL_TaskData.NotifyMsg.CmdHeader.Msg, RegRecPtr->NotificationCC);
Expand Down
5 changes: 5 additions & 0 deletions fsw/cfe-core/src/tbl/cfe_tbl_task.c
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,11 @@ void CFE_TBL_InitData(void)
CFE_SB_ValueToMsgId(CFE_TBL_REG_TLM_MID),
sizeof(CFE_TBL_TaskData.TblRegPacket));

/* Message ID is set when sent, so OK as 0 here */
CFE_MSG_Init(&CFE_TBL_TaskData.NotifyMsg.CmdHeader.Msg,
CFE_SB_ValueToMsgId(0),
sizeof(CFE_TBL_TaskData.NotifyMsg));

} /* End of CFE_TBL_InitData() */


Expand Down
2 changes: 1 addition & 1 deletion fsw/cfe-core/unit-test/tbl_UT.c
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ void Test_CFE_TBL_InitData(void)
/* This function has only one possible path with no return code */
UT_InitData();
CFE_TBL_InitData();
ASSERT_EQ(UT_GetStubCount(UT_KEY(CFE_MSG_Init)), 2);
ASSERT_EQ(UT_GetStubCount(UT_KEY(CFE_MSG_Init)), 3);
}

/*
Expand Down

0 comments on commit e739c3e

Please sign in to comment.