To free resources allocated by galois_init_default_field.
Signed-off-by: Loic Dachary <loic-201408@dachary.org>
/liberation_[0-9][0-9]
/reed_sol_[0-9][0-9]
/reed_sol_test_gf
-/reed_sol_time_gf
\ No newline at end of file
+/reed_sol_time_gf
+/test_galois
encoder \
decoder
-TESTS=test_all_gfs.sh
+check_PROGRAMS =
+
+TESTS=test_all_gfs.sh $(check_PROGRAMS)
dist_noinst_SCRIPTS = test_all_gfs.sh time_all_gfs_argv_init.sh
+test_galois_SOURCES = test_galois.c
+check_PROGRAMS += test_galois
+
jerasure_01_SOURCES = jerasure_01.c
jerasure_02_SOURCES = jerasure_02.c
jerasure_03_SOURCES = jerasure_03.c
--- /dev/null
+#include <assert.h>
+#include "galois.h"
+
+int main(int argc, char **argv)
+{
+ assert(galois_init_default_field(4) == 0);
+ assert(galois_uninit_field(4) == 0);
+ assert(galois_init_default_field(4) == 0);
+ assert(galois_uninit_field(4) == 0);
+
+ assert(galois_init_default_field(8) == 0);
+ assert(galois_uninit_field(8) == 0);
+ assert(galois_init_default_field(8) == 0);
+ assert(galois_uninit_field(8) == 0);
+
+ return 0;
+}
+/*
+ * Local Variables:
+ * compile-command: "make test_galois &&
+ * libtool --mode=execute valgrind --tool=memcheck --leak-check=full ./test_galois"
+ * End:
+ */
#endif
extern int galois_init_default_field(int w);
+extern int galois_uninit_field(int w);
extern void galois_change_technique(gf_t *gf, int w);
extern int galois_single_multiply(int a, int b, int w);
return 0;
}
+int galois_uninit_field(int w)
+{
+ int ret = 0;
+ if (gfp_array[w] != NULL) {
+ int recursive = 1;
+ ret = gf_free(gfp_array[w], recursive);
+ free(gfp_array[w]);
+ gfp_array[w] = NULL;
+ }
+ return ret;
+}
+
static void galois_init(int w)
{
if (w <= 0 || w > 32) {