Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #986, Remove unnecessary CFE_MSG_Init in TBL #1120

Merged
merged 1 commit into from
Feb 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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