From 7d1ea63046a1fdc59614fbae9bab650fda70ca3d Mon Sep 17 00:00:00 2001 From: David Chisnall Date: Fri, 25 Dec 2015 17:03:50 +0000 Subject: [PATCH] Silence some valgrind warnings. The ignored field is never used, so it doesn't matter that the comparison to the old value is reading uninitialised memory (unless the compiler is clever enough to spot that this is undefined behaviour and do something evil). --- encoding2.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/encoding2.c b/encoding2.c index 5e73245..8e68019 100644 --- a/encoding2.c +++ b/encoding2.c @@ -236,7 +236,7 @@ static const char *sizeof_type(const char *type, size_t *size) { // All pointers look the same to me. *size += sizeof(void*) * 8; - size_t ignored; + size_t ignored = 0; // Skip the definition of the pointeee type. return sizeof_type(type+1, &ignored); } @@ -329,7 +329,7 @@ static const char *alignof_type(const char *type, size_t *align) { *align = max((alignof(void*) * 8), *align); // All pointers look the same to me. - size_t ignored; + size_t ignored = 0; // Skip the definition of the pointeee type. return alignof_type(type+1, &ignored); }