summaryrefslogtreecommitdiff
path: root/test-hashmap.c
diff options
context:
space:
mode:
authorJohannes Schindelin <Johannes.Schindelin@gmx.de>2014-12-09 09:48:36 (GMT)
committerJunio C Hamano <gitster@pobox.com>2014-12-09 21:50:15 (GMT)
commit3b9a2b07ef411d9f0066db2a5d98ff5a1f6669a5 (patch)
treea420b9032c6166142e2b3ca6aa4209d4d1e7aaa6 /test-hashmap.c
parent6a364ced497e407ab3ffb2554d4ef2c78f801832 (diff)
downloadgit-3b9a2b07ef411d9f0066db2a5d98ff5a1f6669a5.zip
git-3b9a2b07ef411d9f0066db2a5d98ff5a1f6669a5.tar.gz
git-3b9a2b07ef411d9f0066db2a5d98ff5a1f6669a5.tar.bz2
test-hashmap: squelch gcc compiler warning
At least on this developer's MacOSX (Snow Leopard, gcc-4.2.1), GCC prints a warning that 'hash' may be used uninitialized when compiling test-hashmap that 'hash' may be used uninitialized (but GCC 4.6.3 on this developer's Ubuntu server does not report this problem). The old compiler is wrong, of course, as the switch (method & 3) statement already handles all the possible cases, but that does not help in a scenario where it is hard or impossible to upgrade to a newer compiler (e.g. being stuck on an older MacOSX and having to rely on Xcode). So let's just initialize the variable and be done with it, it is hardly a crucial part of the code because it is only used by the test suite and invisible to the end users. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'test-hashmap.c')
-rw-r--r--test-hashmap.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/test-hashmap.c b/test-hashmap.c
index 581d296..d856709 100644
--- a/test-hashmap.c
+++ b/test-hashmap.c
@@ -48,7 +48,7 @@ static struct test_entry *alloc_test_entry(int hash, char *key, int klen,
static unsigned int hash(unsigned int method, unsigned int i, const char *key)
{
- unsigned int hash;
+ unsigned int hash = 0;
switch (method & 3)
{
case HASH_METHOD_FNV: