When a fatal error (unaligned memory etc.) is detected, jerasure
should assert(3) instead of exit(3) to give a chance to the calling
program to catch the exception and display a stack trace. Although it is
possible for gdb to display the stack trace and break on exit, libraries
are not usually expected to terminate the calling program in this way.
Signed-off-by: Loic Dachary <loic@dachary.org>
galois_init_default_field returns an errno(3) code in case of error
instead of exiting. This is handy when the caller needs to perform
cleanup or error reporting when an error occurs instead of exit(2).
The exit(2) based error handling is preserved in the static
galois_init() function which is used in galois.c instead and is based on
galois_init_default_field to avoid code duplication.
Signed-off-by: Loic Dachary <loic@dachary.org>
So that the application can initialize gfp_array and gfp_is_composite
instead of relying on initialization happening implicitly when the
multiply or xor functions are called. The init function can be called
once when the application guarantees thread safety. And the multiply and
xor functions can be called from multiple threads without risking races.
Signed-off-by: Loic Dachary <loic@dachary.org>