Skip to content

Commit f5c4a9a

Browse files
pcloudsgitster
authored andcommitted
read-cache.c: initialize copy_len to shut up gcc 8
It was reported that when building with NO_PTHREADS=1, -Wmaybe-uninitialized is triggered. Just initialize the variable from the beginning to shut the compiler up (because this warning is enabled in config.dev) Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 88168b9 commit f5c4a9a

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

read-cache.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1746,7 +1746,7 @@ static struct cache_entry *create_from_disk(struct mem_pool *ce_mem_pool,
17461746
size_t len;
17471747
const char *name;
17481748
unsigned int flags;
1749-
size_t copy_len;
1749+
size_t copy_len = 0;
17501750
/*
17511751
* Adjacent cache entries tend to share the leading paths, so it makes
17521752
* sense to only store the differences in later entries. In the v4
@@ -1786,8 +1786,6 @@ static struct cache_entry *create_from_disk(struct mem_pool *ce_mem_pool,
17861786
die(_("malformed name field in the index, near path '%s'"),
17871787
previous_ce->name);
17881788
copy_len = previous_len - strip_len;
1789-
} else {
1790-
copy_len = 0;
17911789
}
17921790
name = (const char *)cp;
17931791
}

0 commit comments

Comments
 (0)