Address several robustness/reliability and style issues in the JDS6600
support code. Extend existing documentation to help future maintenance.
This work is based on review feedback that I received by user fenugrec
via IRC.
- Fix resource leaks in the scan/probe code path. Respond earlier to
failed communication during that startup phase after previous comms
worked.
- Adjust printf(3) format specifiers. Use more appropriate integer
formats for sr_atoul_base() results. "%lf" is not needed for doubles.
- More thorough argument checks at the start of routines. Be explicit
about narrow value ranges when wide data types are involved (function
code only uses a small part of the size typed variable's range).
- Quote example requests and responses in protocol.c so that readers can
match generating and processing code paths to wire traffic, without
having access to the device or its protocol description. Extend
diagnostics messages to optionally provide the full content of raw
communication, including the end-of-line condition and non-printables.
Regular sr_log() calls would strip these details, users could not
notice.
- Provide more comments on motivation and implementation details.
- Prettify the protocol.h context declaration. Put struct members on
their individual source code lines.