From fc87a232b4cb142715e7888783567217cfe70241 Mon Sep 17 00:00:00 2001 From: Oliver Jowett Date: Wed, 21 Jan 2015 12:54:27 +0000 Subject: [PATCH] Return non-NULL errorinfo if there are no errors to diagnose. --- crc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/crc.c b/crc.c index a986649..f7459a3 100644 --- a/crc.c +++ b/crc.c @@ -21,6 +21,9 @@ #include +// Errorinfo for "no errors" +static struct errorinfo NO_ERRORS; + // Generator polynomial for the Mode S CRC: #define MODES_GENERATOR_POLY 0xfff409U @@ -389,7 +392,7 @@ struct errorinfo *modesChecksumDiagnose(uint32_t syndrome, int bitlen) struct errorinfo ei; if (syndrome == 0) - return NULL; // no errors + return &NO_ERRORS; assert (bitlen == 56 || bitlen == 112); if (bitlen == 56) { table = bitErrorTable_short; tablesize = bitErrorTableSize_short; }