[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r105074: Protoize
From: |
Andreas Schwab |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r105074: Protoize |
Date: |
Sun, 10 Jul 2011 10:20:10 +0200 |
User-agent: |
Bazaar (2.3.1) |
------------------------------------------------------------
revno: 105074
committer: Andreas Schwab <address@hidden>
branch nick: emacs
timestamp: Sun 2011-07-10 10:20:10 +0200
message:
Protoize
* src/buffer.c (mmap_init, mmap_find, mmap_free_1, mmap_enlarge)
(mmap_set_vars, mmap_alloc, mmap_free, mmap_realloc): Protoize.
* src/data.c (fmod): Likewise.
* src/dispnew.c (swap_glyphs_in_rows): Likewise.
* src/emacs.c (memory_warning_signal): Likewise.
* src/floatfns.c (float_error): Likewise.
* src/font.c (check_gstring, check_otf_features, otf_tag_symbol)
(otf_open, font_otf_capability, generate_otf_features)
(font_otf_DeviceTable, font_otf_ValueRecord, font_otf_Anchor):
Likewise.
* src/image.c (pbm_read_file): Likewise.
* src/indent.c (string_display_width): Likewise.
* src/intervals.c (check_for_interval, search_for_interval)
(inc_interval_count, count_intervals, root_interval)
(adjust_intervals_for_insertion, make_new_interval): Likewise.
* src/lread.c (defalias): Likewise.
* src/regex.c (set_image_of_range_1, set_image_of_range)
(regex_grow_registers): Likewise.
* src/sysdep.c (strerror): Likewise.
* src/termcap.c (valid_filename_p, tprint, main): Likewise.
* src/tparam.c (main): Likewise.
* src/unexhp9k800.c (run_time_remap, save_data_space)
(update_file_ptrs, read_header, write_header, calculate_checksum)
(copy_file, copy_rest, display_header): Likewise.
* src/widget.c (mark_shell_size_user_specified, create_frame_gcs):
Likewise.
* src/xdisp.c (check_it): Likewise.
* src/xfaces.c (register_color, unregister_color, unregister_colors):
Likewise.
* src/xfns.c (print_fontset_result): Likewise.
* src/xrdb.c (member, fatal, main): Likewise.
modified:
src/ChangeLog
src/buffer.c
src/data.c
src/dispnew.c
src/emacs.c
src/floatfns.c
src/font.c
src/image.c
src/indent.c
src/intervals.c
src/lread.c
src/regex.c
src/sysdep.c
src/termcap.c
src/tparam.c
src/unexhp9k800.c
src/widget.c
src/xdisp.c
src/xfaces.c
src/xfns.c
src/xrdb.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog 2011-07-10 04:58:22 +0000
+++ b/src/ChangeLog 2011-07-10 08:20:10 +0000
@@ -1,3 +1,37 @@
+2011-07-10 Andreas Schwab <address@hidden>
+
+ * buffer.c (mmap_init, mmap_find, mmap_free_1, mmap_enlarge)
+ (mmap_set_vars, mmap_alloc, mmap_free, mmap_realloc): Protoize.
+ * data.c (fmod): Likewise.
+ * dispnew.c (swap_glyphs_in_rows): Likewise.
+ * emacs.c (memory_warning_signal): Likewise.
+ * floatfns.c (float_error): Likewise.
+ * font.c (check_gstring, check_otf_features, otf_tag_symbol)
+ (otf_open, font_otf_capability, generate_otf_features)
+ (font_otf_DeviceTable, font_otf_ValueRecord, font_otf_Anchor):
+ Likewise.
+ * image.c (pbm_read_file): Likewise.
+ * indent.c (string_display_width): Likewise.
+ * intervals.c (check_for_interval, search_for_interval)
+ (inc_interval_count, count_intervals, root_interval)
+ (adjust_intervals_for_insertion, make_new_interval): Likewise.
+ * lread.c (defalias): Likewise.
+ * regex.c (set_image_of_range_1, set_image_of_range)
+ (regex_grow_registers): Likewise.
+ * sysdep.c (strerror): Likewise.
+ * termcap.c (valid_filename_p, tprint, main): Likewise.
+ * tparam.c (main): Likewise.
+ * unexhp9k800.c (run_time_remap, save_data_space)
+ (update_file_ptrs, read_header, write_header, calculate_checksum)
+ (copy_file, copy_rest, display_header): Likewise.
+ * widget.c (mark_shell_size_user_specified, create_frame_gcs):
+ Likewise.
+ * xdisp.c (check_it): Likewise.
+ * xfaces.c (register_color, unregister_color, unregister_colors):
+ Likewise.
+ * xfns.c (print_fontset_result): Likewise.
+ * xrdb.c (member, fatal, main): Likewise.
+
2011-07-10 Paul Eggert <address@hidden>
Fix minor problems found by static checking (Bug#9031).
=== modified file 'src/buffer.c'
--- a/src/buffer.c 2011-07-06 22:22:32 +0000
+++ b/src/buffer.c 2011-07-10 08:20:10 +0000
@@ -4466,24 +4466,40 @@
#define MMAP_ALLOCATED_P(start, end) 1
#endif
-/* Function prototypes. */
-
-static int mmap_free_1 (struct mmap_region *);
-static int mmap_enlarge (struct mmap_region *, int);
-static struct mmap_region *mmap_find (POINTER_TYPE *, POINTER_TYPE *);
-static POINTER_TYPE *mmap_alloc (POINTER_TYPE **, size_t);
-static POINTER_TYPE *mmap_realloc (POINTER_TYPE **, size_t);
-static void mmap_free (POINTER_TYPE **ptr);
-static void mmap_init (void);
-
+/* Perform necessary intializations for the use of mmap. */
+
+static void
+mmap_init (void)
+{
+#if MAP_ANON == 0
+ /* The value of mmap_fd is initially 0 in temacs, and -1
+ in a dumped Emacs. */
+ if (mmap_fd <= 0)
+ {
+ /* No anonymous mmap -- we need the file descriptor. */
+ mmap_fd = open ("/dev/zero", O_RDONLY);
+ if (mmap_fd == -1)
+ fatal ("Cannot open /dev/zero: %s", emacs_strerror (errno));
+ }
+#endif /* MAP_ANON == 0 */
+
+ if (mmap_initialized_p)
+ return;
+ mmap_initialized_p = 1;
+
+#if MAP_ANON != 0
+ mmap_fd = -1;
+#endif
+
+ mmap_page_size = getpagesize ();
+}
/* Return a region overlapping address range START...END, or null if
none. END is not including, i.e. the last byte in the range
is at END - 1. */
static struct mmap_region *
-mmap_find (start, end)
- POINTER_TYPE *start, *end;
+mmap_find (POINTER_TYPE *start, POINTER_TYPE *end);
{
struct mmap_region *r;
char *s = (char *) start, *e = (char *) end;
@@ -4512,8 +4528,7 @@
the region. Value is non-zero if successful. */
static int
-mmap_free_1 (r)
- struct mmap_region *r;
+mmap_free_1 (struct mmap_region *r)
{
if (r->next)
r->next->prev = r->prev;
@@ -4536,9 +4551,7 @@
Value is non-zero if successful. */
static int
-mmap_enlarge (r, npages)
- struct mmap_region *r;
- int npages;
+mmap_enlarge (struct mmap_region *r, int npages)
{
char *region_end = (char *) r + r->nbytes_mapped;
size_t nbytes;
@@ -4602,8 +4615,7 @@
when Emacs starts. */
void
-mmap_set_vars (restore_p)
- int restore_p;
+mmap_set_vars (int restore_p)
{
struct mmap_region *r;
@@ -4636,9 +4648,7 @@
return null. */
static POINTER_TYPE *
-mmap_alloc (var, nbytes)
- POINTER_TYPE **var;
- size_t nbytes;
+mmap_alloc (POINTER_TYPE **var, size_t nbytes)
{
void *p;
size_t map;
@@ -4675,15 +4685,29 @@
}
+/* Free a block of relocatable storage whose data is pointed to by
+ PTR. Store 0 in *PTR to show there's no block allocated. */
+
+static void
+mmap_free (POINTER_TYPE **var)
+{
+ mmap_init ();
+
+ if (*var)
+ {
+ mmap_free_1 (MMAP_REGION (*var));
+ *var = NULL;
+ }
+}
+
+
/* Given a pointer at address VAR to data allocated with mmap_alloc,
resize it to size NBYTES. Change *VAR to reflect the new block,
and return this value. If more memory cannot be allocated, then
leave *VAR unchanged, and return null. */
static POINTER_TYPE *
-mmap_realloc (var, nbytes)
- POINTER_TYPE **var;
- size_t nbytes;
+mmap_realloc (POINTER_TYPE **var, size_t nbytes)
{
POINTER_TYPE *result;
@@ -4753,51 +4777,6 @@
}
-/* Free a block of relocatable storage whose data is pointed to by
- PTR. Store 0 in *PTR to show there's no block allocated. */
-
-static void
-mmap_free (var)
- POINTER_TYPE **var;
-{
- mmap_init ();
-
- if (*var)
- {
- mmap_free_1 (MMAP_REGION (*var));
- *var = NULL;
- }
-}
-
-
-/* Perform necessary intializations for the use of mmap. */
-
-static void
-mmap_init ()
-{
-#if MAP_ANON == 0
- /* The value of mmap_fd is initially 0 in temacs, and -1
- in a dumped Emacs. */
- if (mmap_fd <= 0)
- {
- /* No anonymous mmap -- we need the file descriptor. */
- mmap_fd = open ("/dev/zero", O_RDONLY);
- if (mmap_fd == -1)
- fatal ("Cannot open /dev/zero: %s", emacs_strerror (errno));
- }
-#endif /* MAP_ANON == 0 */
-
- if (mmap_initialized_p)
- return;
- mmap_initialized_p = 1;
-
-#if MAP_ANON != 0
- mmap_fd = -1;
-#endif
-
- mmap_page_size = getpagesize ();
-}
-
#endif /* USE_MMAP_FOR_BUFFERS */
=== modified file 'src/data.c'
--- a/src/data.c 2011-06-19 18:44:58 +0000
+++ b/src/data.c 2011-07-10 08:20:10 +0000
@@ -2736,8 +2736,7 @@
#ifndef HAVE_FMOD
double
-fmod (f1, f2)
- double f1, f2;
+fmod (double f1, double f2)
{
double r = f1;
=== modified file 'src/dispnew.c'
--- a/src/dispnew.c 2011-06-25 18:21:00 +0000
+++ b/src/dispnew.c 2011-07-10 08:20:10 +0000
@@ -1062,8 +1062,7 @@
B without changing glyph pointers in A and B. */
static void
-swap_glyphs_in_rows (a, b)
- struct glyph_row *a, *b;
+swap_glyphs_in_rows (struct glyph_row *a, struct glyph_row *b)
{
int area;
=== modified file 'src/emacs.c'
--- a/src/emacs.c 2011-07-08 10:04:23 +0000
+++ b/src/emacs.c 2011-07-10 08:20:10 +0000
@@ -354,8 +354,7 @@
/* Handler for SIGDANGER. */
void
-memory_warning_signal (sig)
- int sig;
+memory_warning_signal (int sig)
{
signal (sig, memory_warning_signal);
SIGNAL_THREAD_CHECK (sig);
=== modified file 'src/floatfns.c'
--- a/src/floatfns.c 2011-06-13 02:27:16 +0000
+++ b/src/floatfns.c 2011-07-10 08:20:10 +0000
@@ -961,8 +961,7 @@
#ifdef FLOAT_CATCH_SIGILL
static void
-float_error (signo)
- int signo;
+float_error (int signo)
{
if (! in_float)
fatal_error_signal (signo);
=== modified file 'src/font.c'
--- a/src/font.c 2011-07-06 22:43:48 +0000
+++ b/src/font.c 2011-07-10 08:20:10 +0000
@@ -1738,8 +1738,7 @@
#define LGSTRING_GLYPH_SIZE 8
static int
-check_gstring (gstring)
- Lisp_Object gstring;
+check_gstring (Lisp_Object gstring)
{
Lisp_Object val;
int i, j;
@@ -1793,8 +1792,7 @@
}
static void
-check_otf_features (otf_features)
- Lisp_Object otf_features;
+check_otf_features (Lisp_Object otf_features)
{
Lisp_Object val;
@@ -1827,8 +1825,7 @@
Lisp_Object otf_list;
static Lisp_Object
-otf_tag_symbol (tag)
- OTF_Tag tag;
+otf_tag_symbol (OTF_Tag tag)
{
char name[5];
@@ -1837,8 +1834,7 @@
}
static OTF *
-otf_open (file)
- Lisp_Object file;
+otf_open (Lisp_Object file)
{
Lisp_Object val = Fassoc (file, otf_list);
OTF *otf;
@@ -1860,8 +1856,7 @@
(struct font_driver).otf_capability. */
Lisp_Object
-font_otf_capability (font)
- struct font *font;
+font_otf_capability (struct font *font)
{
OTF *otf;
Lisp_Object capability = Fcons (Qnil, Qnil);
@@ -1935,9 +1930,7 @@
FEATURES. */
static void
-generate_otf_features (spec, features)
- Lisp_Object spec;
- char *features;
+generate_otf_features (Lisp_Object spec, char *features)
{
Lisp_Object val;
char *p;
@@ -1972,8 +1965,7 @@
}
Lisp_Object
-font_otf_DeviceTable (device_table)
- OTF_DeviceTable *device_table;
+font_otf_DeviceTable (OTF_DeviceTable *device_table)
{
int len = device_table->StartSize - device_table->EndSize + 1;
@@ -1982,9 +1974,7 @@
}
Lisp_Object
-font_otf_ValueRecord (value_format, value_record)
- int value_format;
- OTF_ValueRecord *value_record;
+font_otf_ValueRecord (int value_format, OTF_ValueRecord *value_record)
{
Lisp_Object val = Fmake_vector (make_number (8), Qnil);
@@ -2008,8 +1998,7 @@
}
Lisp_Object
-font_otf_Anchor (anchor)
- OTF_Anchor *anchor;
+font_otf_Anchor (OTF_Anchor *anchor)
{
Lisp_Object val;
=== modified file 'src/image.c'
--- a/src/image.c 2011-06-23 00:46:41 +0000
+++ b/src/image.c 2011-07-10 08:20:10 +0000
@@ -5007,9 +5007,7 @@
occurred. *SIZE is set to the size of the file. */
static char *
-pbm_read_file (file, size)
- Lisp_Object file;
- int *size;
+pbm_read_file (Lisp_Object file, int *size)
{
FILE *fp = NULL;
char *buf = NULL;
=== modified file 'src/indent.c'
--- a/src/indent.c 2011-06-18 18:29:19 +0000
+++ b/src/indent.c 2011-07-10 08:20:10 +0000
@@ -725,8 +725,7 @@
If END is nil, that stands for the end of STRING. */
static double
-string_display_width (string, beg, end)
- Lisp_Object string, beg, end;
+string_display_width (Lisp_Object string, Lisp_Object beg, Lisp_Object end)
{
register int col;
register unsigned char *ptr, *stop;
=== modified file 'src/intervals.c'
--- a/src/intervals.c 2011-06-21 16:47:56 +0000
+++ b/src/intervals.c 2011-07-10 08:20:10 +0000
@@ -247,8 +247,7 @@
INTERVAL search_interval, found_interval;
void
-check_for_interval (i)
- register INTERVAL i;
+check_for_interval (INTERVAL i)
{
if (i == search_interval)
{
@@ -258,8 +257,7 @@
}
INTERVAL
-search_for_interval (i, tree)
- register INTERVAL i, tree;
+search_for_interval (INTERVAL i, INTERVAL tree)
{
icount = 0;
search_interval = i;
@@ -269,8 +267,7 @@
}
static void
-inc_interval_count (i)
- INTERVAL i;
+inc_interval_count (INTERVAL i)
{
icount++;
if (LENGTH (i) == 0)
@@ -280,8 +277,7 @@
}
int
-count_intervals (i)
- register INTERVAL i;
+count_intervals (INTERVAL i)
{
icount = 0;
idepth = 0;
@@ -292,8 +288,7 @@
}
static INTERVAL
-root_interval (interval)
- INTERVAL interval;
+root_interval (INTERVAL interval)
{
register INTERVAL i = interval;
@@ -804,9 +799,8 @@
to the root. */
static INTERVAL
-adjust_intervals_for_insertion (tree, position, length)
- INTERVAL tree;
- EMACS_INT position, length;
+adjust_intervals_for_insertion (INTERVAL tree, EMACS_INT position,
+ EMACS_INT length)
{
register EMACS_INT relative_position;
register INTERVAL this;
@@ -1615,9 +1609,7 @@
interval. */
static INTERVAL
-make_new_interval (intervals, start, length)
- INTERVAL intervals;
- EMACS_INT start, length;
+make_new_interval (INTERVAL intervals, EMACS_INT start, EMACS_INT length)
{
INTERVAL slot;
=== modified file 'src/lread.c'
--- a/src/lread.c 2011-07-02 16:18:24 +0000
+++ b/src/lread.c 2011-07-10 08:20:10 +0000
@@ -4000,9 +4000,7 @@
#ifdef NOTDEF /* use fset in subr.el now */
void
-defalias (sname, string)
- struct Lisp_Subr *sname;
- char *string;
+defalias (struct Lisp_Subr *sname, char *string)
{
Lisp_Object sym;
sym = intern (string);
=== modified file 'src/regex.c'
--- a/src/regex.c 2011-04-16 18:26:30 +0000
+++ b/src/regex.c 2011-07-10 08:20:10 +0000
@@ -2202,10 +2202,9 @@
Returns -1 if successful, REG_ESPACE if ran out of space. */
static int
-set_image_of_range_1 (work_area, start, end, translate)
- RE_TRANSLATE_TYPE translate;
- struct range_table_work_area *work_area;
- re_wchar_t start, end;
+set_image_of_range_1 (struct range_table_work_area *work_area,
+ re_wchar_t start, re_wchar_t end,
+ RE_TRANSLATE_TYPE translate)
{
/* `one_case' indicates a character, or a run of characters,
each of which is an isolate (no case-equivalents).
@@ -2355,10 +2354,9 @@
Returns -1 if successful, REG_ESPACE if ran out of space. */
static int
-set_image_of_range (work_area, start, end, translate)
- RE_TRANSLATE_TYPE translate;
- struct range_table_work_area *work_area;
- re_wchar_t start, end;
+set_image_of_range (struct range_table_work_area *work_area,
+ re_wchar_t start, re_wchar_t end,
+ RE_TRANSLATE_TYPE translate)
{
re_wchar_t cmin, cmax;
@@ -2445,8 +2443,7 @@
but don't make them smaller. */
static
-regex_grow_registers (num_regs)
- int num_regs;
+regex_grow_registers (int num_regs)
{
if (num_regs > regs_allocated_size)
{
=== modified file 'src/sysdep.c'
--- a/src/sysdep.c 2011-07-06 18:04:23 +0000
+++ b/src/sysdep.c 2011-07-10 08:20:10 +0000
@@ -1802,8 +1802,7 @@
#ifndef HAVE_STRERROR
#ifndef WINDOWSNT
char *
-strerror (errnum)
- int errnum;
+strerror (int errnum)
{
extern char *sys_errlist[];
extern int sys_nerr;
=== modified file 'src/termcap.c'
--- a/src/termcap.c 2011-06-20 07:21:06 +0000
+++ b/src/termcap.c 2011-07-10 08:20:10 +0000
@@ -338,8 +338,7 @@
#ifdef MSDOS /* MW, May 1993 */
static int
-valid_filename_p (fn)
- char *fn;
+valid_filename_p (char *fn)
{
return *fn == '/' || fn[1] == ':';
}
@@ -669,9 +668,29 @@
#include <stdio.h>
-main (argc, argv)
- int argc;
- char **argv;
+static void
+tprint (char *cap)
+{
+ char *x = tgetstr (cap, 0);
+ register char *y;
+
+ printf ("%s: ", cap);
+ if (x)
+ {
+ for (y = x; *y; y++)
+ if (*y <= ' ' || *y == 0177)
+ printf ("\\%0o", *y);
+ else
+ putchar (*y);
+ free (x);
+ }
+ else
+ printf ("none");
+ putchar ('\n');
+}
+
+int
+main (int argc, char **argv)
{
char *term;
char *buf;
@@ -693,27 +712,8 @@
printf ("co: %d\n", tgetnum ("co"));
printf ("am: %d\n", tgetflag ("am"));
-}
-
-tprint (cap)
- char *cap;
-{
- char *x = tgetstr (cap, 0);
- register char *y;
-
- printf ("%s: ", cap);
- if (x)
- {
- for (y = x; *y; y++)
- if (*y <= ' ' || *y == 0177)
- printf ("\\%0o", *y);
- else
- putchar (*y);
- free (x);
- }
- else
- printf ("none");
- putchar ('\n');
+
+ return 0;
}
#endif /* TEST */
=== modified file 'src/tparam.c'
--- a/src/tparam.c 2011-03-08 18:26:34 +0000
+++ b/src/tparam.c 2011-07-10 08:20:10 +0000
@@ -265,9 +265,8 @@
#ifdef DEBUG
-main (argc, argv)
- int argc;
- char **argv;
+int
+main (int argc, char **argv)
{
char buf[50];
int args[3];
=== modified file 'src/unexhp9k800.c'
--- a/src/unexhp9k800.c 2011-03-17 18:41:30 +0000
+++ b/src/unexhp9k800.c 2011-07-10 08:20:10 +0000
@@ -64,8 +64,7 @@
/* Called from main, if we use shared libraries. */
int
-run_time_remap (ignored)
- char *ignored;
+run_time_remap (char *ignored)
{
brk ((char *) brk_on_dump);
}
@@ -74,74 +73,11 @@
#define roundup(x,n) (((x) + ((n) - 1)) & ~((n) - 1)) /* n is power of 2 */
#define min(x,y) (((x) < (y)) ? (x) : (y))
-
-/* Create a new a.out file, same as old but with current data space */
-void
-unexec (const char *new_name, /* name of the new a.out file to be created
*/
- const char *old_name) /* name of the old a.out file */
-{
- int old, new;
- int old_size, new_size;
- struct header hdr;
- struct som_exec_auxhdr auxhdr;
- long i;
-
- /* For the greatest flexibility, should create a temporary file in
- the same directory as the new file. When everything is complete,
- rename the temp file to the new name.
- This way, a program could update its own a.out file even while
- it is still executing. If problems occur, everything is still
- intact. NOT implemented. */
-
- /* Open the input and output a.out files */
- old = open (old_name, O_RDONLY);
- if (old < 0)
- { perror (old_name); exit (1); }
- new = open (new_name, O_CREAT|O_RDWR|O_TRUNC, 0777);
- if (new < 0)
- { perror (new_name); exit (1); }
-
- /* Read the old headers */
- read_header (old, &hdr, &auxhdr);
-
- brk_on_dump = (long) sbrk (0);
-
- /* Decide how large the new and old data areas are */
- old_size = auxhdr.exec_dsize;
- /* I suspect these two statements are separate
- to avoid a compiler bug in hpux version 8. */
- i = (long) sbrk (0);
- new_size = i - auxhdr.exec_dmem;
-
- /* Copy the old file to the new, up to the data space */
- lseek (old, 0, 0);
- copy_file (old, new, auxhdr.exec_dfile);
-
- /* Skip the old data segment and write a new one */
- lseek (old, old_size, 1);
- save_data_space (new, &hdr, &auxhdr, new_size);
-
- /* Copy the rest of the file */
- copy_rest (old, new);
-
- /* Update file pointers since we probably changed size of data area */
- update_file_ptrs (new, &hdr, &auxhdr, auxhdr.exec_dfile, new_size-old_size);
-
- /* Save the modified header */
- write_header (new, &hdr, &auxhdr);
-
- /* Close the binary file */
- close (old);
- close (new);
-}
-
/* Save current data space in the file, update header. */
-save_data_space (file, hdr, auxhdr, size)
- int file;
- struct header *hdr;
- struct som_exec_auxhdr *auxhdr;
- int size;
+static void
+save_data_space (int file, struct header *hdr, struct som_exec_auxhdr *auxhdr,
+ int size)
{
/* Write the entire data space out to the file */
if (write (file, auxhdr->exec_dmem, size) != size)
@@ -154,12 +90,9 @@
/* Update the values of file pointers when something is inserted. */
-update_file_ptrs (file, hdr, auxhdr, location, offset)
- int file;
- struct header *hdr;
- struct som_exec_auxhdr *auxhdr;
- unsigned int location;
- int offset;
+static void
+update_file_ptrs (int file, struct header *hdr, struct som_exec_auxhdr *auxhdr,
+ unsigned int location, int offset)
{
struct subspace_dictionary_record subspace;
int i;
@@ -205,10 +138,8 @@
/* Read in the header records from an a.out file. */
-read_header (file, hdr, auxhdr)
- int file;
- struct header *hdr;
- struct som_exec_auxhdr *auxhdr;
+static void
+read_header (int file, struct header *hdr, struct som_exec_auxhdr *auxhdr)
{
/* Read the header in */
@@ -233,10 +164,8 @@
/* Write out the header records into an a.out file. */
-write_header (file, hdr, auxhdr)
- int file;
- struct header *hdr;
- struct som_exec_auxhdr *auxhdr;
+static void
+write_header (int file, struct header *hdr, struct som_exec_auxhdr *auxhdr)
{
/* Update the checksum */
hdr->checksum = calculate_checksum (hdr);
@@ -252,8 +181,8 @@
/* Calculate the checksum of a SOM header record. */
-calculate_checksum (hdr)
- struct header *hdr;
+static int
+calculate_checksum (struct header *hdr)
{
int checksum, i, *ptr;
@@ -267,9 +196,8 @@
/* Copy size bytes from the old file to the new one. */
-copy_file (old, new, size)
- int new, old;
- int size;
+static void
+copy_file (int old, int new, int size)
{
int len;
int buffer[8192]; /* word aligned will be faster */
@@ -286,8 +214,8 @@
/* Copy the rest of the file, up to EOF. */
-copy_rest (old, new)
- int new, old;
+static void
+copy_rest (int old, int new)
{
int buffer[4096];
int len;
@@ -301,9 +229,8 @@
}
#ifdef DEBUG
-display_header (hdr, auxhdr)
- struct header *hdr;
- struct som_exec_auxhdr *auxhdr;
+static void
+display_header (struct header *hdr, struct som_exec_auxhdr *auxhdr)
{
/* Display the header information (debug) */
printf ("\n\nFILE HEADER\n");
@@ -320,3 +247,64 @@
hdr->unloadable_sp_location, hdr->unloadable_sp_size);
}
#endif /* DEBUG */
+
+
+/* Create a new a.out file, same as old but with current data space */
+void
+unexec (const char *new_name, /* name of the new a.out file to be created
*/
+ const char *old_name) /* name of the old a.out file */
+{
+ int old, new;
+ int old_size, new_size;
+ struct header hdr;
+ struct som_exec_auxhdr auxhdr;
+ long i;
+
+ /* For the greatest flexibility, should create a temporary file in
+ the same directory as the new file. When everything is complete,
+ rename the temp file to the new name.
+ This way, a program could update its own a.out file even while
+ it is still executing. If problems occur, everything is still
+ intact. NOT implemented. */
+
+ /* Open the input and output a.out files */
+ old = open (old_name, O_RDONLY);
+ if (old < 0)
+ { perror (old_name); exit (1); }
+ new = open (new_name, O_CREAT|O_RDWR|O_TRUNC, 0777);
+ if (new < 0)
+ { perror (new_name); exit (1); }
+
+ /* Read the old headers */
+ read_header (old, &hdr, &auxhdr);
+
+ brk_on_dump = (long) sbrk (0);
+
+ /* Decide how large the new and old data areas are */
+ old_size = auxhdr.exec_dsize;
+ /* I suspect these two statements are separate
+ to avoid a compiler bug in hpux version 8. */
+ i = (long) sbrk (0);
+ new_size = i - auxhdr.exec_dmem;
+
+ /* Copy the old file to the new, up to the data space */
+ lseek (old, 0, 0);
+ copy_file (old, new, auxhdr.exec_dfile);
+
+ /* Skip the old data segment and write a new one */
+ lseek (old, old_size, 1);
+ save_data_space (new, &hdr, &auxhdr, new_size);
+
+ /* Copy the rest of the file */
+ copy_rest (old, new);
+
+ /* Update file pointers since we probably changed size of data area */
+ update_file_ptrs (new, &hdr, &auxhdr, auxhdr.exec_dfile, new_size-old_size);
+
+ /* Save the modified header */
+ write_header (new, &hdr, &auxhdr);
+
+ /* Close the binary file */
+ close (old);
+ close (new);
+}
=== modified file 'src/widget.c'
--- a/src/widget.c 2011-06-13 08:00:15 +0000
+++ b/src/widget.c 2011-07-10 08:20:10 +0000
@@ -224,8 +224,7 @@
#if 0 /* Currently not used. */
static void
-mark_shell_size_user_specified (wmshell)
- Widget wmshell;
+mark_shell_size_user_specified (Widget wmshell)
{
if (! XtIsWMShell (wmshell)) abort ();
/* This is kind of sleazy, but I can't see how else to tell it to make it
@@ -510,8 +509,7 @@
#if 0
static void
-create_frame_gcs (ew)
- EmacsFrame ew;
+create_frame_gcs (EmacsFrame ew)
{
struct frame *s = ew->emacs_frame.frame;
=== modified file 'src/xdisp.c'
--- a/src/xdisp.c 2011-07-07 16:18:25 +0000
+++ b/src/xdisp.c 2011-07-10 08:20:10 +0000
@@ -2209,8 +2209,7 @@
This is for debugging. It is too slow to do unconditionally. */
static void
-check_it (it)
- struct it *it;
+check_it (struct it *it)
{
if (it->method == GET_FROM_STRING)
{
=== modified file 'src/xfaces.c'
--- a/src/xfaces.c 2011-07-03 22:16:07 +0000
+++ b/src/xfaces.c 2011-07-10 08:20:10 +0000
@@ -536,8 +536,7 @@
/* Register color PIXEL as allocated. */
void
-register_color (pixel)
- unsigned long pixel;
+register_color (unsigned long pixel)
{
xassert (pixel < 256);
++color_count[pixel];
@@ -547,8 +546,7 @@
/* Register color PIXEL as deallocated. */
void
-unregister_color (pixel)
- unsigned long pixel;
+unregister_color (unsigned long pixel)
{
xassert (pixel < 256);
if (color_count[pixel] > 0)
@@ -561,9 +559,7 @@
/* Register N colors from PIXELS as deallocated. */
void
-unregister_colors (pixels, n)
- unsigned long *pixels;
- int n;
+unregister_colors (unsigned long *pixels, int n)
{
int i;
for (i = 0; i < n; ++i)
=== modified file 'src/xfns.c'
--- a/src/xfns.c 2011-07-04 18:31:29 +0000
+++ b/src/xfns.c 2011-07-10 08:20:10 +0000
@@ -2001,11 +2001,8 @@
#ifdef DEBUG_XIC_FONTSET
static void
-print_fontset_result (xfs, name, missing_list, missing_count)
- XFontSet xfs;
- char *name;
- char **missing_list;
- int missing_count;
+print_fontset_result (XFontSet xfs, char *name, char **missing_list,
+ int missing_count)
{
if (xfs)
fprintf (stderr, "XIC Fontset created: %s\n", name);
=== modified file 'src/xrdb.c'
--- a/src/xrdb.c 2011-06-21 02:15:16 +0000
+++ b/src/xrdb.c 2011-07-10 08:20:10 +0000
@@ -651,9 +651,7 @@
#define free_arglist(list)
static List
-member (elt, list)
- char *elt;
- List list;
+member (char *elt, List list)
{
List p;
@@ -665,20 +663,17 @@
}
static void
-fatal (msg, prog, x1, x2, x3, x4, x5)
- char *msg, *prog;
- int x1, x2, x3, x4, x5;
+fatal (char *msg, char *prog)
{
- if (errno)
- perror (prog);
+ if (errno)
+ perror (prog);
- (void) fprintf (stderr, msg, prog, x1, x2, x3, x4, x5);
- exit (1);
+ (void) fprintf (stderr, msg, prog);
+ exit (1);
}
-main (argc, argv)
- int argc;
- char **argv;
+int
+main (int argc, char **argv)
{
Display *display;
char *displayname, *resource_string, *class, *name;
@@ -749,5 +744,7 @@
printf ("\tExit.\n\n");
XCloseDisplay (display);
+
+ return 0;
}
#endif /* TESTRM */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r105074: Protoize,
Andreas Schwab <=