after multiple objections of libtom users [1], we decided to change licensing
[libtompoly.git] / pb_clear.c
blobecfb5c0ad6546c55e89d7fa5c5401e7ba18d4477
1 /* LibTomPoly, Polynomial Basis Math -- Tom St Denis
2 *
3 * LibTomPoly is a public domain library that provides
4 * polynomial basis arithmetic support. It relies on
5 * LibTomMath for large integer support.
7 * This library is free for all purposes without any
8 * express guarantee that it works.
10 * Tom St Denis, tomstdenis@iahu.ca, http://poly.libtomcrypt.org
12 #include <tompoly.h>
14 void pb_clear(pb_poly *a)
16 int x;
18 if (a->terms != NULL) {
19 /* free stuff */
20 for (x = 0; x < a->alloc; x++) {
21 mp_clear(&(a->terms[x]));
23 free(a->terms);
24 mp_clear(&(a->characteristic));
26 /* prevent double frees */
27 a->terms = NULL;
28 a->alloc = a->used = 0;