From: Junio C Hamano Date: Tue, 20 Mar 2018 21:22:50 +0000 (-0700) Subject: Merge branch 'rj/warning-uninitialized-fix' into next X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/9ac9d02b0bb5a12c247f9cbeaa8c30b8aed3f167?hp=d63d45ff16b78a22d9a3e690060af535bd849c92 Merge branch 'rj/warning-uninitialized-fix' into next Compilation fix. * rj/warning-uninitialized-fix: read-cache: fix an -Wmaybe-uninitialized warning -Wuninitialized: remove some 'init-self' workarounds --- diff --git a/builtin/rev-list.c b/builtin/rev-list.c index 2fd72c0be5..fadd3ec14c 100644 --- a/builtin/rev-list.c +++ b/builtin/rev-list.c @@ -536,7 +536,7 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix) mark_edges_uninteresting(&revs, show_edge); if (bisect_list) { - int reaches = reaches, all = all; + int reaches, all; find_bisection(&revs.commits, &reaches, &all, bisect_find_all); diff --git a/fast-import.c b/fast-import.c index b300e4416d..a2e8b1d763 100644 --- a/fast-import.c +++ b/fast-import.c @@ -3006,7 +3006,7 @@ static void cat_blob(struct object_entry *oe, struct object_id *oid) static void parse_get_mark(const char *p) { - struct object_entry *oe = oe; + struct object_entry *oe; char output[GIT_MAX_HEXSZ + 2]; /* get-mark SP LF */ @@ -3023,7 +3023,7 @@ static void parse_get_mark(const char *p) static void parse_cat_blob(const char *p) { - struct object_entry *oe = oe; + struct object_entry *oe; struct object_id oid; /* cat-blob SP LF */ diff --git a/merge-recursive.c b/merge-recursive.c index 408d30e300..9c05eb7f70 100644 --- a/merge-recursive.c +++ b/merge-recursive.c @@ -3111,7 +3111,7 @@ int merge_recursive(struct merge_options *o, { struct commit_list *iter; struct commit *merged_common_ancestors; - struct tree *mrtree = mrtree; + struct tree *mrtree; int clean; if (show(o, 4)) { diff --git a/read-cache.c b/read-cache.c index f23d9a4731..10f1c6bb8a 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; }