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

Refactor mutually exclusive if in TO_LAB_init() #145

Closed
thnkslprpt opened this issue Jan 27, 2023 · 0 comments · Fixed by #146
Closed

Refactor mutually exclusive if in TO_LAB_init() #145

thnkslprpt opened this issue Jan 27, 2023 · 0 comments · Fixed by #146

Comments

@thnkslprpt
Copy link
Contributor

Describe the bug
Mutually exclusive logic in this if, else if, and also no final else clause which I believe is frowned upon in the coding guidelines.

Code snips

to_lab/fsw/src/to_lab_app.c

Lines 203 to 215 in 7ca124c

for (i = 0; (i < (sizeof(TO_LAB_Subs->Subs) / sizeof(TO_LAB_Subs->Subs[0]))); i++)
{
if (!CFE_SB_IsValidMsgId(TO_LAB_Subs->Subs[i].Stream))
{
/* Only process until invalid MsgId (aka TO_LAB_UNUSED) is found*/
break;
}
else if (CFE_SB_IsValidMsgId(TO_LAB_Subs->Subs[i].Stream))
{
status = CFE_SB_SubscribeEx(TO_LAB_Subs->Subs[i].Stream, TO_LAB_Global.Tlm_pipe, TO_LAB_Subs->Subs[i].Flags,
TO_LAB_Subs->Subs[i].BufLimit);
}

Expected behavior
Refactor into a simpler if, else block.

Reporter Info
Avi Weiss @thnkslprpt

thnkslprpt added a commit to thnkslprpt/to_lab that referenced this issue Jan 27, 2023
jphickey pushed a commit to thnkslprpt/to_lab that referenced this issue Nov 1, 2023
dzbaker added a commit that referenced this issue Nov 13, 2023
…l-if-elseif

Fix #145, Refactor mutually exclusive logic in if, else if block
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant