File tree 5 files changed +44
-2
lines changed
5 files changed +44
-2
lines changed Original file line number Diff line number Diff line change 5
5
/liberation_ [0-9 ][0-9 ]
6
6
/reed_sol_ [0-9 ][0-9 ]
7
7
/reed_sol_test_gf
8
- /reed_sol_time_gf
8
+ /reed_sol_time_gf
9
+ /test_galois
Original file line number Diff line number Diff line change @@ -25,10 +25,15 @@ bin_PROGRAMS = jerasure_01 \
25
25
encoder \
26
26
decoder
27
27
28
- TESTS =test_all_gfs.sh
28
+ check_PROGRAMS =
29
+
30
+ TESTS =test_all_gfs.sh $(check_PROGRAMS )
29
31
30
32
dist_noinst_SCRIPTS = test_all_gfs.sh time_all_gfs_argv_init.sh
31
33
34
+ test_galois_SOURCES = test_galois.c
35
+ check_PROGRAMS += test_galois
36
+
32
37
jerasure_01_SOURCES = jerasure_01.c
33
38
jerasure_02_SOURCES = jerasure_02.c
34
39
jerasure_03_SOURCES = jerasure_03.c
Original file line number Diff line number Diff line change
1
+ #include <assert.h>
2
+ #include "galois.h"
3
+
4
+ int main (int argc , char * * argv )
5
+ {
6
+ assert (galois_init_default_field (4 ) == 0 );
7
+ assert (galois_uninit_field (4 ) == 0 );
8
+ assert (galois_init_default_field (4 ) == 0 );
9
+ assert (galois_uninit_field (4 ) == 0 );
10
+
11
+ assert (galois_init_default_field (8 ) == 0 );
12
+ assert (galois_uninit_field (8 ) == 0 );
13
+ assert (galois_init_default_field (8 ) == 0 );
14
+ assert (galois_uninit_field (8 ) == 0 );
15
+
16
+ return 0 ;
17
+ }
18
+ /*
19
+ * Local Variables:
20
+ * compile-command: "make test_galois &&
21
+ * libtool --mode=execute valgrind --tool=memcheck --leak-check=full ./test_galois"
22
+ * End:
23
+ */
Original file line number Diff line number Diff line change @@ -47,6 +47,7 @@ extern "C" {
47
47
#endif
48
48
49
49
extern int galois_init_default_field (int w );
50
+ extern int galois_uninit_field (int w );
50
51
extern void galois_change_technique (gf_t * gf , int w );
51
52
52
53
extern int galois_single_multiply (int a , int b , int w );
Original file line number Diff line number Diff line change @@ -181,6 +181,18 @@ int galois_init_default_field(int w)
181
181
return 0 ;
182
182
}
183
183
184
+ int galois_uninit_field (int w )
185
+ {
186
+ int ret = 0 ;
187
+ if (gfp_array [w ] != NULL ) {
188
+ int recursive = 1 ;
189
+ ret = gf_free (gfp_array [w ], recursive );
190
+ free (gfp_array [w ]);
191
+ gfp_array [w ] = NULL ;
192
+ }
193
+ return ret ;
194
+ }
195
+
184
196
static void galois_init (int w )
185
197
{
186
198
if (w <= 0 || w > 32 ) {
You can’t perform that action at this time.
0 commit comments