CS icon indicating copy to clipboard operation
CS copied to clipboard

Superfluous assignments, side-effects. type updates etc.

Open thnkslprpt opened this issue 2 years ago • 0 comments

Checklist

  • [x] I reviewed the Contributing Guide.
  • [x] I performed a cursory search to see if the bug report is relevant, not redundant, nor in conflict with other tickets.

Describe the bug Some issues that can be easily cleaned up to improve readability and ease maintenance by simplifying the code.

  • superfluous initializations (when the variable is immediately or always assigned a value before being used)
  • side-effects in conditionals that can be easily removed and end up more readable
  • a couple of types can be updated (size_t, CFE_MSG_FcnCode_t)

Code snips Can be size_t: https://github.com/nasa/CS/blob/bd4dd1ce688e9af683e63132b37306b21f320ab2/fsw/inc/cs_tbldefs.h#L370

Can be CFE_MSG_FcnCode_t: https://github.com/nasa/CS/blob/bd4dd1ce688e9af683e63132b37306b21f320ab2/fsw/src/cs_app.c#L268

Several functions with multiple CS calls that could be made clearer and more compliant with an additional Status/Result variable. e.g.: https://github.com/nasa/CS/blob/bd4dd1ce688e9af683e63132b37306b21f320ab2/fsw/src/cs_app_cmds.c#L215-L241

Expected behavior Clear up where it makes sense.

Reporter Info Avi Weiss @thnkslprpt

thnkslprpt avatar May 31 '23 02:05 thnkslprpt