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 capture.c #10

Open
nrwahl2 opened this issue Jun 4, 2023 · 0 comments
Open

Refactor capture.c #10

nrwahl2 opened this issue Jun 4, 2023 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@nrwahl2
Copy link
Contributor

nrwahl2 commented Jun 4, 2023

There are a number of issues:

  • Values such as parameter mins and maxes are hard-coded.
  • Argument parsing is custom and handles only positional arguments. It expects six of them.
    • We should at least use argp or getopt. However, we could use GOption since GLib is already installed on the oresat-dev image.
  • There are no default values. Defaults would make running the program much simpler in the common case.
  • There are several calls to atoi()/atof() (notoriously problematic).
  • There are float equality comparisons, which may fail even if the values ought to be the same. Floats are actually unnecessary in these cases.
  • main() is monolithic. There are likely opportunities to functionize pieces of it for maintainability and for isolation of variables.
  • Input validation and error reporting could be improved.
  • Others that I'm sure we'll notice after we address the above and look more closely.

There are also plenty of opportunities to generally clean up the code, to improve function documentation, and to standardize the style. I'm partial to the C style recommendations here: https://clusterlabs.org/pacemaker/doc/2.1/Pacemaker_Development/html/c.html

(Full disclosure, Pacemaker is software that I help maintain.)

@nrwahl2 nrwahl2 self-assigned this Jun 4, 2023
@nrwahl2 nrwahl2 added the enhancement New feature or request label Jun 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: In Progress
Development

No branches or pull requests

1 participant