aboutsummaryrefslogtreecommitdiffstats
path: root/lib-src
diff options
context:
space:
mode:
authorPaul Eggert2019-04-09 15:42:10 -0700
committerPaul Eggert2019-04-09 15:43:35 -0700
commite44ff2de819ead77b00c7fb4ede75ada685ff099 (patch)
treeb6601cd73ce266584f862cbad98e2a11fe143492 /lib-src
parent44a39e3e761c0774cd1bb9360db7f49e1d66ec06 (diff)
downloademacs-e44ff2de819ead77b00c7fb4ede75ada685ff099.tar.gz
emacs-e44ff2de819ead77b00c7fb4ede75ada685ff099.zip
Remove assumption of uint64_t etc. in portable code
C11 doesn’t guarantee the existence of types like uint64_t, so avoid these types in portable code, as it’s easy to do so. There’s no need to avoid the types in w32-specific code, since w32 is guaranteed to have them. * lib-src/make-fingerprint.c (main): * src/fingerprint-dummy.c: * src/fingerprint.h: * src/pdumper.c (dump_fingerprint, struct dump_header): Prefer unsigned char to uint8_t in portable code, as either will do. Put an "#include <config.h>" in fingerprint.c files, so that the corresponding .o file is rebuilt after ./configure is run. * lib-src/make-fingerprint.c (main): Simplify loop. * src/Makefile.in (fingerprint.c): Update atomically. * src/pdumper.c: Omit unnecessary check that off_t is the same size as int32_t or int64_t, as the code does not rely on this assumption. (dump_off): Use int_least32_t, not int32_t. (struct dump_reloc): Use unsigned int, not uint32_t. (dump_anonymous_allocate_w32, dump_anonymous_allocate_posix) (dump_anonymous_allocate, dump_map_file_w32, dump_map_file_posix) (dump_map_file: Do the sanity checks at compile time, not at run-time, to avoid usage of uint64_t etc. on non-w32 platforms.
Diffstat (limited to 'lib-src')
-rw-r--r--lib-src/make-fingerprint.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib-src/make-fingerprint.c b/lib-src/make-fingerprint.c
index d310366442d..4bfeaa0742c 100644
--- a/lib-src/make-fingerprint.c
+++ b/lib-src/make-fingerprint.c
@@ -89,7 +89,7 @@ main (int argc, char **argv)
89 fclose (f); 89 fclose (f);
90 } 90 }
91 91
92 uint8_t digest[32]; 92 unsigned char digest[32];
93 sha256_finish_ctx (&ctx, digest); 93 sha256_finish_ctx (&ctx, digest);
94 94
95 if (raw) 95 if (raw)
@@ -99,12 +99,12 @@ main (int argc, char **argv)
99 } 99 }
100 else 100 else
101 { 101 {
102 printf ("#include \"fingerprint.h\"\n"); 102 puts ("#include <config.h>\n"
103 printf ("\n"); 103 "#include \"fingerprint.h\"\n"
104 printf ("const uint8_t fingerprint[32] = { "); 104 "unsigned char const fingerprint[] = {");
105 for (int i = 0; i < 32; ++i) 105 for (int i = 0; i < 32; ++i)
106 printf ("%s0x%02X", i ? ", " : "", digest[i]); 106 printf ("\t0x%02X,\n", digest[i]);
107 printf (" };\n"); 107 puts ("};");
108 } 108 }
109 109
110 return EXIT_SUCCESS; 110 return EXIT_SUCCESS;