]> git.ipfire.org Git - pakfire.git/commitdiff
digests: Simplify initialization
authorMichael Tremer <michael.tremer@ipfire.org>
Sat, 26 Oct 2024 13:29:20 +0000 (13:29 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Sat, 26 Oct 2024 13:29:20 +0000 (13:29 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/libpakfire/include/pakfire/digest.h
tests/libpakfire/digest.c

index 7f34853bb4c2f9578ac1b0796847737681d5427f..cbcde085e387e9113d23d7ab0d6c5f7b81eb669c 100644 (file)
@@ -78,16 +78,6 @@ struct pakfire_digests {
        unsigned char sha2_256[SHA256_DIGEST_LENGTH];
 };
 
-#define PAKFIRE_DIGESTS_INIT \
-       { \
-               .sha3_512 = 0, \
-               .sha3_256 = 0, \
-               .blake2b512 = 0, \
-               .blake2s256 = 0, \
-               .sha2_512 = 0, \
-               .sha2_256 = 0, \
-       }
-
 size_t pakfire_digest_length(const enum pakfire_digest_types digest);
 
 const unsigned char* pakfire_digest_get(struct pakfire_digests* digests,
index 050b268c032ee4aeba7f6789e1f0b420405fa1a3..e9a85dcc4422728725de1ead35b03a132f60cdbc 100644 (file)
@@ -43,7 +43,7 @@ static const struct pakfire_digests expected_digests = {
 };
 
 static int test_init(const struct test* t) {
-       struct pakfire_digests digests = PAKFIRE_DIGESTS_INIT;
+       struct pakfire_digests digests = {};
 
        // Check if everything is initialized correctly
        ASSERT(pakfire_digest_set(digests.sha2_512) == 0);
@@ -56,7 +56,7 @@ FAIL:
 }
 
 static int test_random(const struct test* t) {
-       struct pakfire_digests digests = PAKFIRE_DIGESTS_INIT;
+       struct pakfire_digests digests = {};
        FILE* f = NULL;
        int r = EXIT_FAILURE;