summaryrefslogtreecommitdiff
path: root/read-cache.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2018-03-21 18:30:15 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-03-21 18:30:15 (GMT)
commitd17811154b2482bae3fd089f29528e7b7b7ce62b (patch)
tree2cfe574ab7b61341efe6666744e85e6ac75da3af /read-cache.c
parentc108a77f8f9de5b42c9661b9d4584f54f57766ec (diff)
parent00a4b0350198ce2039af2360ff5d83a1f8ee6cd9 (diff)
downloadgit-d17811154b2482bae3fd089f29528e7b7b7ce62b.zip
git-d17811154b2482bae3fd089f29528e7b7b7ce62b.tar.gz
git-d17811154b2482bae3fd089f29528e7b7b7ce62b.tar.bz2
Merge branch 'rj/warning-uninitialized-fix'
Compilation fix. * rj/warning-uninitialized-fix: read-cache: fix an -Wmaybe-uninitialized warning -Wuninitialized: remove some 'init-self' workarounds
Diffstat (limited to 'read-cache.c')
-rw-r--r--read-cache.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/read-cache.c b/read-cache.c
index a5dc7c7..59a73f4 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -2110,13 +2110,15 @@ static int ce_write_entry(git_hash_ctx *c, int fd, struct cache_entry *ce,
struct strbuf *previous_name, struct ondisk_cache_entry *ondisk)
{
int size;
- int saved_namelen = saved_namelen; /* compiler workaround */
int result;
+ unsigned int saved_namelen;
+ int stripped_name = 0;
static unsigned char padding[8] = { 0x00 };
if (ce->ce_flags & CE_STRIP_NAME) {
saved_namelen = ce_namelen(ce);
ce->ce_namelen = 0;
+ stripped_name = 1;
}
if (ce->ce_flags & CE_EXTENDED)
@@ -2156,7 +2158,7 @@ static int ce_write_entry(git_hash_ctx *c, int fd, struct cache_entry *ce,
strbuf_splice(previous_name, common, to_remove,
ce->name + common, ce_namelen(ce) - common);
}
- if (ce->ce_flags & CE_STRIP_NAME) {
+ if (stripped_name) {
ce->ce_namelen = saved_namelen;
ce->ce_flags &= ~CE_STRIP_NAME;
}