]> git.ipfire.org Git - thirdparty/git.git/commitdiff
object-file: use designated initializers for "struct git_hash_algo"
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>
Thu, 24 Feb 2022 09:33:01 +0000 (10:33 +0100)
committerJunio C Hamano <gitster@pobox.com>
Thu, 24 Feb 2022 23:59:14 +0000 (15:59 -0800)
As with the preceding commit, change another file-level struct
assignment to use designated initializers.

Retain the ".name = NULL" etc. in the case of the first element of
"unknown hash algorithm", to make it explicit that we're intentionally
not setting those, it's not just that we forgot.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
object-file.c

index 8be57f48de738a7f61de8b18e10a41e2007ac045..03bd6a3baf3ed35f8636b0318f165c4017455f59 100644 (file)
@@ -167,49 +167,49 @@ static void git_hash_unknown_final_oid(struct object_id *oid, git_hash_ctx *ctx)
 
 const struct git_hash_algo hash_algos[GIT_HASH_NALGOS] = {
        {
-               NULL,
-               0x00000000,
-               0,
-               0,
-               0,
-               git_hash_unknown_init,
-               git_hash_unknown_clone,
-               git_hash_unknown_update,
-               git_hash_unknown_final,
-               git_hash_unknown_final_oid,
-               NULL,
-               NULL,
-               NULL,
+               .name = NULL,
+               .format_id = 0x00000000,
+               .rawsz = 0,
+               .hexsz = 0,
+               .blksz = 0,
+               .init_fn = git_hash_unknown_init,
+               .clone_fn = git_hash_unknown_clone,
+               .update_fn = git_hash_unknown_update,
+               .final_fn = git_hash_unknown_final,
+               .final_oid_fn = git_hash_unknown_final_oid,
+               .empty_tree = NULL,
+               .empty_blob = NULL,
+               .null_oid = NULL,
        },
        {
-               "sha1",
-               GIT_SHA1_FORMAT_ID,
-               GIT_SHA1_RAWSZ,
-               GIT_SHA1_HEXSZ,
-               GIT_SHA1_BLKSZ,
-               git_hash_sha1_init,
-               git_hash_sha1_clone,
-               git_hash_sha1_update,
-               git_hash_sha1_final,
-               git_hash_sha1_final_oid,
-               &empty_tree_oid,
-               &empty_blob_oid,
-               &null_oid_sha1,
+               .name = "sha1",
+               .format_id = GIT_SHA1_FORMAT_ID,
+               .rawsz = GIT_SHA1_RAWSZ,
+               .hexsz = GIT_SHA1_HEXSZ,
+               .blksz = GIT_SHA1_BLKSZ,
+               .init_fn = git_hash_sha1_init,
+               .clone_fn = git_hash_sha1_clone,
+               .update_fn = git_hash_sha1_update,
+               .final_fn = git_hash_sha1_final,
+               .final_oid_fn = git_hash_sha1_final_oid,
+               .empty_tree = &empty_tree_oid,
+               .empty_blob = &empty_blob_oid,
+               .null_oid = &null_oid_sha1,
        },
        {
-               "sha256",
-               GIT_SHA256_FORMAT_ID,
-               GIT_SHA256_RAWSZ,
-               GIT_SHA256_HEXSZ,
-               GIT_SHA256_BLKSZ,
-               git_hash_sha256_init,
-               git_hash_sha256_clone,
-               git_hash_sha256_update,
-               git_hash_sha256_final,
-               git_hash_sha256_final_oid,
-               &empty_tree_oid_sha256,
-               &empty_blob_oid_sha256,
-               &null_oid_sha256,
+               .name = "sha256",
+               .format_id = GIT_SHA256_FORMAT_ID,
+               .rawsz = GIT_SHA256_RAWSZ,
+               .hexsz = GIT_SHA256_HEXSZ,
+               .blksz = GIT_SHA256_BLKSZ,
+               .init_fn = git_hash_sha256_init,
+               .clone_fn = git_hash_sha256_clone,
+               .update_fn = git_hash_sha256_update,
+               .final_fn = git_hash_sha256_final,
+               .final_oid_fn = git_hash_sha256_final_oid,
+               .empty_tree = &empty_tree_oid_sha256,
+               .empty_blob = &empty_blob_oid_sha256,
+               .null_oid = &null_oid_sha256,
        }
 };