diff options
| author | Paul Eggert | 2019-07-13 10:41:46 -0700 |
|---|---|---|
| committer | Paul Eggert | 2019-07-13 16:53:21 -0700 |
| commit | 1178f98f2c0973dd1f8a66cbb4de20c0d7af3271 (patch) | |
| tree | 0d85660fe6133895571ac48b6f1403cd8cdd58d9 /src/fns.c | |
| parent | a8ffbb20da67b20a85ddca38e20c609144c3bef3 (diff) | |
| download | emacs-1178f98f2c0973dd1f8a66cbb4de20c0d7af3271.tar.gz emacs-1178f98f2c0973dd1f8a66cbb4de20c0d7af3271.zip | |
Avoid interleaving stderr in dump_fingerprint
* src/fns.c (hexbuf_digest): New function, containing most of
the old make_digest_string.
(make_digest_string): Use it.
* src/pdumper.c (dump_fingerprint): Rewrite to use a single
fprintf call, to avoid interleaving on GNU/Linux.
Diffstat (limited to 'src/fns.c')
| -rw-r--r-- | src/fns.c | 19 |
1 files changed, 14 insertions, 5 deletions
| @@ -5040,18 +5040,27 @@ returns nil, then (funcall TEST x1 x2) also returns nil. */) | |||
| 5040 | #include "sha256.h" | 5040 | #include "sha256.h" |
| 5041 | #include "sha512.h" | 5041 | #include "sha512.h" |
| 5042 | 5042 | ||
| 5043 | static Lisp_Object | 5043 | /* Store into HEXBUF an unterminated hexadecimal character string |
| 5044 | make_digest_string (Lisp_Object digest, int digest_size) | 5044 | representing DIGEST, which is binary data of size DIGEST_SIZE bytes. |
| 5045 | HEXBUF might equal DIGEST. */ | ||
| 5046 | void | ||
| 5047 | hexbuf_digest (char *hexbuf, void const *digest, int digest_size) | ||
| 5045 | { | 5048 | { |
| 5046 | unsigned char *p = SDATA (digest); | 5049 | unsigned char const *p = digest; |
| 5047 | 5050 | ||
| 5048 | for (int i = digest_size - 1; i >= 0; i--) | 5051 | for (int i = digest_size - 1; i >= 0; i--) |
| 5049 | { | 5052 | { |
| 5050 | static char const hexdigit[16] = "0123456789abcdef"; | 5053 | static char const hexdigit[16] = "0123456789abcdef"; |
| 5051 | int p_i = p[i]; | 5054 | int p_i = p[i]; |
| 5052 | p[2 * i] = hexdigit[p_i >> 4]; | 5055 | hexbuf[2 * i] = hexdigit[p_i >> 4]; |
| 5053 | p[2 * i + 1] = hexdigit[p_i & 0xf]; | 5056 | hexbuf[2 * i + 1] = hexdigit[p_i & 0xf]; |
| 5054 | } | 5057 | } |
| 5058 | } | ||
| 5059 | |||
| 5060 | static Lisp_Object | ||
| 5061 | make_digest_string (Lisp_Object digest, int digest_size) | ||
| 5062 | { | ||
| 5063 | hexbuf_digest (SSDATA (digest), SDATA (digest), digest_size); | ||
| 5055 | return digest; | 5064 | return digest; |
| 5056 | } | 5065 | } |
| 5057 | 5066 | ||