object-file: use designated initializers for "struct git_hash_algo"

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>

Ævar Arnfjörð Bjarmason committed Feb 24, 2022 at 10:33 UTC 0cb9872eab627ba5718716e10799db9545a7044d
1 file changed +39 -39
object-file.c
+39 -39
@@ -167,49 +167,49 @@ static void git_hash_unknown_final_oid(struct object_id *oid, git_hash_ctx *ctx)
167
168 const struct git_hash_algo hash_algos[GIT_HASH_NALGOS] = {
169 {
170 - NULL,
171 - 0x00000000,
172 - 0,
173 - 0,
174 - 0,
175 - git_hash_unknown_init,
176 - git_hash_unknown_clone,
177 - git_hash_unknown_update,
178 - git_hash_unknown_final,
179 - git_hash_unknown_final_oid,
180 - NULL,
181 - NULL,
182 - NULL,
170 + .name = NULL,
171 + .format_id = 0x00000000,
172 + .rawsz = 0,
173 + .hexsz = 0,
174 + .blksz = 0,
175 + .init_fn = git_hash_unknown_init,
176 + .clone_fn = git_hash_unknown_clone,
177 + .update_fn = git_hash_unknown_update,
178 + .final_fn = git_hash_unknown_final,
179 + .final_oid_fn = git_hash_unknown_final_oid,
180 + .empty_tree = NULL,
181 + .empty_blob = NULL,
182 + .null_oid = NULL,
183 },
184 {
185 - "sha1",
186 - GIT_SHA1_FORMAT_ID,
187 - GIT_SHA1_RAWSZ,
188 - GIT_SHA1_HEXSZ,
189 - GIT_SHA1_BLKSZ,
190 - git_hash_sha1_init,
191 - git_hash_sha1_clone,
192 - git_hash_sha1_update,
193 - git_hash_sha1_final,
194 - git_hash_sha1_final_oid,
195 - &empty_tree_oid,
196 - &empty_blob_oid,
197 - &null_oid_sha1,
185 + .name = "sha1",
186 + .format_id = GIT_SHA1_FORMAT_ID,
187 + .rawsz = GIT_SHA1_RAWSZ,
188 + .hexsz = GIT_SHA1_HEXSZ,
189 + .blksz = GIT_SHA1_BLKSZ,
190 + .init_fn = git_hash_sha1_init,
191 + .clone_fn = git_hash_sha1_clone,
192 + .update_fn = git_hash_sha1_update,
193 + .final_fn = git_hash_sha1_final,
194 + .final_oid_fn = git_hash_sha1_final_oid,
195 + .empty_tree = &empty_tree_oid,
196 + .empty_blob = &empty_blob_oid,
197 + .null_oid = &null_oid_sha1,
198 },
199 {
200 - "sha256",
201 - GIT_SHA256_FORMAT_ID,
202 - GIT_SHA256_RAWSZ,
203 - GIT_SHA256_HEXSZ,
204 - GIT_SHA256_BLKSZ,
205 - git_hash_sha256_init,
206 - git_hash_sha256_clone,
207 - git_hash_sha256_update,
208 - git_hash_sha256_final,
209 - git_hash_sha256_final_oid,
210 - &empty_tree_oid_sha256,
211 - &empty_blob_oid_sha256,
212 - &null_oid_sha256,
200 + .name = "sha256",
201 + .format_id = GIT_SHA256_FORMAT_ID,
202 + .rawsz = GIT_SHA256_RAWSZ,
203 + .hexsz = GIT_SHA256_HEXSZ,
204 + .blksz = GIT_SHA256_BLKSZ,
205 + .init_fn = git_hash_sha256_init,
206 + .clone_fn = git_hash_sha256_clone,
207 + .update_fn = git_hash_sha256_update,
208 + .final_fn = git_hash_sha256_final,
209 + .final_oid_fn = git_hash_sha256_final_oid,
210 + .empty_tree = &empty_tree_oid_sha256,
211 + .empty_blob = &empty_blob_oid_sha256,
212 + .null_oid = &null_oid_sha256,
213 }
214 };
215