Skip to content

Commit

Permalink
Fix nasa#103, Simplify CS_ComputeApp by removing redundant Result
Browse files Browse the repository at this point in the history
variable
  • Loading branch information
thnkslprpt committed Nov 30, 2024
1 parent f958cc0 commit cef2995
Showing 1 changed file with 7 additions and 11 deletions.
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

0 comments on commit cef2995

Please sign in to comment.