Skip to content

Commit 38cd6ee

Browse files
shejialuogitster
authored andcommitted
ref: initialize "fsck_ref_report" with zero
In "fsck.c::fsck_refs_error_function", we need to tell whether "oid" and "referent" is NULL. So, we need to always initialize these parameters to NULL instead of letting them point to anywhere when creating a new "fsck_ref_report" structure. The original code explicitly initializes the "path" member in the "struct fsck_ref_report" to NULL (which implicitly 0-initializes other members in the struct). It is more customary to use "{ 0 }" to express that we are 0-initializing everything. In order to align with the codebase, initialize "fsck_ref_report" with zero. Mentored-by: Patrick Steinhardt <[email protected]> Mentored-by: Karthik Nayak <[email protected]> Signed-off-by: shejialuo <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 34b6ce9 commit 38cd6ee

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

refs/files-backend.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3520,7 +3520,7 @@ static int files_fsck_refs_name(struct ref_store *ref_store UNUSED,
35203520
goto cleanup;
35213521

35223522
if (check_refname_format(iter->basename, REFNAME_ALLOW_ONELEVEL)) {
3523-
struct fsck_ref_report report = { .path = NULL };
3523+
struct fsck_ref_report report = { 0 };
35243524

35253525
strbuf_addf(&sb, "%s/%s", refs_check_dir, iter->relative_path);
35263526
report.path = sb.buf;

0 commit comments

Comments
 (0)