nasa / LC

The Core Flight System (cFS) Limit Checker (LC) application.
Apache License 2.0
30 stars 21 forks source link

Multiple return statements in LC_CreateTaskCDS and LC_TableInit #36

Closed skliper closed 1 year ago

skliper commented 2 years ago

Checklist (Please check before submitting)

Is your feature request related to a problem? Please describe. Multiple returns are a coding style violation, and the implementation is challenging to follow (see #12 and others). https://github.com/nasa/LC/blob/bb910369436b80b48bd098e8a987e2b0ad4cd1cf/fsw/src/lc_app.c#L332-L493 https://github.com/nasa/LC/blob/bb910369436b80b48bd098e8a987e2b0ad4cd1cf/fsw/src/lc_app.c#L735-L855

Describe the solution you'd like Single entry/exit point from functions. Refactor to simplify flow.

Describe alternatives you've considered None

Additional context Could group w/ multiple issues or tackle by file.

Requester Info Jacob Hageman - NASA/GSFC

skliper commented 2 years ago

As part of LC_TableInit, consider reducing duplicated logic and EID use for getting the WDTPtr and ADTPtr: https://github.com/nasa/LC/blob/bb910369436b80b48bd098e8a987e2b0ad4cd1cf/fsw/src/lc_app.c#L429-L450 https://github.com/nasa/LC/blob/bb910369436b80b48bd098e8a987e2b0ad4cd1cf/fsw/src/lc_app.c#L890-L896 https://github.com/nasa/LC/blob/bb910369436b80b48bd098e8a987e2b0ad4cd1cf/fsw/src/lc_app.c#L925-L931

thnkslprpt commented 1 year ago

Submitted a PR just focusing on LC_TableInit(). If that is approved/merged I will open a new issue for LC_CreateTaskCDS().