git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: git@vger.kernel.org
Cc: "Junio C Hamano" <gitster@pobox.com>,
	"Martin Ågren" <martin.agren@gmail.com>,
	"Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Subject: [PATCH 06/12] object-file: use designated initializers for "struct git_hash_algo"
Date: Thu, 24 Feb 2022 10:33:01 +0100	[thread overview]
Message-ID: <patch-06.12-1c213f2b403-20220224T092805Z-avarab@gmail.com> (raw)
In-Reply-To: <cover-00.12-00000000000-20220224T092805Z-avarab@gmail.com>

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>
---
 object-file.c | 78 +++++++++++++++++++++++++--------------------------
 1 file changed, 39 insertions(+), 39 deletions(-)

diff --git a/object-file.c b/object-file.c
index 8be57f48de7..03bd6a3baf3 100644
--- a/object-file.c
+++ b/object-file.c
@@ -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,
 	}
 };
 
-- 
2.35.1.1157.g524e2d5a0db


  parent reply	other threads:[~2022-02-24  9:33 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-24  9:32 [PATCH 00/12] c99: use more designated initializers Ævar Arnfjörð Bjarmason
2022-02-24  9:32 ` [PATCH 01/12] imap-send.c: use designated initializers for "struct imap_server_conf" Ævar Arnfjörð Bjarmason
2022-02-24  9:32 ` [PATCH 02/12] refs: use designated initializers for "struct ref_storage_be" Ævar Arnfjörð Bjarmason
2022-02-24  9:32 ` [PATCH 03/12] refs: use designated initializers for "struct ref_iterator_vtable" Ævar Arnfjörð Bjarmason
2022-02-24  9:32 ` [PATCH 04/12] trace2: use designated initializers for "struct tr2_tgt" Ævar Arnfjörð Bjarmason
2022-02-24  9:33 ` [PATCH 05/12] trace2: use designated initializers for "struct tr2_dst" Ævar Arnfjörð Bjarmason
2022-02-24  9:33 ` Ævar Arnfjörð Bjarmason [this message]
2022-02-24  9:33 ` [PATCH 07/12] archive-*.c: use designated initializers for "struct archiver" Ævar Arnfjörð Bjarmason
2022-02-24  9:33 ` [PATCH 08/12] userdiff.c: use designated initializers for "struct userdiff_driver" Ævar Arnfjörð Bjarmason
2022-02-24  9:33 ` [PATCH 09/12] convert.c: use designated initializers for "struct stream_filter*" Ævar Arnfjörð Bjarmason
2022-02-24  9:33 ` [PATCH 10/12] refspec.c: use designated initializers for "struct refspec_item" Ævar Arnfjörð Bjarmason
2022-02-24  9:33 ` [PATCH 11/12] misc *.c: use designated initializers for struct assignments Ævar Arnfjörð Bjarmason
2022-02-24  9:33 ` [PATCH 12/12] misc *.c: use designated initializers for "partial" " Ævar Arnfjörð Bjarmason
2022-02-24 19:22 ` [PATCH 00/12] c99: use more designated initializers Johannes Schindelin
2022-02-24 19:53   ` Junio C Hamano
2022-02-24 22:43     ` Ævar Arnfjörð Bjarmason
2022-02-25  0:03 ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=patch-06.12-1c213f2b403-20220224T092805Z-avarab@gmail.com \
    --to=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=martin.agren@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).