]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
cksum: improve API consistency checking
authorPaul Eggert <eggert@cs.ucla.edu>
Fri, 17 May 2024 04:06:58 +0000 (21:06 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Fri, 17 May 2024 06:09:32 +0000 (23:09 -0700)
* 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
src/crctab.c

index d93ec6e575fd81070bc761a2d0be74dd79a0daca..ca67755394f2d8a1d454b5abdc3dad0534db15b6 100644 (file)
@@ -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 <config.h>\n");
   printf ("#include <stdint.h>\n");
-  printf ("\nextern uint_fast32_t const crctab[8][256];\n");
+  printf ("#include <stdio.h>\n");
+  printf ("#include \"cksum.h\"\n");
+  printf ("\n");
   printf ("uint_fast32_t const crctab[8][256] = {\n");
   for (int y = 0; y < 8; y++)
     {
index f9f82ef3c27c70887a765cd2a329996907d7b3b3..bf5d884bf74156ace3953a874d5cae2335fda436 100644 (file)
@@ -1,7 +1,8 @@
 #include <config.h>
 #include <stdint.h>
+#include <stdio.h>
+#include "cksum.h"
 
-extern uint_fast32_t const crctab[8][256];
 uint_fast32_t const crctab[8][256] = {
 {
   0x00000000,