]> code.delx.au - gnu-emacs/blobdiff - src/unexcw.c
Merge branch 'master' of git.savannah.gnu.org:/srv/git/emacs
[gnu-emacs] / src / unexcw.c
index afd5413c644b7dc93855104d55a554d8a8fa886d..6343b38bcff6e14924209f39318ce4e37df76d4a 100644 (file)
@@ -30,10 +30,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #define DOTEXE ".exe"
 
-extern void report_sheap_usage (int);
-
-extern int bss_sbrk_did_unexec;
-
 /*
 ** header for Windows executable files
 */
@@ -151,7 +147,7 @@ fixup_executable (int fd)
          assert (ret == my_edata - (char *) start_address);
          ++found_data;
          if (debug_unexcw)
-           printf ("         .data, mem start %#lx mem length %d\n",
+           printf ("         .data, mem start %#lx mem length %td\n",
                    start_address, my_edata - (char *) start_address);
          if (debug_unexcw)
            printf ("         .data, file start %d file length %d\n",
@@ -217,7 +213,7 @@ fixup_executable (int fd)
                       sizeof (exe_header->section_header[i]));
              assert (ret == sizeof (exe_header->section_header[i]));
              if (debug_unexcw)
-               printf ("         seek to %ld, write %d\n",
+               printf ("         seek to %ld, write %zu\n",
                        (long) ((char *) &exe_header->section_header[i] -
                                (char *) exe_header),
                        sizeof (exe_header->section_header[i]));
@@ -232,7 +228,7 @@ fixup_executable (int fd)
                   my_endbss - (char *) start_address);
          assert (ret == (my_endbss - (char *) start_address));
          if (debug_unexcw)
-           printf ("         .bss, mem start %#lx mem length %d\n",
+           printf ("         .bss, mem start %#lx mem length %td\n",
                    start_address, my_endbss - (char *) start_address);
          if (debug_unexcw)
            printf ("         .bss, file start %d file length %d\n",
@@ -276,14 +272,12 @@ unexec (const char *outfile, const char *infile)
   int ret;
   int ret2;
 
-  report_sheap_usage (1);
-
   infile = add_exe_suffix_if_necessary (infile, infile_buffer);
   outfile = add_exe_suffix_if_necessary (outfile, outfile_buffer);
 
-  fd_in = emacs_open (infile, O_RDONLY | O_BINARY, 0);
+  fd_in = emacs_open (infile, O_RDONLY, 0);
   assert (fd_in >= 0);
-  fd_out = emacs_open (outfile, O_RDWR | O_TRUNC | O_CREAT | O_BINARY, 0755);
+  fd_out = emacs_open (outfile, O_RDWR | O_TRUNC | O_CREAT, 0755);
   assert (fd_out >= 0);
   for (;;)
     {
@@ -302,9 +296,7 @@ unexec (const char *outfile, const char *infile)
   ret = emacs_close (fd_in);
   assert (ret == 0);
 
-  bss_sbrk_did_unexec = 1;
   fixup_executable (fd_out);
-  bss_sbrk_did_unexec = 0;
 
   ret = emacs_close (fd_out);
   assert (ret == 0);