[x] I signed and emailed the appropriate Contributor License Agreement to GSFC-SoftwareRelease@mail.nasa.gov and copied cfs-program@lists.nasa.gov.
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.
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 oneif
block, and it is assigned a value at its first use in the init-statement of thefor
loop on line 172. Subsequent references toStringLength
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 oneif
block, and is assigned a value there at its first use in the init-statement of thefor
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 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