From 44084a3ac216b7a53cdf78a9361010c084fc0535 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Thu, 16 May 2024 21:06:58 -0700 Subject: [PATCH] cksum: improve API consistency checking * src/cksum.c (main) [CRCTAB]: Generate updated crctab.c (see below). * src/crctab.c: Include cksum.h, to check consistency between decl and defn. Include stdio.h since cksum.h needs it. --- src/cksum.c | 6 ++++-- src/crctab.c | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/cksum.c b/src/cksum.c index d93ec6e57..ca6775539 100644 --- a/src/cksum.c +++ b/src/cksum.c @@ -25,7 +25,7 @@ do something like the following: cc -I../lib -DCRCTAB -o crctab cksum.c - crctab > crctab.c + ./crctab > crctab.c This software is compatible with neither the System V nor the BSD 'sum' program. It is supposed to conform to POSIX, except perhaps @@ -118,7 +118,9 @@ main (void) printf ("#include \n"); printf ("#include \n"); - printf ("\nextern uint_fast32_t const crctab[8][256];\n"); + printf ("#include \n"); + printf ("#include \"cksum.h\"\n"); + printf ("\n"); printf ("uint_fast32_t const crctab[8][256] = {\n"); for (int y = 0; y < 8; y++) { diff --git a/src/crctab.c b/src/crctab.c index f9f82ef3c..bf5d884bf 100644 --- a/src/crctab.c +++ b/src/crctab.c @@ -1,7 +1,8 @@ #include #include +#include +#include "cksum.h" -extern uint_fast32_t const crctab[8][256]; uint_fast32_t const crctab[8][256] = { { 0x00000000, -- 2.11.4.GIT