1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2025-01-14 16:50:58 +00:00

Change --fingerprint to output to stdout

* src/pdumper.c (dump_fingerprint): Add argument OUTPUT, use it
instead of stderr, update all uses.  Don't print colon if LABEL is
empty.
* src/pdumper.h (dump_fingerprint): Adjust.
* src/emacs.c (main): Print fingerprint to stdout, without label.
* Makefile.in (EMACS_PDMP): Adjust.
This commit is contained in:
Andreas Schwab 2021-10-12 10:47:33 +02:00
parent 7865bd6782
commit 0fe91bcfe2
4 changed files with 11 additions and 9 deletions

View File

@ -313,7 +313,7 @@ TRANSFORM = @program_transform_name@
EMACS_NAME = `echo emacs | sed '$(TRANSFORM)'`
EMACS = ${EMACS_NAME}${EXEEXT}
EMACSFULL = `echo emacs-${version} | sed '$(TRANSFORM)'`${EXEEXT}
EMACS_PDMP = `./src/emacs${EXEEXT} --fingerprint 2>&1 | sed 's/.* //'`.pdmp
EMACS_PDMP = `./src/emacs${EXEEXT} --fingerprint`.pdmp
# Subdirectories to make recursively.
SUBDIR = $(NTDIR) lib lib-src src lisp

View File

@ -933,7 +933,7 @@ load_pdump (int argc, char **argv)
copies and renames it. */
hexbuf_size = 2 * sizeof fingerprint;
hexbuf = xmalloc (hexbuf_size + 1);
hexbuf_digest (hexbuf, (char *)fingerprint, sizeof fingerprint);
hexbuf_digest (hexbuf, (char *) fingerprint, sizeof fingerprint);
hexbuf[hexbuf_size] = '\0';
needed = (strlen (path_exec)
+ 1
@ -1403,7 +1403,8 @@ main (int argc, char **argv)
{
if (initialized)
{
dump_fingerprint ("fingerprint", (unsigned char *)fingerprint);
dump_fingerprint (stdout, "",
(unsigned char *) fingerprint);
exit (0);
}
else

View File

@ -313,13 +313,14 @@ dump_reloc_set_offset (struct dump_reloc *reloc, dump_off offset)
}
void
dump_fingerprint (char const *label,
dump_fingerprint (FILE *output, char const *label,
unsigned char const xfingerprint[sizeof fingerprint])
{
enum { hexbuf_size = 2 * sizeof fingerprint };
char hexbuf[hexbuf_size];
hexbuf_digest (hexbuf, xfingerprint, sizeof fingerprint);
fprintf (stderr, "%s: %.*s\n", label, hexbuf_size, hexbuf);
fprintf (output, "%s%s%.*s\n", label, *label ? ": " : "",
hexbuf_size, hexbuf);
}
/* To be used if some order in the relocation process has to be enforced. */
@ -4127,7 +4128,7 @@ types. */)
ctx->header.fingerprint[i] = fingerprint[i];
const dump_off header_start = ctx->offset;
dump_fingerprint ("Dumping fingerprint", ctx->header.fingerprint);
dump_fingerprint (stderr, "Dumping fingerprint", ctx->header.fingerprint);
dump_write (ctx, &ctx->header, sizeof (ctx->header));
const dump_off header_end = ctx->offset;
@ -5596,8 +5597,8 @@ pdumper_load (const char *dump_filename, char *argv0)
desired[i] = fingerprint[i];
if (memcmp (header->fingerprint, desired, sizeof desired) != 0)
{
dump_fingerprint ("desired fingerprint", desired);
dump_fingerprint ("found fingerprint", header->fingerprint);
dump_fingerprint (stderr, "desired fingerprint", desired);
dump_fingerprint (stderr, "found fingerprint", header->fingerprint);
goto out;
}

View File

@ -50,7 +50,7 @@ enum { PDUMPER_NO_OBJECT = -1 };
#define PDUMPER_REMEMBER_SCALAR(thing) \
pdumper_remember_scalar (&(thing), sizeof (thing))
extern void dump_fingerprint (const char *label,
extern void dump_fingerprint (FILE *output, const char *label,
const unsigned char *xfingerprint);
extern void pdumper_remember_scalar_impl (void *data, ptrdiff_t nbytes);