]> git.eshelyaron.com Git - emacs.git/commitdiff
Change --fingerprint to output to stdout
authorAndreas Schwab <schwab@linux-m68k.org>
Tue, 12 Oct 2021 08:47:33 +0000 (10:47 +0200)
committerAndreas Schwab <schwab@linux-m68k.org>
Tue, 12 Oct 2021 08:54:45 +0000 (10:54 +0200)
* 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.

Makefile.in
src/emacs.c
src/pdumper.c
src/pdumper.h

index c6c507fd42bf34ddb90225e60ecf20bba1c8705d..300340c6e8267ee8b059790c45e2f86cc6c208dc 100644 (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
index cda7a9bf77fda011b2d2dd509e8f81b280a20714..b178c6a06cfdd6b9bd7d52a45fd6e4cbd1e55ff1 100644 (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
index 977f4fb2a8567b3af26bcf5cdd11dbb212bbf9a5..96fbd56a23643b6bfbedd1d1665f2a210c398756 100644 (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;
     }
 
index bc339c42da5cc8ccb7c6787accff2f083e515633..87de592b8193a37eecf547df37e8e6fa813acfc4 100644 (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);