Skip to content

Commit bd8d4dc

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 b3d1754 commit bd8d4dc

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
@@ -3446,7 +3446,7 @@ static int files_fsck_refs_name(struct ref_store *ref_store UNUSED,
34463446
goto cleanup;
34473447

34483448
if (check_refname_format(iter->basename, REFNAME_ALLOW_ONELEVEL)) {
3449-
struct fsck_ref_report report = { .path = NULL };
3449+
struct fsck_ref_report report = { 0 };
34503450

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

0 commit comments

Comments
 (0)