Also, consistently use 'ch' for channel variables. This matches how we
consistently use sdi, devc, and so on all over the code-base.
This fixes parts of bug #259.
This changes the new output API's recv() to receive(), and has it
return an integer status code. The output of the function, if any,
is stored in a new parameter as a pointer to a newly allocated GString.
All output modules using this API have been adjusted.
This patch marks packet structures and their payloads as const.
This indicates to packet receivers that modifications to these are
not allowed. In general all pointers should be marked const unless
modification of the referenced data is explicitly allowed.
This outputs text representation of SR_DF_ANALOG packets. Unlike the
float module however, it also outputs the standard abbreviations of
SI units corresponding to the packet's MQ and unit.
It also makes an effort to multiply or divide the floating point value
as needed to the nearest multiple or fraction, and inserts the
appropriate SI prefix to match.
Avoid plain malloc()/free() in sr/srd, especially in the API calls.
Also avoid g_malloc*() in favor of g_try_malloc*().
Use g_strdup() instead of strdup() so that we can use g_free()
consistently everywhere.
Exceptions: Stuff that is allocated via other libs (not using glib),
should also be properly free'd using the respective free-ing function
(instead of g_free()). Examples: Stuff allocated by libusb, libftdi, etc.
Also, use sr_err() instead of sr_warn() for actual errors. sr_warn() is
meant for non-fatal/uncritical warnings.
Use SR_API to mark public API symbols, and SR_PRIV for private symbols.
Variables and functions marked 'static' are private already and don't
need SR_PRIV. However, functions which are not static (because they need
to be used in other libsigrok-internal files) but are also not meant to
be part of the public libsigrok API, must use SR_PRIV.
This uses the 'visibility' feature of gcc (requires gcc >= 4.0).
Details: http://gcc.gnu.org/wiki/Visibility