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

Fix #62, Remove initializations causing Cppcheck errors #64

Conversation

thnkslprpt
Copy link
Contributor

@thnkslprpt thnkslprpt commented Nov 6, 2022

Checklist

Describe the contribution
Fixes #62
Both seem fine to change from initialization at the top of the function to a plain declaration.
StringLength is used in only one if block, and it is assigned a value at its first use in the init-statement of the for loop on line 172.
Subsequent references to StringLength all logically follow this assignment, so the initialization at the top of the function block (line 165) is redundant and can safely be converted to a plain declaration.

The same goes for NameLength. It is used in only one if block, and is assigned a value there at its first use in the init-statement of the for loop on line 110. The initialization on line 74 can thus be converted to a simple declaration.

Testing performed
GitHub CI actions (incl. Build + Run, Unit Tests etc.) all passing successfully if separate issue #63 is suppressed
image
The log from the successful build (with the GCC suppressions that can't be included in this PR) can be viewed here:
https://github.com/thnkslprpt/FM/actions/runs/3404338406/jobs/5661598438

Expected behavior changes
No impact on code behavior.
Cppcheck now passes without error again.

Contributor Info
Avi @thnkslprpt

@dzbaker dzbaker merged commit ed65b37 into nasa:main Nov 14, 2022
@thnkslprpt thnkslprpt deleted the fix-62-remove-initializations-causing-cppcheck-failure branch November 14, 2022 22:40
@dmknutsen dmknutsen added this to the Draco milestone Jan 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

New Cppcheck errors: '[unreadVariable]'
4 participants