diff options
author | KMG <kmgreen2@gmail.com> | 2015-01-08 14:58:27 +0000 |
---|---|---|
committer | KMG <kmgreen2@gmail.com> | 2015-01-08 14:58:27 +0000 |
commit | 715443661c00558fe32f004a4be5f93f341b6e59 (patch) | |
tree | 0b6ec78c1bef14b1480cabeeabf1d46900433ecc | |
parent | 0f3af8fee2db45e90ac2171f62354c2c9905675d (diff) | |
parent | e7131cfd854a54e59459bc8fa1a98e867cf0ac2b (diff) | |
download | gf-complete-715443661c00558fe32f004a4be5f93f341b6e59.tar.gz |
Merge branch 'wip-exit-v2' into 'v2'v2.0
use assert instead of exit
the previous merge request was incorrectly against master. It now is twice in master which is not a problem but it's not in v2.
See merge request !5
-rw-r--r-- | src/gf.c | 13 | ||||
-rw-r--r-- | src/gf_general.c | 3 | ||||
-rw-r--r-- | src/gf_w8.c | 3 |
3 files changed, 11 insertions, 8 deletions
@@ -11,6 +11,7 @@ #include "gf_int.h" #include <stdio.h> #include <stdlib.h> +#include <assert.h> int _gf_errno = GF_E_DEFAULT; @@ -528,7 +529,7 @@ void gf_alignment_error(char *s, int a) fprintf(stderr, "Alignment error in %s:\n", s); fprintf(stderr, " The source and destination buffers must be aligned to each other,\n"); fprintf(stderr, " and they must be aligned to a %d-byte address.\n", a); - exit(1); + assert(0); } static @@ -551,7 +552,7 @@ void gf_invert_binary_matrix(uint32_t *mat, uint32_t *inv, int rows) { for (j = i+1; j < rows && (mat[j] & (1 << i)) == 0; j++) ; if (j == rows) { fprintf(stderr, "galois_invert_matrix: Matrix not invertible!!\n"); - exit(1); + assert(0); } tmp = mat[i]; mat[i] = mat[j]; mat[j] = tmp; tmp = inv[i]; inv[i] = inv[j]; inv[j] = tmp; @@ -812,7 +813,7 @@ void gf_set_region_data(gf_region_data *rd, if (h != NULL && bytes % h->w != 0) { fprintf(stderr, "Error in region multiply operation.\n"); fprintf(stderr, "The size must be a multiple of %d bytes.\n", h->w); - exit(1); + assert(0); } rd->s_start = src; @@ -828,7 +829,7 @@ void gf_set_region_data(gf_region_data *rd, fprintf(stderr, "to each other along a %d byte boundary.\n", a); fprintf(stderr, "Src = 0x%lx. Dest = 0x%lx\n", (unsigned long) src, (unsigned long) dest); - exit(1); + assert(0); } if (uls % wb != 0) { @@ -836,13 +837,13 @@ void gf_set_region_data(gf_region_data *rd, fprintf(stderr, "The pointers must be aligned along a %d byte boundary.\n", wb); fprintf(stderr, "Src = 0x%lx. Dest = 0x%lx\n", (unsigned long) src, (unsigned long) dest); - exit(1); + assert(0); } if (bytes % wb != 0) { fprintf(stderr, "Error in region multiply operation.\n"); fprintf(stderr, "The size must be a multiple of %d bytes.\n", wb); - exit(1); + assert(0); } uls %= a; diff --git a/src/gf_general.c b/src/gf_general.c index 8fcc737..7f187b5 100644 --- a/src/gf_general.c +++ b/src/gf_general.c @@ -17,6 +17,7 @@ #include <string.h> #include <stdlib.h> #include <time.h> +#include <assert.h> #include "gf_complete.h" #include "gf_int.h" @@ -311,7 +312,7 @@ void gf_general_do_region_check(gf_t *gf, gf_general_t *a, void *orig_a, void *o if (xor) fprintf(stderr," XOR with target word: %s\n", sot); fprintf(stderr," Product word: %s\n", sft); fprintf(stderr," It should be: %s\n", ssb); - exit(0); + assert(0); } } } diff --git a/src/gf_w8.c b/src/gf_w8.c index 8449298..276799f 100644 --- a/src/gf_w8.c +++ b/src/gf_w8.c @@ -12,6 +12,7 @@ #include "gf_w8.h" #include <stdio.h> #include <stdlib.h> +#include <assert.h> #define AB2(ip, am1 ,am2, b, t1, t2) {\ t1 = (b << 1) & am1;\ @@ -1168,7 +1169,7 @@ int gf_w8_table_init(gf_t *gf) scase = 2; } else { fprintf(stderr, "Internal error in gf_w8_table_init\n"); - exit(0); + assert(0); } for (a = 1; a < GF_FIELD_SIZE; a++) { |