The g_malloc()/g_malloc0() versions exit/segfault if not enough memory
is available, which is not a good thing in libsigrok.
Instead, we use the g_try_malloc()/g_try_malloc0() variants, which
return NULL if not enough memory is available, so that the caller can
handle the error properly.
Only output new lines in gnuplot output if there have been changes in
the samples (similar to what VCD does). As long as the first and last
sample are output, the resulting plot looks OK.
This reduces the size of the output file from roughly 200MB to just 60KB
in one specific test setup (depends on the number of probes and on the
signal, of course). The time and CPU load required to generate the gnuplot
output and the resulting plot (PNG or other) is also drastically reduced
from multiple minutes to roughly 30 seconds (again, depends on various
things).
Thanks Ken Mobley of ChronoVu for the report.
We should use these (internal) functions in libsigrok exclusively from
now on, i.e. no more use of glib's g_debug() etc.
These functions are only for libsigrok, the frontends use whatever
logging mechanism is suitable there.
The struct entry 'extension' is not really a (filename) extension, but
rather a unique ID used for input or output formats, e.g. in the sigrok
CLI or GUI interface. Thus, rename it accordingly.
support for metadata in recent versions of the FPGA code
moved constants and structs out to separate header file
got rid of all device instance-specific globals
When no firmware file is found, return the right error code so sigrok
doesn't continue running with no firmware loaded.
Thanks Martin Stensgård <mastensg@ping.uio.no> for the patch!
Stuff like
./bin/sigrok-cli -i rnd.dd -a transitioncounter
would segfault (rnd.dd consists of random bytes) because device->plugin
was NULL and was being dereferenced.
Thanks Olivier Fauchon <olivier@aixmarseille.com> for reporting.