]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
Allow NULL checksum parameter for common_header_initialize_for_reading
authorJoel Rosdahl <joel@rosdahl.net>
Thu, 4 Jul 2019 07:35:05 +0000 (09:35 +0200)
committerJoel Rosdahl <joel@rosdahl.net>
Thu, 4 Jul 2019 07:35:05 +0000 (09:35 +0200)
src/common_header.c
src/common_header.h

index 69fde2188860211955627314e99d3c2ad435b805..c2f1e97a2001bbf9b803624b0beb9c3c590d7cb0 100644 (file)
@@ -130,8 +130,10 @@ bool common_header_initialize_for_reading(
                return false;
        }
 
-       XXH64_reset(checksum, 0);
-       XXH64_update(checksum, header_bytes, sizeof(header_bytes));
+       if (checksum) {
+               XXH64_reset(checksum, 0);
+               XXH64_update(checksum, header_bytes, sizeof(header_bytes));
+       }
 
   *decompr_state = (*decompressor)->init(input, checksum);
        if (!*decompr_state) {
index b2daa50997fc81af735d8387855d72928d86949e..f4d23d25ff07bc6ba323f77c4b70d8125ab3dda1 100644 (file)
@@ -50,7 +50,7 @@ bool common_header_initialize_for_writing(
 // decompressor_state: State for the decompressor. Should be NULL if
 //                     decompressor is NULL.
 // checksum:           Checksum state that will be updated with the read bytes.
-//                     Pass NULL if decompressor is NULL.
+//                     May be NULL for no checksumming.
 bool common_header_initialize_for_reading(
        struct common_header *header,
        FILE *input,