Fix #2546, add handle list operation routines#2548
Conversation
| break; | ||
| } | ||
|
|
||
| Func(AccDescPtr, Arg); |
Check notice
Code scanning / CodeQL-coding-standard
Use of non-constant function pointer
| * See description in header file for argument/return detail | ||
| * | ||
| *-----------------------------------------------------------------*/ | ||
| void CFE_TBL_HandleListInsertLink(CFE_TBL_RegistryRec_t *RegRecPtr, CFE_TBL_AccessDescriptor_t *AccessDescPtr) |
Check notice
Code scanning / CodeQL-coding-standard
Long function without assertion
| * See description in header file for argument/return detail | ||
| * | ||
| *-----------------------------------------------------------------*/ | ||
| void CFE_TBL_HandleListRemoveLink(CFE_TBL_RegistryRec_t *RegRecPtr, CFE_TBL_AccessDescriptor_t *AccessDescPtr) |
Check notice
Code scanning / CodeQL-coding-standard
Long function without assertion
| * See description in header file for argument/return detail | ||
| * | ||
| *-----------------------------------------------------------------*/ | ||
| void CFE_TBL_ForeachAccessDescriptor(CFE_TBL_RegistryRec_t *RegRecPtr, CFE_TBL_AccessDescFunc_t Func, void *Arg) |
Check notice
Code scanning / CodeQL-coding-standard
Long function without assertion
| * See description in header file for argument/return detail | ||
| * | ||
| *-----------------------------------------------------------------*/ | ||
| void CFE_TBL_HandleListGetSafeLink(CFE_TBL_RegistryRec_t *RegRecPtr, CFE_TBL_AccessDescriptor_t *AccDescPtr, |
Check notice
Code scanning / CodeQL-coding-standard
Long function without assertion
| CFE_TBL_TxnState_t *Txn = Arg; | ||
|
|
||
| /* Only notify *OTHER* applications that the contents have changed */ | ||
| if (!CFE_RESOURCEID_TEST_EQUAL(AccessDescPtr->AppId, CFE_TBL_TxnAppId(Txn))) |
Check warning
Code scanning / CodeQL-coding-standard
Side effect in a Boolean expression
|
|
||
| /* If this was the last Access Descriptor for this table, we can free the memory buffers as well */ | ||
| if (RegRecPtr->HeadOfAccessList == CFE_TBL_END_OF_LIST) | ||
| if (!CFE_TBL_HandleLinkIsAttached(&RegRecPtr->AccessList)) |
Check warning
Code scanning / CodeQL-coding-standard
Side effect in a Boolean expression
| if (AccDescPtr->UsedFlag && AccDescPtr->RegIndex == CFE_TBL_TxnRegId(Txn) && | ||
| CFE_RESOURCEID_TEST_EQUAL(AccDescPtr->AppId, CFE_TBL_TxnAppId(Txn))) |
Check warning
Code scanning / CodeQL-coding-standard
Side effect in a Boolean expression
|
Any chance the linked list support could be an exposed API? I know CF has a linked list and nice if any other app wouldn't have to roll their own. |
465925d to
a7ea4a3
Compare
Good suggestion. Although this does isolate the prev/next references into a linkage struct, the linkage here is still via Table Handle. So in other words - not a totally generic list function. I think CFE should have a module for general purpose data structs, like trees and lists.... |
Adds a "HandleLink" structure to encapsulate the linked list functionality and add generic routines to initialize and test/check this structure, along with list insert/remove functions for access descriptors that use this link struct interally. This also cleans up documentation of the table resource ID functions defined in cfe_tbl_resource.h
a7ea4a3 to
b13c79f
Compare
| * \param AccDescPtr Pointer to the current access descriptor | ||
| * \param Arg Opaque argument from caller (passed through) | ||
| */ | ||
| typedef void (* const CFE_TBL_AccessDescFunc_t)(CFE_TBL_AccessDescriptor_t *AccDescPtr, void *Arg); |
Check notice
Code scanning / CodeQL-coding-standard
Hidden pointer indirection
*Combines:* cFE equuleus-rc1+dev131 to_lab equuleus-rc1+dev52 **Includes:** *cFE* - nasa/cFE#2548 *to_lab* - nasa/to_lab#188 Co-authored by: Avi Weiss <[email protected]> Co-authored by: Joseph Hickey <[email protected]>
*Combines:* cFE equuleus-rc1+dev131 to_lab equuleus-rc1+dev52 **Includes:** *cFE* - nasa/cFE#2548 *to_lab* - nasa/to_lab#188 Co-authored by: Avi Weiss <[email protected]> Co-authored by: Joseph Hickey <[email protected]>
Checklist (Please check before submitting)
Describe the contribution
Adds a "HandleLink" structure to encapsulate the linked list functionality and add generic routines to initialize and test/check this structure, along with list insert/remove functions for access descriptors that use this link struct interally.
This also cleans up documentation of the table resource ID functions defined in cfe_tbl_resource.h
Fixes #2546
Testing performed
Build and run all tests
Expected behavior changes
None (code clean up)
System(s) tested on
Debian
Additional context
Improves maintainability of code by moving linked list ops into common routines
Contributor Info - All information REQUIRED for consideration of pull request
Joseph Hickey, Vantage Systems, Inc.