Change free_poly to take a pointer to the polynomial

This commit is contained in:
Ben Edgington 2021-02-05 20:52:26 +00:00
parent 6242338bd8
commit 5bd2564ff8
4 changed files with 8 additions and 8 deletions

View File

@ -79,8 +79,8 @@ C_KZG_RET compute_proof_multi(blst_p1 *out, const KZGSettings *ks, poly *p, cons
commit_to_poly(out, ks, &q); commit_to_poly(out, ks, &q);
free_poly(q); free_poly(&q);
free_poly(divisor); free_poly(&divisor);
return C_KZG_OK; return C_KZG_OK;
} }

View File

@ -75,7 +75,7 @@ void proof_single(void) {
TEST_CHECK(true == check_proof_single(&ks, &commitment, &proof, &x, &value)); TEST_CHECK(true == check_proof_single(&ks, &commitment, &proof, &x, &value));
free_fft_settings(&fs); free_fft_settings(&fs);
free_poly(p); free_poly(&p);
free(s1); free(s1);
free(s2); free(s2);
} }
@ -128,7 +128,7 @@ void proof_multi(void) {
free_fft_settings(&fs1); free_fft_settings(&fs1);
free_fft_settings(&fs2); free_fft_settings(&fs2);
free_poly(p); free_poly(&p);
free(s1); free(s1);
free(s2); free(s2);
} }
@ -145,7 +145,7 @@ void proof_single_error(void) {
fr_from_uint64(&x, 1234); fr_from_uint64(&x, 1234);
TEST_CHECK(C_KZG_BADARGS == compute_proof_single(&proof, &ks, &p, &x)); TEST_CHECK(C_KZG_BADARGS == compute_proof_single(&proof, &ks, &p, &x));
free_poly(p); free_poly(&p);
} }
TEST_LIST = TEST_LIST =

View File

@ -26,8 +26,8 @@ void init_poly(poly *out, const uint64_t length) {
out->coeffs = malloc(length * sizeof(blst_fr)); out->coeffs = malloc(length * sizeof(blst_fr));
} }
void free_poly(poly p) { void free_poly(poly *p) {
free(p.coeffs); free(p->coeffs);
} }
void eval_poly(blst_fr *out, const poly *p, const blst_fr *x) { void eval_poly(blst_fr *out, const poly *p, const blst_fr *x) {

View File

@ -24,7 +24,7 @@ typedef struct {
} poly; } poly;
void init_poly(poly *out, const uint64_t length); void init_poly(poly *out, const uint64_t length);
void free_poly(poly p); void free_poly(poly *p);
void eval_poly(blst_fr *out, const poly *p, const blst_fr *x); void eval_poly(blst_fr *out, const poly *p, const blst_fr *x);
C_KZG_RET poly_quotient_length(uint64_t *out, const poly *dividend, const poly *divisor); C_KZG_RET poly_quotient_length(uint64_t *out, const poly *dividend, const poly *divisor);
C_KZG_RET poly_long_div(poly *out, const poly *dividend, const poly *divisor); C_KZG_RET poly_long_div(poly *out, const poly *dividend, const poly *divisor);