Skip to content

Commit

Permalink
Replace memset with initializations
Browse files Browse the repository at this point in the history
  • Loading branch information
jtraglia committed Dec 25, 2022
1 parent 6b0bdea commit be02f81
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/c_kzg_4844.c
Original file line number Diff line number Diff line change
Expand Up @@ -663,9 +663,10 @@ static C_KZG_RET new_fft_settings(FFTSettings *fs, unsigned int max_scale) {
C_KZG_RET ret;
fr_t root_of_unity;

memset(fs, 0, sizeof(FFTSettings));

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]));
fr_from_uint64s(&root_of_unity, scale2_root_of_unity[max_scale]);
Expand Down Expand Up @@ -787,7 +788,9 @@ C_KZG_RET load_trusted_setup(KZGSettings *out, const uint8_t g1_bytes[], size_t
g1_t *g1_projective = NULL;
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);
if (ret != C_KZG_OK) goto out_error;
Expand Down

0 comments on commit be02f81

Please sign in to comment.