summaryrefslogtreecommitdiff
path: root/read-cache.c
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2018-11-03 08:48:49 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-11-05 04:42:11 (GMT)
commitf5c4a9af45fa47130c730a5da87e030d040f000b (patch)
tree941bb1606815abbec36b4ba2c7e03979ad57d6f2 /read-cache.c
parent88168b9b43a17d5f7712d15cf5ccfed517eb4470 (diff)
downloadgit-f5c4a9af45fa47130c730a5da87e030d040f000b.zip
git-f5c4a9af45fa47130c730a5da87e030d040f000b.tar.gz
git-f5c4a9af45fa47130c730a5da87e030d040f000b.tar.bz2
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>
Diffstat (limited to 'read-cache.c')
-rw-r--r--read-cache.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/read-cache.c b/read-cache.c
index 00cd416..c510f59 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -1746,7 +1746,7 @@ static struct cache_entry *create_from_disk(struct mem_pool *ce_mem_pool,
size_t len;
const char *name;
unsigned int flags;
- size_t copy_len;
+ size_t copy_len = 0;
/*
* Adjacent cache entries tend to share the leading paths, so it makes
* 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,
die(_("malformed name field in the index, near path '%s'"),
previous_ce->name);
copy_len = previous_len - strip_len;
- } else {
- copy_len = 0;
}
name = (const char *)cp;
}