Skip to content

Commit

Permalink
csum: xxhash: make finish_running_checksum's digest optional
Browse files Browse the repository at this point in the history
If NULL is passed, then the function can be used to free the
structure without returning the digest.

Signed-off-by: Alexandre Bruyelles <[email protected]>
  • Loading branch information
JackSlateur committed Nov 17, 2023
1 parent 98c0b8b commit dc4e356
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions csum-xxhash.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,10 @@ static void xxhash_finish_running_checksum(struct running_checksum *_c,

XXH128_hash_t hash = XXH3_128bits_digest(c->state);

((uint64_t*)digest)[0] = hash.low64;
((uint64_t*)digest)[1] = hash.high64;
if (digest) {
((uint64_t*)digest)[0] = hash.low64;
((uint64_t*)digest)[1] = hash.high64;
}
XXH3_freeState(c->state);
}

Expand Down

0 comments on commit dc4e356

Please sign in to comment.