From 258a9b0c8576a331786f56c2fdcc3486e02296de Mon Sep 17 00:00:00 2001 From: Avi Weiss Date: Wed, 3 May 2023 15:28:14 +1000 Subject: [PATCH] Fix #54, Combine multiple unnecessary `status`/`result` variables --- fsw/src/md_dwell_tbl.c | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/fsw/src/md_dwell_tbl.c b/fsw/src/md_dwell_tbl.c index 7361f7b..056ed05 100644 --- a/fsw/src/md_dwell_tbl.c +++ b/fsw/src/md_dwell_tbl.c @@ -337,16 +337,14 @@ CFE_Status_t MD_UpdateTableEnabledField(uint16 TableIndex, uint16 FieldValue) { CFE_Status_t Status = CFE_SUCCESS; MD_DwellTableLoad_t *MD_LoadTablePtr = NULL; - CFE_Status_t GetAddressResult; - GetAddressResult = CFE_TBL_GetAddress((void *)&MD_LoadTablePtr, MD_AppData.MD_TableHandle[TableIndex]); + Status = CFE_TBL_GetAddress((void *)&MD_LoadTablePtr, MD_AppData.MD_TableHandle[TableIndex]); - if ((GetAddressResult != CFE_SUCCESS) && (GetAddressResult != CFE_TBL_INFO_UPDATED)) + if ((Status != CFE_SUCCESS) && (Status != CFE_TBL_INFO_UPDATED)) { CFE_EVS_SendEvent(MD_UPDATE_TBL_EN_ERR_EID, CFE_EVS_EventType_ERROR, "MD_UpdateTableEnabledField, TableIndex %d: CFE_TBL_GetAddress Returned 0x%08x", TableIndex, - GetAddressResult); - Status = GetAddressResult; + Status); } else { @@ -367,20 +365,18 @@ CFE_Status_t MD_UpdateTableEnabledField(uint16 TableIndex, uint16 FieldValue) CFE_Status_t MD_UpdateTableDwellEntry(uint16 TableIndex, uint16 EntryIndex, uint16 NewLength, uint16 NewDelay, MD_SymAddr_t NewDwellAddress) { - CFE_Status_t Status = CFE_SUCCESS; - CFE_Status_t GetAddressResult = 0; - MD_DwellTableLoad_t *MD_LoadTablePtr = NULL; - MD_TableLoadEntry_t *EntryPtr = NULL; + CFE_Status_t Status = CFE_SUCCESS; + MD_DwellTableLoad_t *MD_LoadTablePtr = NULL; + MD_TableLoadEntry_t *EntryPtr = NULL;bles) /* Get pointer to Table */ - GetAddressResult = CFE_TBL_GetAddress((void *)&MD_LoadTablePtr, MD_AppData.MD_TableHandle[TableIndex]); + Status = CFE_TBL_GetAddress((void *)&MD_LoadTablePtr, MD_AppData.MD_TableHandle[TableIndex]); - if ((GetAddressResult != CFE_SUCCESS) && (GetAddressResult != CFE_TBL_INFO_UPDATED)) + if ((Status != CFE_SUCCESS) && (Status != CFE_TBL_INFO_UPDATED)) { CFE_EVS_SendEvent(MD_UPDATE_TBL_DWELL_ERR_EID, CFE_EVS_EventType_ERROR, "MD_UpdateTableDwellEntry, TableIndex %d: CFE_TBL_GetAddress Returned 0x%08x", TableIndex, - GetAddressResult); - Status = GetAddressResult; + Status); } else { @@ -417,17 +413,15 @@ CFE_Status_t MD_UpdateTableSignature(uint16 TableIndex, char NewSignature[MD_SIG { CFE_Status_t Status = CFE_SUCCESS; MD_DwellTableLoad_t *MD_LoadTablePtr = NULL; - CFE_Status_t GetAddressResult; /* Get pointer to Table */ - GetAddressResult = CFE_TBL_GetAddress((void *)&MD_LoadTablePtr, MD_AppData.MD_TableHandle[TableIndex]); + Status = CFE_TBL_GetAddress((void *)&MD_LoadTablePtr, MD_AppData.MD_TableHandle[TableIndex]); - if ((GetAddressResult != CFE_SUCCESS) && (GetAddressResult != CFE_TBL_INFO_UPDATED)) + if ((Status != CFE_SUCCESS) && (Status != CFE_TBL_INFO_UPDATED)) { CFE_EVS_SendEvent(MD_UPDATE_TBL_SIG_ERR_EID, CFE_EVS_EventType_ERROR, "MD_UpdateTableSignature, TableIndex %d: CFE_TBL_GetAddress Returned 0x%08x", TableIndex, - GetAddressResult); - Status = GetAddressResult; + Status); } else {