From e9f2a78a5a537201ec50577cc657a1671b3caca9 Mon Sep 17 00:00:00 2001 From: Avi Date: Tue, 25 Oct 2022 09:46:39 +1000 Subject: [PATCH] Fix #1517, Reformat do/while loop to while (style change only) --- modules/tbl/fsw/src/cfe_tbl_internal.c | 27 +++++++++++++------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/modules/tbl/fsw/src/cfe_tbl_internal.c b/modules/tbl/fsw/src/cfe_tbl_internal.c index 3f0d03491..2ee93ab8d 100644 --- a/modules/tbl/fsw/src/cfe_tbl_internal.c +++ b/modules/tbl/fsw/src/cfe_tbl_internal.c @@ -484,24 +484,23 @@ int32 CFE_TBL_GetNextNotification(CFE_TBL_Handle_t TblHandle) int16 CFE_TBL_FindTableInRegistry(const char *TblName) { int16 RegIndx = CFE_TBL_NOT_FOUND; - int16 i = -1; + int16 i = 0; - do + while ((RegIndx == CFE_TBL_NOT_FOUND) && (i < (CFE_PLATFORM_TBL_MAX_NUM_TABLES - 1))) { - /* Point to next record in the Table Registry */ - i++; - - /* Check to see if the record is currently being used */ - if (!CFE_RESOURCEID_TEST_EQUAL(CFE_TBL_Global.Registry[i].OwnerAppId, CFE_TBL_NOT_OWNED)) + /* Check to see if the record is currently being used and perform a case-sensitive name comparison */ + if (!CFE_RESOURCEID_TEST_EQUAL(CFE_TBL_Global.Registry[i].OwnerAppId, CFE_TBL_NOT_OWNED) && + strcmp(TblName, CFE_TBL_Global.Registry[i].Name) == 0) { - /* Perform a case sensitive name comparison */ - if (strcmp(TblName, CFE_TBL_Global.Registry[i].Name) == 0) - { - /* If the names match, then return the index */ - RegIndx = i; - } + /* If the names match, then return the index */ + RegIndx = i; } - } while ((RegIndx == CFE_TBL_NOT_FOUND) && (i < (CFE_PLATFORM_TBL_MAX_NUM_TABLES - 1))); + else + { + /* Point to next record in the Table Registry */ + i++; + } + } return RegIndx; }