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

Consistent loop implementation in CFE_TBL_FindTableInRegistry and CFE_TBL_FindFreeRegistryEntry #1517

Open
skliper opened this issue May 13, 2021 · 1 comment

Comments

@skliper
Copy link
Contributor

skliper commented May 13, 2021

Is your feature request related to a problem? Please describe.
Loops could be the same but aren't:

do
{
/* 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))
{
/* 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;
}
}
} while ((RegIndx == CFE_TBL_NOT_FOUND) && (i < (CFE_PLATFORM_TBL_MAX_NUM_TABLES - 1)));

while ((RegIndx == CFE_TBL_NOT_FOUND) && (i < CFE_PLATFORM_TBL_MAX_NUM_TABLES))
{
/* A Table Registry is only "Free" when there isn't an owner AND */
/* all other applications are not sharing or locking the table */
if (CFE_RESOURCEID_TEST_EQUAL(CFE_TBL_Global.Registry[i].OwnerAppId, CFE_TBL_NOT_OWNED) &&
(CFE_TBL_Global.Registry[i].HeadOfAccessList == CFE_TBL_END_OF_LIST))
{
RegIndx = i;
}
else
{
i++;
}
}

Describe the solution you'd like
Consistent implementation

Describe alternatives you've considered
None

Additional context
Code review - note this is style suggestion only

Requester Info
Jacob Hageman - NASA/GSFC

@thnkslprpt
Copy link
Contributor

No longer relevant since #2539

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants