-
Notifications
You must be signed in to change notification settings - Fork 203
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
Fix #2588, Split up CFE_TBL_Load and remove early returns #2589
base: main
Are you sure you want to change the base?
Conversation
@@ -398,7 +398,7 @@ | |||
* See description in header file for argument/return detail | |||
* | |||
*-----------------------------------------------------------------*/ | |||
CFE_TBL_LoadBuff_t *CFE_TBL_GetSelectedBuffer(CFE_TBL_RegistryRec_t * RegRecPtr, | |||
CFE_TBL_LoadBuff_t *CFE_TBL_GetSelectedBuffer(CFE_TBL_RegistryRec_t *RegRecPtr, |
Check notice
Code scanning / CodeQL
Long function without assertion Note
* See description in header file for argument/return detail | ||
* | ||
*-----------------------------------------------------------------*/ | ||
CFE_Status_t CFE_TBL_LoadDumpOnlyTable(CFE_TBL_RegistryRec_t *RegRecPtr, const char *AppName, const void *SrcDataPtr) |
Check notice
Code scanning / CodeQL
Long function without assertion Note
* See description in header file for argument/return detail | ||
* | ||
*-----------------------------------------------------------------*/ | ||
CFE_Status_t CFE_TBL_LoadWorkingBuffer(const CFE_TBL_SrcEnum_t SrcType, const char *AppName, |
Check notice
Code scanning / CodeQL
Long function without assertion Note
* | ||
*-----------------------------------------------------------------*/ | ||
|
||
CFE_Status_t CFE_TBL_ValidateWorkingBufferContents(CFE_TBL_RegistryRec_t *RegRecPtr, |
Check notice
Code scanning / CodeQL
Long function without assertion Note
CFE_Status_t CFE_TBL_ValidateWorkingBufferContents(CFE_TBL_RegistryRec_t *RegRecPtr, | ||
CFE_TBL_LoadBuff_t *WorkingBufferPtr, const char *AppName) | ||
{ | ||
CFE_Status_t Status = (RegRecPtr->ValidationFuncPtr)(WorkingBufferPtr->BufferPtr); |
Check notice
Code scanning / CodeQL
Use of non-constant function pointer Note
* See description in header file for argument/return detail | ||
* | ||
*-----------------------------------------------------------------*/ | ||
CFE_Status_t CFE_TBL_PerformUpdate(CFE_TBL_RegistryRec_t *RegRecPtr, const CFE_TBL_Handle_t TblHandle, |
Check notice
Code scanning / CodeQL
Long function without assertion Note
{ | ||
/* The Application is allowed to call Load once when the address */ | ||
/* of the dump only table is being defined by the application. */ | ||
RegRecPtr->Buffers[0].BufferPtr = (void *)SrcDataPtr; |
Check warning
Code scanning / CodeQL
Local variable address stored in non-local memory Warning
Checklist
Describe the contribution
CFE_TBL_Load()
and remove early returns #2588CFE_TBL_Load()
into 4 helper functionsStillProcessing
) - allowing us to moveCFE_TBL_TxnFinish()
to the end of the functionCFE_TBL_Load()
reduced from 223 -> 123 lines (and cyclomatic complexity roughly halved)Testing performed
GitHub CI actions all passing successfully (incl. Build + Run, Unit/Functional Tests etc.) + some basic sanity checking with a cFS suite run, loading of a table etc.
Expected behavior changes
This PR minimises complexity of
CFE_TBL_Load()
thereby easing future maintenance/testing/refactoring. Logic is largely unchanged here, other than the points mentioned above.System(s) tested on
Debian GNU/Linux 12 (bookworm)
Current main branch of cFS bundle.
Contributor Info
Avi Weiss @thnkslprpt