`CF_CFDP_ProcessPollingDirectories()` can be simplified

Open
#467 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

  • #468 by @thnkslprpt — closed without merging

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
55/100
Issue type
Refactor
Clarity
Clearly specified
Activity status
Stale
Tech stack
c
Domain
embedded-iot

Research direction

Start in fsw/src/cf_cfdp.c at CF_CFDP_ProcessPollingDirectories(), around the linked lines 1480-1541. Review the loop and simplify the single-use variables and loop-invariant initialization while preserving its behavior. Done means the function is clearer and the requested unnecessary assignments are removed without changing processing.

Written by the indexing model from the issue text.

Description

enhancement

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
count_check and ret are only used once, so they are unnecessary and can be removed.
chan_index and cc don't seem to get updated so can be initialized once instead of in every run through the loop.

Code snips
https://github.com/nasa/CF/blob/ba12bc1a15d47b8adf29177602aeb5b62d8856d3/fsw/src/cf_cfdp.c#L1480-L1541

Expected behavior
Simplify where possible to improve clarify and ease future maintenance.

Reporter Info
Avi Weiss   @thnkslprpt

Dominant language
C
Stars
123
Forks
82
Avg merge
2d 22h
Merged PRs (30d)
2

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from nasa/CF

All issues in nasa/CF

Similar issues

More C issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.