summaryrefslogtreecommitdiff
path: root/fast-import.c
diff options
context:
space:
mode:
authorRamsay Jones <ramsay@ramsayjones.plus.com>2018-03-19 17:54:35 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-03-20 16:59:21 (GMT)
commit156e1782a88d882faf66680b5155a1c140e86a56 (patch)
treeba225fcf23d0ea18a05bfe7a786fd145210d0a4f /fast-import.c
parent38e79b1fdab9244e1727d0698afcf3bb8956c0a4 (diff)
downloadgit-156e1782a88d882faf66680b5155a1c140e86a56.zip
git-156e1782a88d882faf66680b5155a1c140e86a56.tar.gz
git-156e1782a88d882faf66680b5155a1c140e86a56.tar.bz2
-Wuninitialized: remove some 'init-self' workarounds
The 'self-initialised' variables construct (ie <type> var = var;) has been used to silence gcc '-W[maybe-]uninitialized' warnings. This has, unfortunately, caused MSVC to issue 'uninitialized variable' warnings. Also, using clang static analysis causes complaints about an 'Assigned value is garbage or undefined'. There are six such constructs in the current codebase. Only one of the six causes gcc to issue a '-Wmaybe-uninitialized' warning (which will be addressed elsewhere). The remaining five 'init-self' gcc workarounds are noted below, along with the commit which introduced them: 1. builtin/rev-list.c: 'reaches' and 'all', see commit 457f08a030 ("git-rev-list: add --bisect-vars option.", 2007-03-21). 2. merge-recursive.c:2064 'mrtree', see commit f120ae2a8e ("merge- recursive.c: mrtree in merge() is not used before set", 2007-10-29). 3. fast-import.c:3023 'oe', see commit 85c62395b1 ("fast-import: let importers retrieve blobs", 2010-11-28). 4. fast-import.c:3006 'oe', see commit 28c7b1f7b7 ("fast-import: add a get-mark command", 2015-07-01). Remove the 'self-initialised' variable constructs noted above. Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'fast-import.c')
-rw-r--r--fast-import.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fast-import.c b/fast-import.c
index b70ac02..1f01a22 100644
--- a/fast-import.c
+++ b/fast-import.c
@@ -3003,7 +3003,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 <object> LF */
@@ -3020,7 +3020,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 <object> LF */