Skip to content

Conversation

@thnkslprpt
Copy link
Contributor

@thnkslprpt thnkslprpt commented Nov 30, 2024

Checklist

Describe the contribution

Minor changes:

  • Formatting applied to remove incorrect indentation in the files being edited
  • Baseline variable in CS_ReportBaselineAppCmd, CS_ReportBaselineEntryIDEepromCmd, CS_ReportBaselineEntryIDMemoryCmd and CS_ReportBaselineTablesCmd only used once in these functions - simplifies to use the value directly and avoid the extra variable (happy to separate out these changes into a separate PR if more suitable).
    • In CS_ReportBaselineEntryIDEepromCmd & CS_ReportBaselineEntryIDEepromCmd two additional simplifications look reasonable:
      • ResultsEntry can be removed
      • the assignment of CS_STATE_UNDEFINED to State can be done at initialization, simplifying the if/else in the error condition

Testing performed
GitHub CI actions all passing successfully (incl. Build + Run, Unit/Functional Tests etc.).

Expected behavior changes
Name variable will be filled in in all use-cases.
Unnecessary variables are removed, which simplifies the code and eases maintenance/testing.

System(s) tested on
Debian 12 using the current main branch of cFS bundle.

Contributor Info
Avi Weiss   @thnkslprpt

@thnkslprpt thnkslprpt force-pushed the fix-99-fill-in-name-variable-at-top-of-function branch from c4e87dc to 4b79eaf Compare November 30, 2024 10:23
Name[sizeof(Name) - 1] = '\0';

if (CS_GetAppResTblEntryByName(&ResultsEntry, Name))
if (CS_GetAppResTblEntryByName(&ResultsEntry, Name))

Check warning

Code scanning / CodeQL

Side effect in a Boolean expression

This Boolean expression is not side-effect free.
CS_AppData.HkPacket.Payload.OneShotInProgress == false)
{
/* make sure the entry is a valid number and is defined in the table */
if (CS_GetAppResTblEntryByName(&ResultsEntry, Name))

Check warning

Code scanning / CodeQL

Side effect in a Boolean expression

This Boolean expression is not side-effect free.

CFE_EVS_SendEvent(CS_DISABLE_APP_NAME_INF_EID, CFE_EVS_EventType_INFORMATION,
"Checksumming of app %s is Disabled", Name);
if (CS_GetAppResTblEntryByName(&ResultsEntry, Name))

Check warning

Code scanning / CodeQL

Side effect in a Boolean expression

This Boolean expression is not side-effect free.
"Checksumming of app %s is Disabled", Name);

CS_AppData.HkPacket.Payload.CmdCounter++;
if (CS_GetAppDefTblEntryByName(&DefinitionEntry, Name))

Check warning

Code scanning / CodeQL

Side effect in a Boolean expression

This Boolean expression is not side-effect free.

CFE_EVS_SendEvent(CS_ENABLE_APP_NAME_INF_EID, CFE_EVS_EventType_INFORMATION,
"Checksumming of app %s is Enabled", Name);
if (CS_GetAppResTblEntryByName(&ResultsEntry, Name))

Check warning

Code scanning / CodeQL

Side effect in a Boolean expression

This Boolean expression is not side-effect free.
CS_AppData.HkPacket.Payload.OneShotInProgress == false)
{
/* make sure the entry is a valid number and is defined in the table */
if (CS_GetTableResTblEntryByName(&ResultsEntry, Name))

Check warning

Code scanning / CodeQL

Side effect in a Boolean expression

This Boolean expression is not side-effect free.

CFE_EVS_SendEvent(CS_DISABLE_TABLES_NAME_INF_EID, CFE_EVS_EventType_INFORMATION,
"Checksumming of table %s is Disabled", Name);
if (CS_GetTableResTblEntryByName(&ResultsEntry, Name))

Check warning

Code scanning / CodeQL

Side effect in a Boolean expression

This Boolean expression is not side-effect free.
"Checksumming of table %s is Disabled", Name);

CS_AppData.HkPacket.Payload.CmdCounter++;
if (CS_GetTableDefTblEntryByName(&DefinitionEntry, Name))

Check warning

Code scanning / CodeQL

Side effect in a Boolean expression

This Boolean expression is not side-effect free.

CFE_EVS_SendEvent(CS_ENABLE_TABLES_NAME_INF_EID, CFE_EVS_EventType_INFORMATION,
"Checksumming of table %s is Enabled", Name);
if (CS_GetTableResTblEntryByName(&ResultsEntry, Name))

Check warning

Code scanning / CodeQL

Side effect in a Boolean expression

This Boolean expression is not side-effect free.
"Checksumming of table %s is Enabled", Name);

CS_AppData.HkPacket.Payload.CmdCounter++;
if (CS_GetTableDefTblEntryByName(&DefinitionEntry, Name))

Check warning

Code scanning / CodeQL

Side effect in a Boolean expression

This Boolean expression is not side-effect free.
@thnkslprpt thnkslprpt force-pushed the fix-99-fill-in-name-variable-at-top-of-function branch from 4b79eaf to 6f88718 Compare November 30, 2024 13:16
@thnkslprpt thnkslprpt force-pushed the fix-99-fill-in-name-variable-at-top-of-function branch from 6f88718 to 951d776 Compare November 30, 2024 15:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Name variable used in events before being filled in

1 participant