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 #103, Simplify CS_ComputeApp by removing redundant Result variable #104

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
18 changes: 7 additions & 11 deletions fsw/src/cs_compute.c
Original file line number Diff line number Diff line change
Expand Up @@ -312,10 +312,9 @@ CFE_Status_t CS_ComputeApp(CS_Res_App_Table_Entry_t *ResultsEntry, uint32 *Compu
int32 NumBytesRemainingCycles = 0;
uint32 NewChecksumValue = 0;
CFE_Status_t Status = CFE_SUCCESS;
CFE_Status_t Result;
CFE_Status_t ResultGetResourceID = CS_ERROR;
CFE_Status_t ResultGetResourceInfo = CS_ERROR;
bool ResultAddressValid = false;
CFE_Status_t ResultGetResourceID = CS_ERROR;
CFE_Status_t ResultGetResourceInfo = CS_ERROR;
bool ResultAddressValid = false;

/* variables to get applications address */
CFE_ResourceId_t ResourceID = CFE_RESOURCEID_UNDEFINED;
Expand All @@ -332,37 +331,34 @@ CFE_Status_t CS_ComputeApp(CS_Res_App_Table_Entry_t *ResultsEntry, uint32 *Compu
/* Also check for a matching library name */
ResultGetResourceID = CFE_ES_GetLibIDByName((CFE_ES_LibId_t *)&ResourceID, ResultsEntry->Name);
}
Result = ResultGetResourceID;

if (Result == CFE_SUCCESS)
if (ResultGetResourceID == CFE_SUCCESS)
{
/* We got a valid ResourceID, so get the Resource info */

ResultGetResourceInfo = CFE_ES_GetModuleInfo(&AppInfo, ResourceID);
Result = ResultGetResourceInfo;
}

if (Result == CFE_SUCCESS)
if (ResultGetResourceInfo == CFE_SUCCESS)
{
/* We got a valid ResourceID and good App info, so check the for valid addresses */

if (AppInfo.AddressesAreValid == false)
{
CFE_EVS_SendEvent(CS_COMPUTE_APP_PLATFORM_DBG_EID, CFE_EVS_EventType_DEBUG,
"CS cannot get a valid address for %s, due to the platform", ResultsEntry->Name);
Result = CS_ERROR;
ResultGetResourceInfo = CS_ERROR;
}
else
{
/* Push in the data from the module info */
ResultsEntry->NumBytesToChecksum = AppInfo.CodeSize;
ResultsEntry->StartAddress = AppInfo.CodeAddress;
Result = CFE_SUCCESS;
ResultAddressValid = true;
}
}

if (Result == CFE_SUCCESS)
if (ResultGetResourceInfo == CFE_SUCCESS)
{
/* We got valid ResourceID, good info, and valid addresses, so run the checksum */

Expand Down
Loading