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>
Nguyễn Thái Ngọc Duy committed
Nov 3, 2018 at 09:48 UTC
f5c4a9af45fa47130c730a5da87e030d040f000b
1 file changed
+1
-3
read-cache.c
+1
-3
@@ -1746,7 +1746,7 @@ static struct cache_entry *create_from_disk(struct mem_pool *ce_mem_pool,
1746
size_t len;
1747
const char *name;
1748
unsigned int flags;
1749
- size_t copy_len;
1749
+ size_t copy_len = 0;
1750
/*
1751
* Adjacent cache entries tend to share the leading paths, so it makes
1752
* 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,
1786
die(_("malformed name field in the index, near path '%s'"),
1787
previous_ce->name);
1788
copy_len = previous_len - strip_len;
1789
- } else {
1790
- copy_len = 0;
1789
}
1790
name = (const char *)cp;
1791
}