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

Slight loop simplification possible in LC_SampleAPReq #106

Open
2 tasks done
thnkslprpt opened this issue Jan 30, 2024 · 0 comments · May be fixed by #107
Open
2 tasks done

Slight loop simplification possible in LC_SampleAPReq #106

thnkslprpt opened this issue Jan 30, 2024 · 0 comments · May be fixed by #107

Comments

@thnkslprpt
Copy link
Contributor

Checklist

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

Describe the bug
The continue is unnessesary if the prior if condition just checks for > 0 instead of == 0.

Code snips

LC/fsw/src/lc_cmds.c

Lines 90 to 106 in 752a024

if ((LC_SampleAP->UpdateAge != 0) && (ValidSampleCmd))
{
for (WatchIndex = 0; WatchIndex < LC_MAX_WATCHPOINTS; WatchIndex++)
{
if (LC_OperData.WRTPtr[WatchIndex].CountdownToStale == 0)
{
continue;
}
LC_OperData.WRTPtr[WatchIndex].CountdownToStale--;
if (LC_OperData.WRTPtr[WatchIndex].CountdownToStale == 0)
{
LC_OperData.WRTPtr[WatchIndex].WatchResult = LC_WATCH_STALE;
}
}
}

Reporter Info
Avi Weiss   @thnkslprpt

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