nasa / FM

The Core Flight System (cFS) File Manager (FM) application.
Apache License 2.0
43 stars 25 forks source link

Fix #62, Remove initializations causing Cppcheck errors #64

Closed thnkslprpt closed 2 years ago

thnkslprpt commented 2 years ago

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 https://github.com/nasa/FM/issues/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