aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii2010-08-22 18:37:01 +0300
committerEli Zaretskii2010-08-22 18:37:01 +0300
commit5f2f0bc11ecabcbc3867b73577c9b29d3b229e72 (patch)
tree03e637e8adbbbe60ab4a93a0acd0cba20541e8b8 /src
parent91bdeb6639bb1613eb91d9bb04ef7d8c78dc1d9d (diff)
downloademacs-5f2f0bc11ecabcbc3867b73577c9b29d3b229e72.tar.gz
emacs-5f2f0bc11ecabcbc3867b73577c9b29d3b229e72.zip
Clean up 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.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog9
-rw-r--r--src/unexcoff.c64
2 files changed, 33 insertions, 40 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 403a588df4c..08ad83ba107 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,12 @@
12010-08-22 Eli Zaretskii <eliz@gnu.org>
2
3 * unexcoff.c (report_error, make_hdr, write_segment)
4 (copy_text_and_data, copy_sym, mark_x, adjust_lnnoptrs, unexec):
5 Convert argument lists and prototypes to ANSI C.
6 (make_hdr, write_segment): Remove unused variables.
7 (unexec): Remove commented-out line. Initialize `new' to shut up
8 compiler warnings.
9
12010-08-21 Eli Zaretskii <eliz@gnu.org> 102010-08-21 Eli Zaretskii <eliz@gnu.org>
2 11
3 * dispnew.c (buffer_posn_from_coords): Fix off-by-one error in 12 * dispnew.c (buffer_posn_from_coords): Fix off-by-one error in
diff --git a/src/unexcoff.c b/src/unexcoff.c
index 3e9786348c3..cb4b8d603b5 100644
--- a/src/unexcoff.c
+++ b/src/unexcoff.c
@@ -84,6 +84,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
84#ifdef MSDOS 84#ifdef MSDOS
85#include <fcntl.h> /* for O_RDONLY, O_RDWR */ 85#include <fcntl.h> /* for O_RDONLY, O_RDWR */
86#include <crt0.h> /* for _crt0_startup_flags and its bits */ 86#include <crt0.h> /* for _crt0_startup_flags and its bits */
87#include <sys/exceptn.h>
87static int save_djgpp_startup_flags; 88static int save_djgpp_startup_flags;
88#define filehdr external_filehdr 89#define filehdr external_filehdr
89#define scnhdr external_scnhdr 90#define scnhdr external_scnhdr
@@ -128,7 +129,7 @@ struct aouthdr
128#endif 129#endif
129 130
130 131
131extern char *start_of_data (); /* Start of initialized data */ 132extern char *start_of_data (void); /* Start of initialized data */
132 133
133static long block_copy_start; /* Old executable start point */ 134static long block_copy_start; /* Old executable start point */
134static struct filehdr f_hdr; /* File header */ 135static struct filehdr f_hdr; /* File header */
@@ -153,10 +154,8 @@ static int pagemask;
153#include <setjmp.h> 154#include <setjmp.h>
154#include "lisp.h" 155#include "lisp.h"
155 156
156static 157static void
157report_error (file, fd) 158report_error (const char *file, int fd)
158 char *file;
159 int fd;
160{ 159{
161 if (fd) 160 if (fd)
162 close (fd); 161 close (fd);
@@ -167,20 +166,18 @@ report_error (file, fd)
167#define ERROR1(msg,x) report_error_1 (new, msg, x, 0); return -1 166#define ERROR1(msg,x) report_error_1 (new, msg, x, 0); return -1
168#define ERROR2(msg,x,y) report_error_1 (new, msg, x, y); return -1 167#define ERROR2(msg,x,y) report_error_1 (new, msg, x, y); return -1
169 168
170static 169static void
171report_error_1 (fd, msg, a1, a2) 170report_error_1 (int fd, const char *msg, int a1, int a2)
172 int fd;
173 char *msg;
174 int a1, a2;
175{ 171{
176 close (fd); 172 close (fd);
177 error (msg, a1, a2); 173 error (msg, a1, a2);
178} 174}
179 175
180static int make_hdr (); 176static int make_hdr (int, int, unsigned, unsigned, unsigned,
181static int copy_text_and_data (); 177 const char *, const char *);
182static int copy_sym (); 178static int copy_text_and_data (int, int);
183static void mark_x (); 179static int copy_sym (int, int, const char *, const char *);
180static void mark_x (const char *);
184 181
185/* **************************************************************** 182/* ****************************************************************
186 * make_hdr 183 * make_hdr
@@ -189,13 +186,9 @@ static void mark_x ();
189 * Modify the text and data sizes. 186 * Modify the text and data sizes.
190 */ 187 */
191static int 188static int
192make_hdr (new, a_out, data_start, bss_start, entry_address, a_name, new_name) 189make_hdr (int new, int a_out, unsigned data_start, unsigned bss_start,
193 int new, a_out; 190 unsigned entry_address, const char *a_name, const char *new_name)
194 unsigned data_start, bss_start, entry_address;
195 char *a_name;
196 char *new_name;
197{ 191{
198 int tem;
199 auto struct scnhdr f_thdr; /* Text section header */ 192 auto struct scnhdr f_thdr; /* Text section header */
200 auto struct scnhdr f_dhdr; /* Data section header */ 193 auto struct scnhdr f_dhdr; /* Data section header */
201 auto struct scnhdr f_bhdr; /* Bss section header */ 194 auto struct scnhdr f_bhdr; /* Bss section header */
@@ -363,12 +356,10 @@ make_hdr (new, a_out, data_start, bss_start, entry_address, a_name, new_name)
363 356
364} 357}
365 358
366write_segment (new, ptr, end) 359void
367 int new; 360write_segment (int new, const char *ptr, const char *end)
368 register char *ptr, *end;
369{ 361{
370 register int i, nwrite, ret; 362 register int i, nwrite, ret;
371 char buf[80];
372 /* This is the normal amount to write at once. 363 /* This is the normal amount to write at once.
373 It is the size of block that NFS uses. */ 364 It is the size of block that NFS uses. */
374 int writesize = 1 << 13; 365 int writesize = 1 << 13;
@@ -411,8 +402,7 @@ write_segment (new, ptr, end)
411 * Copy the text and data segments from memory to the new a.out 402 * Copy the text and data segments from memory to the new a.out
412 */ 403 */
413static int 404static int
414copy_text_and_data (new, a_out) 405copy_text_and_data (int new, int a_out)
415 int new, a_out;
416{ 406{
417 register char *end; 407 register char *end;
418 register char *ptr; 408 register char *ptr;
@@ -456,9 +446,7 @@ copy_text_and_data (new, a_out)
456 * Copy the relocation information and symbol table from the a.out to the new 446 * Copy the relocation information and symbol table from the a.out to the new
457 */ 447 */
458static int 448static int
459copy_sym (new, a_out, a_name, new_name) 449copy_sym (int new, int a_out, const char *a_name, const char *new_name)
460 int new, a_out;
461 char *a_name, *new_name;
462{ 450{
463 char page[1024]; 451 char page[1024];
464 int n; 452 int n;
@@ -494,8 +482,7 @@ copy_sym (new, a_out, a_name, new_name)
494 * After successfully building the new a.out, mark it executable 482 * After successfully building the new a.out, mark it executable
495 */ 483 */
496static void 484static void
497mark_x (name) 485mark_x (const char *name)
498 char *name;
499{ 486{
500 struct stat sbuf; 487 struct stat sbuf;
501 int um; 488 int um;
@@ -535,10 +522,8 @@ mark_x (name)
535 a reasonable size buffer. But I don't have time to work on such 522 a reasonable size buffer. But I don't have time to work on such
536 things, so I am installing it as submitted to me. -- RMS. */ 523 things, so I am installing it as submitted to me. -- RMS. */
537 524
538adjust_lnnoptrs (writedesc, readdesc, new_name) 525int
539 int writedesc; 526adjust_lnnoptrs (int writedesc, int readdesc, const char *new_name)
540 int readdesc;
541 char *new_name;
542{ 527{
543 register int nsyms; 528 register int nsyms;
544 register int new; 529 register int new;
@@ -585,11 +570,11 @@ adjust_lnnoptrs (writedesc, readdesc, new_name)
585 * 570 *
586 * driving logic. 571 * driving logic.
587 */ 572 */
588unexec (new_name, a_name, data_start, bss_start, entry_address) 573int
589 char *new_name, *a_name; 574unexec (const char *new_name, const char *a_name,
590 unsigned data_start, bss_start, entry_address; 575 unsigned data_start, unsigned bss_start, unsigned entry_address)
591{ 576{
592 int new, a_out = -1; 577 int new = -1, a_out = -1;
593 578
594 if (a_name && (a_out = open (a_name, O_RDONLY)) < 0) 579 if (a_name && (a_out = open (a_name, O_RDONLY)) < 0)
595 { 580 {
@@ -607,7 +592,6 @@ unexec (new_name, a_name, data_start, bss_start, entry_address)
607 ) 592 )
608 { 593 {
609 close (new); 594 close (new);
610 /* unlink (new_name); /* Failed, unlink new a.out */
611 return -1; 595 return -1;
612 } 596 }
613 597