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

Overloaded internal return codes in TBL service #1525

Open
skliper opened this issue May 13, 2021 · 0 comments
Open

Overloaded internal return codes in TBL service #1525

skliper opened this issue May 13, 2021 · 0 comments

Comments

@skliper
Copy link
Contributor

skliper commented May 13, 2021

Is your feature request related to a problem? Please describe.
Multiple return codes are defined as -1, this defeats the purpose of named codes and doesn't allow for unique handling, checking the error code is also not actually testing that the expected incorrect code was returned.

#define CFE_TBL_NOT_FOUND (-1)

/** \brief Value indicating when no load is in progress */
/**
** This macro is used to indicate no Load is in Progress by assigning it to
** #CFE_TBL_RegistryRec_t::LoadInProgress
*/
#define CFE_TBL_NO_LOAD_IN_PROGRESS (-1)
/** \brief Value indicating when no Validation is Pending */
/**
** This macro is used to indicate no Validation is Pending by assigning it to
** #CFE_TBL_RegistryRec_t::ValidateActiveIndex or #CFE_TBL_RegistryRec_t::ValidateInactiveIndex
*/
#define CFE_TBL_NO_VALIDATION_PENDING (-1)
/** \brief Value indicating when no Dump is Pending on a Dump-Only Table */
/**
** This macro is used to indicate no Dump is Pending by assigning it to
** #CFE_TBL_RegistryRec_t::DumpControlIndex
*/
#define CFE_TBL_NO_DUMP_PENDING (-1)

Note there's at least one cases where an index is initialized to one of these error codes, which is especially fragile (#1519)

Describe the solution you'd like
Defined unique error codes, if they every get passed out an API really they should be defined in cfe_error.h

Describe alternatives you've considered
None

Additional context
Code review

Requester Info
Jacob Hageman - NASA/GSFC

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

No branches or pull requests

1 participant