Merge pull request #52 from jtraglia/replace-memset

Replace memset with initializations
This commit is contained in:
Ramana Kumar 2022-12-25 22:14:55 +00:00 committed by GitHub
commit 13f2a79345
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 3 deletions

View File

@ -663,9 +663,10 @@ static C_KZG_RET new_fft_settings(FFTSettings *fs, unsigned int max_scale) {
C_KZG_RET ret; C_KZG_RET ret;
fr_t root_of_unity; fr_t root_of_unity;
memset(fs, 0, sizeof(FFTSettings));
fs->max_width = (uint64_t)1 << max_scale; fs->max_width = (uint64_t)1 << max_scale;
fs->expanded_roots_of_unity = NULL;
fs->reverse_roots_of_unity = NULL;
fs->roots_of_unity = NULL;
CHECK((max_scale < sizeof scale2_root_of_unity / sizeof scale2_root_of_unity[0])); CHECK((max_scale < sizeof scale2_root_of_unity / sizeof scale2_root_of_unity[0]));
fr_from_uint64s(&root_of_unity, scale2_root_of_unity[max_scale]); fr_from_uint64s(&root_of_unity, scale2_root_of_unity[max_scale]);
@ -787,7 +788,9 @@ C_KZG_RET load_trusted_setup(KZGSettings *out, const uint8_t g1_bytes[], size_t
g1_t *g1_projective = NULL; g1_t *g1_projective = NULL;
C_KZG_RET ret; C_KZG_RET ret;
memset(out, 0, sizeof(KZGSettings)); out->fs = NULL;
out->g1_values = NULL;
out->g2_values = NULL;
ret = new_g1_array(&out->g1_values, n1); ret = new_g1_array(&out->g1_values, n1);
if (ret != C_KZG_OK) goto out_error; if (ret != C_KZG_OK) goto out_error;