changeset 109950:5bf026670e73

Clean up and ANSIfy unexcoff.c. unexcoff.c (report_error, make_hdr, write_segment) (copy_text_and_data, copy_sym, mark_x, adjust_lnnoptrs, unexec): Convert argument lists and prototypes to ANSI C. (make_hdr, write_segment): Remove unused variables. (unexec): Remove commented-out line. Initialize `new' to shut up compiler warnings.
author Eli Zaretskii <eliz@gnu.org>
date Sun, 22 Aug 2010 18:43:00 +0300
parents 5f187a091415 (current diff) adb097c7df58 (diff)
children 63671fb2a78d
files src/ChangeLog
diffstat 2 files changed, 33 insertions(+), 40 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Sun Aug 22 08:14:37 2010 -0700
+++ b/src/ChangeLog	Sun Aug 22 18:43:00 2010 +0300
@@ -1,3 +1,12 @@
+2010-08-22  Eli Zaretskii  <eliz@gnu.org>
+
+	* unexcoff.c (report_error, make_hdr, write_segment)
+	(copy_text_and_data, copy_sym, mark_x, adjust_lnnoptrs, unexec):
+	Convert argument lists and prototypes to ANSI C.
+	(make_hdr, write_segment): Remove unused variables.
+	(unexec): Remove commented-out line.  Initialize `new' to shut up
+	compiler warnings.
+
 2010-08-22  Dan Nicolaescu  <dann@ics.uci.edu>
 
 	Simplify termio code.
--- a/src/unexcoff.c	Sun Aug 22 08:14:37 2010 -0700
+++ b/src/unexcoff.c	Sun Aug 22 18:43:00 2010 +0300
@@ -84,6 +84,7 @@
 #ifdef MSDOS
 #include <fcntl.h>  /* for O_RDONLY, O_RDWR */
 #include <crt0.h>   /* for _crt0_startup_flags and its bits */
+#include <sys/exceptn.h>
 static int save_djgpp_startup_flags;
 #define filehdr external_filehdr
 #define scnhdr external_scnhdr
@@ -128,7 +129,7 @@
 #endif
 
 
-extern char *start_of_data ();		/* Start of initialized data */
+extern char *start_of_data (void);		/* Start of initialized data */
 
 static long block_copy_start;		/* Old executable start point */
 static struct filehdr f_hdr;		/* File header */
@@ -153,10 +154,8 @@
 #include <setjmp.h>
 #include "lisp.h"
 
-static
-report_error (file, fd)
-     char *file;
-     int fd;
+static void
+report_error (const char *file, int fd)
 {
   if (fd)
     close (fd);
@@ -167,20 +166,18 @@
 #define ERROR1(msg,x) report_error_1 (new, msg, x, 0); return -1
 #define ERROR2(msg,x,y) report_error_1 (new, msg, x, y); return -1
 
-static
-report_error_1 (fd, msg, a1, a2)
-     int fd;
-     char *msg;
-     int a1, a2;
+static void
+report_error_1 (int fd, const char *msg, int a1, int a2)
 {
   close (fd);
   error (msg, a1, a2);
 }
 
-static int make_hdr ();
-static int copy_text_and_data ();
-static int copy_sym ();
-static void mark_x ();
+static int make_hdr (int, int, unsigned, unsigned, unsigned,
+		     const char *, const char *);
+static int copy_text_and_data (int, int);
+static int copy_sym (int, int, const char *, const char *);
+static void mark_x (const char *);
 
 /* ****************************************************************
  * make_hdr
@@ -189,13 +186,9 @@
  * Modify the text and data sizes.
  */
 static int
-make_hdr (new, a_out, data_start, bss_start, entry_address, a_name, new_name)
-     int new, a_out;
-     unsigned data_start, bss_start, entry_address;
-     char *a_name;
-     char *new_name;
+make_hdr (int new, int a_out, unsigned data_start, unsigned bss_start,
+	  unsigned entry_address, const char *a_name, const char *new_name)
 {
-  int tem;
   auto struct scnhdr f_thdr;		/* Text section header */
   auto struct scnhdr f_dhdr;		/* Data section header */
   auto struct scnhdr f_bhdr;		/* Bss section header */
@@ -363,12 +356,10 @@
 
 }
 
-write_segment (new, ptr, end)
-     int new;
-     register char *ptr, *end;
+void
+write_segment (int new, const char *ptr, const char *end)
 {
   register int i, nwrite, ret;
-  char buf[80];
   /* This is the normal amount to write at once.
      It is the size of block that NFS uses.  */
   int writesize = 1 << 13;
@@ -411,8 +402,7 @@
  * Copy the text and data segments from memory to the new a.out
  */
 static int
-copy_text_and_data (new, a_out)
-     int new, a_out;
+copy_text_and_data (int new, int a_out)
 {
   register char *end;
   register char *ptr;
@@ -456,9 +446,7 @@
  * Copy the relocation information and symbol table from the a.out to the new
  */
 static int
-copy_sym (new, a_out, a_name, new_name)
-     int new, a_out;
-     char *a_name, *new_name;
+copy_sym (int new, int a_out, const char *a_name, const char *new_name)
 {
   char page[1024];
   int n;
@@ -494,8 +482,7 @@
  * After successfully building the new a.out, mark it executable
  */
 static void
-mark_x (name)
-     char *name;
+mark_x (const char *name)
 {
   struct stat sbuf;
   int um;
@@ -535,10 +522,8 @@
    a reasonable size buffer.  But I don't have time to work on such
    things, so I am installing it as submitted to me.  -- RMS.  */
 
-adjust_lnnoptrs (writedesc, readdesc, new_name)
-     int writedesc;
-     int readdesc;
-     char *new_name;
+int
+adjust_lnnoptrs (int writedesc, int readdesc, const char *new_name)
 {
   register int nsyms;
   register int new;
@@ -585,11 +570,11 @@
  *
  * driving logic.
  */
-unexec (new_name, a_name, data_start, bss_start, entry_address)
-     char *new_name, *a_name;
-     unsigned data_start, bss_start, entry_address;
+int
+unexec (const char *new_name, const char *a_name,
+	unsigned data_start, unsigned bss_start, unsigned entry_address)
 {
-  int new, a_out = -1;
+  int new = -1, a_out = -1;
 
   if (a_name && (a_out = open (a_name, O_RDONLY)) < 0)
     {
@@ -607,7 +592,6 @@
       )
     {
       close (new);
-      /* unlink (new_name);	    	/* Failed, unlink new a.out */
       return -1;
     }