Skip to content

Commit

Permalink
remove superfluous memset
Browse files Browse the repository at this point in the history
Signed-off-by: Pantelis Antoniou <[email protected]>
  • Loading branch information
pantoniou committed Sep 11, 2023
1 parent eb90f8d commit eb234be
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/blake3/blake3.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// vim: ts=2 sw=2 et
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
Expand Down Expand Up @@ -26,7 +27,6 @@ INLINE void chunk_state_init(blake3_chunk_state *self, const uint32_t key[8],
uint8_t flags) {
memcpy(self->cv, key, BLAKE3_KEY_LEN);
self->chunk_counter = 0;
memset(self->buf, 0, BLAKE3_BLOCK_LEN);
self->buf_len = 0;
self->blocks_compressed = 0;
self->flags = flags;
Expand All @@ -37,7 +37,6 @@ INLINE void chunk_state_reset(blake3_chunk_state *self, const uint32_t key[8],
memcpy(self->cv, key, BLAKE3_KEY_LEN);
self->chunk_counter = chunk_counter;
self->blocks_compressed = 0;
memset(self->buf, 0, BLAKE3_BLOCK_LEN);
self->buf_len = 0;
}

Expand Down Expand Up @@ -136,7 +135,6 @@ INLINE void chunk_state_update(blake3_host_state *hs, blake3_chunk_state *self,
self->flags | chunk_state_maybe_start_flag(self));
self->blocks_compressed += 1;
self->buf_len = 0;
memset(self->buf, 0, BLAKE3_BLOCK_LEN);
}
}

Expand Down Expand Up @@ -440,6 +438,7 @@ INLINE void compress_subtree_to_parent_node(blake3_host_state *hs,

INLINE void hasher_init_base(blake3_hasher *self, const uint32_t key[8],
uint8_t flags) {
memset(self, 0, sizeof(*self));
memcpy(self->key, key, BLAKE3_KEY_LEN);
chunk_state_init(&self->chunk, key, flags);
self->cv_stack_len = 0;
Expand Down

0 comments on commit eb234be

Please sign in to comment.