aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndreas Schwab2011-07-10 10:20:10 +0200
committerAndreas Schwab2011-07-10 10:20:10 +0200
commit1dae0f0aadd0e0fe51893aff89bb3220cba953db (patch)
tree771e2250c7fad12abc3bace5f91fd7e7963fdc55 /src
parent99033785c7adac8711cc7c56a99c4e3b441648b1 (diff)
downloademacs-1dae0f0aadd0e0fe51893aff89bb3220cba953db.tar.gz
emacs-1dae0f0aadd0e0fe51893aff89bb3220cba953db.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog34
-rw-r--r--src/buffer.c115
-rw-r--r--src/data.c3
-rw-r--r--src/dispnew.c3
-rw-r--r--src/emacs.c3
-rw-r--r--src/floatfns.c3
-rw-r--r--src/font.c29
-rw-r--r--src/image.c4
-rw-r--r--src/indent.c3
-rw-r--r--src/intervals.c24
-rw-r--r--src/lread.c4
-rw-r--r--src/regex.c17
-rw-r--r--src/sysdep.c3
-rw-r--r--src/termcap.c50
-rw-r--r--src/tparam.c5
-rw-r--r--src/unexhp9k800.c172
-rw-r--r--src/widget.c6
-rw-r--r--src/xdisp.c3
-rw-r--r--src/xfaces.c10
-rw-r--r--src/xfns.c7
-rw-r--r--src/xrdb.c23
21 files changed, 238 insertions, 283 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 64ea0a5bcf0..f8acc3b3836 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,37 @@
12011-07-10 Andreas Schwab <schwab@linux-m68k.org>
2
3 * buffer.c (mmap_init, mmap_find, mmap_free_1, mmap_enlarge)
4 (mmap_set_vars, mmap_alloc, mmap_free, mmap_realloc): Protoize.
5 * data.c (fmod): Likewise.
6 * dispnew.c (swap_glyphs_in_rows): Likewise.
7 * emacs.c (memory_warning_signal): Likewise.
8 * floatfns.c (float_error): Likewise.
9 * font.c (check_gstring, check_otf_features, otf_tag_symbol)
10 (otf_open, font_otf_capability, generate_otf_features)
11 (font_otf_DeviceTable, font_otf_ValueRecord, font_otf_Anchor):
12 Likewise.
13 * image.c (pbm_read_file): Likewise.
14 * indent.c (string_display_width): Likewise.
15 * intervals.c (check_for_interval, search_for_interval)
16 (inc_interval_count, count_intervals, root_interval)
17 (adjust_intervals_for_insertion, make_new_interval): Likewise.
18 * lread.c (defalias): Likewise.
19 * regex.c (set_image_of_range_1, set_image_of_range)
20 (regex_grow_registers): Likewise.
21 * sysdep.c (strerror): Likewise.
22 * termcap.c (valid_filename_p, tprint, main): Likewise.
23 * tparam.c (main): Likewise.
24 * unexhp9k800.c (run_time_remap, save_data_space)
25 (update_file_ptrs, read_header, write_header, calculate_checksum)
26 (copy_file, copy_rest, display_header): Likewise.
27 * widget.c (mark_shell_size_user_specified, create_frame_gcs):
28 Likewise.
29 * xdisp.c (check_it): Likewise.
30 * xfaces.c (register_color, unregister_color, unregister_colors):
31 Likewise.
32 * xfns.c (print_fontset_result): Likewise.
33 * xrdb.c (member, fatal, main): Likewise.
34
12011-07-10 Paul Eggert <eggert@cs.ucla.edu> 352011-07-10 Paul Eggert <eggert@cs.ucla.edu>
2 36
3 Fix minor problems found by static checking (Bug#9031). 37 Fix minor problems found by static checking (Bug#9031).
diff --git a/src/buffer.c b/src/buffer.c
index e2f34d629e9..1b8b1117893 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -4466,24 +4466,40 @@ static int mmap_initialized_p;
4466#define MMAP_ALLOCATED_P(start, end) 1 4466#define MMAP_ALLOCATED_P(start, end) 1
4467#endif 4467#endif
4468 4468
4469/* Function prototypes. */ 4469/* Perform necessary intializations for the use of mmap. */
4470 4470
4471static int mmap_free_1 (struct mmap_region *); 4471static void
4472static int mmap_enlarge (struct mmap_region *, int); 4472mmap_init (void)
4473static struct mmap_region *mmap_find (POINTER_TYPE *, POINTER_TYPE *); 4473{
4474static POINTER_TYPE *mmap_alloc (POINTER_TYPE **, size_t); 4474#if MAP_ANON == 0
4475static POINTER_TYPE *mmap_realloc (POINTER_TYPE **, size_t); 4475 /* The value of mmap_fd is initially 0 in temacs, and -1
4476static void mmap_free (POINTER_TYPE **ptr); 4476 in a dumped Emacs. */
4477static void mmap_init (void); 4477 if (mmap_fd <= 0)
4478 {
4479 /* No anonymous mmap -- we need the file descriptor. */
4480 mmap_fd = open ("/dev/zero", O_RDONLY);
4481 if (mmap_fd == -1)
4482 fatal ("Cannot open /dev/zero: %s", emacs_strerror (errno));
4483 }
4484#endif /* MAP_ANON == 0 */
4485
4486 if (mmap_initialized_p)
4487 return;
4488 mmap_initialized_p = 1;
4478 4489
4490#if MAP_ANON != 0
4491 mmap_fd = -1;
4492#endif
4493
4494 mmap_page_size = getpagesize ();
4495}
4479 4496
4480/* Return a region overlapping address range START...END, or null if 4497/* Return a region overlapping address range START...END, or null if
4481 none. END is not including, i.e. the last byte in the range 4498 none. END is not including, i.e. the last byte in the range
4482 is at END - 1. */ 4499 is at END - 1. */
4483 4500
4484static struct mmap_region * 4501static struct mmap_region *
4485mmap_find (start, end) 4502mmap_find (POINTER_TYPE *start, POINTER_TYPE *end);
4486 POINTER_TYPE *start, *end;
4487{ 4503{
4488 struct mmap_region *r; 4504 struct mmap_region *r;
4489 char *s = (char *) start, *e = (char *) end; 4505 char *s = (char *) start, *e = (char *) end;
@@ -4512,8 +4528,7 @@ mmap_find (start, end)
4512 the region. Value is non-zero if successful. */ 4528 the region. Value is non-zero if successful. */
4513 4529
4514static int 4530static int
4515mmap_free_1 (r) 4531mmap_free_1 (struct mmap_region *r)
4516 struct mmap_region *r;
4517{ 4532{
4518 if (r->next) 4533 if (r->next)
4519 r->next->prev = r->prev; 4534 r->next->prev = r->prev;
@@ -4536,9 +4551,7 @@ mmap_free_1 (r)
4536 Value is non-zero if successful. */ 4551 Value is non-zero if successful. */
4537 4552
4538static int 4553static int
4539mmap_enlarge (r, npages) 4554mmap_enlarge (struct mmap_region *r, int npages)
4540 struct mmap_region *r;
4541 int npages;
4542{ 4555{
4543 char *region_end = (char *) r + r->nbytes_mapped; 4556 char *region_end = (char *) r + r->nbytes_mapped;
4544 size_t nbytes; 4557 size_t nbytes;
@@ -4602,8 +4615,7 @@ mmap_enlarge (r, npages)
4602 when Emacs starts. */ 4615 when Emacs starts. */
4603 4616
4604void 4617void
4605mmap_set_vars (restore_p) 4618mmap_set_vars (int restore_p)
4606 int restore_p;
4607{ 4619{
4608 struct mmap_region *r; 4620 struct mmap_region *r;
4609 4621
@@ -4636,9 +4648,7 @@ mmap_set_vars (restore_p)
4636 return null. */ 4648 return null. */
4637 4649
4638static POINTER_TYPE * 4650static POINTER_TYPE *
4639mmap_alloc (var, nbytes) 4651mmap_alloc (POINTER_TYPE **var, size_t nbytes)
4640 POINTER_TYPE **var;
4641 size_t nbytes;
4642{ 4652{
4643 void *p; 4653 void *p;
4644 size_t map; 4654 size_t map;
@@ -4675,15 +4685,29 @@ mmap_alloc (var, nbytes)
4675} 4685}
4676 4686
4677 4687
4688/* Free a block of relocatable storage whose data is pointed to by
4689 PTR. Store 0 in *PTR to show there's no block allocated. */
4690
4691static void
4692mmap_free (POINTER_TYPE **var)
4693{
4694 mmap_init ();
4695
4696 if (*var)
4697 {
4698 mmap_free_1 (MMAP_REGION (*var));
4699 *var = NULL;
4700 }
4701}
4702
4703
4678/* Given a pointer at address VAR to data allocated with mmap_alloc, 4704/* Given a pointer at address VAR to data allocated with mmap_alloc,
4679 resize it to size NBYTES. Change *VAR to reflect the new block, 4705 resize it to size NBYTES. Change *VAR to reflect the new block,
4680 and return this value. If more memory cannot be allocated, then 4706 and return this value. If more memory cannot be allocated, then
4681 leave *VAR unchanged, and return null. */ 4707 leave *VAR unchanged, and return null. */
4682 4708
4683static POINTER_TYPE * 4709static POINTER_TYPE *
4684mmap_realloc (var, nbytes) 4710mmap_realloc (POINTER_TYPE **var, size_t nbytes)
4685 POINTER_TYPE **var;
4686 size_t nbytes;
4687{ 4711{
4688 POINTER_TYPE *result; 4712 POINTER_TYPE *result;
4689 4713
@@ -4753,51 +4777,6 @@ mmap_realloc (var, nbytes)
4753} 4777}
4754 4778
4755 4779
4756/* Free a block of relocatable storage whose data is pointed to by
4757 PTR. Store 0 in *PTR to show there's no block allocated. */
4758
4759static void
4760mmap_free (var)
4761 POINTER_TYPE **var;
4762{
4763 mmap_init ();
4764
4765 if (*var)
4766 {
4767 mmap_free_1 (MMAP_REGION (*var));
4768 *var = NULL;
4769 }
4770}
4771
4772
4773/* Perform necessary intializations for the use of mmap. */
4774
4775static void
4776mmap_init ()
4777{
4778#if MAP_ANON == 0
4779 /* The value of mmap_fd is initially 0 in temacs, and -1
4780 in a dumped Emacs. */
4781 if (mmap_fd <= 0)
4782 {
4783 /* No anonymous mmap -- we need the file descriptor. */
4784 mmap_fd = open ("/dev/zero", O_RDONLY);
4785 if (mmap_fd == -1)
4786 fatal ("Cannot open /dev/zero: %s", emacs_strerror (errno));
4787 }
4788#endif /* MAP_ANON == 0 */
4789
4790 if (mmap_initialized_p)
4791 return;
4792 mmap_initialized_p = 1;
4793
4794#if MAP_ANON != 0
4795 mmap_fd = -1;
4796#endif
4797
4798 mmap_page_size = getpagesize ();
4799}
4800
4801#endif /* USE_MMAP_FOR_BUFFERS */ 4780#endif /* USE_MMAP_FOR_BUFFERS */
4802 4781
4803 4782
diff --git a/src/data.c b/src/data.c
index 6b4ea32ac9e..7bc04592c57 100644
--- a/src/data.c
+++ b/src/data.c
@@ -2736,8 +2736,7 @@ Both must be integers or markers. */)
2736 2736
2737#ifndef HAVE_FMOD 2737#ifndef HAVE_FMOD
2738double 2738double
2739fmod (f1, f2) 2739fmod (double f1, double f2)
2740 double f1, f2;
2741{ 2740{
2742 double r = f1; 2741 double r = f1;
2743 2742
diff --git a/src/dispnew.c b/src/dispnew.c
index 8691c921853..0026aafafc2 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -1062,8 +1062,7 @@ increment_row_positions (struct glyph_row *row,
1062 B without changing glyph pointers in A and B. */ 1062 B without changing glyph pointers in A and B. */
1063 1063
1064static void 1064static void
1065swap_glyphs_in_rows (a, b) 1065swap_glyphs_in_rows (struct glyph_row *a, struct glyph_row *b)
1066 struct glyph_row *a, *b;
1067{ 1066{
1068 int area; 1067 int area;
1069 1068
diff --git a/src/emacs.c b/src/emacs.c
index c1d517900ca..bc62735ab88 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -354,8 +354,7 @@ fatal_error_signal (int sig)
354 354
355/* Handler for SIGDANGER. */ 355/* Handler for SIGDANGER. */
356void 356void
357memory_warning_signal (sig) 357memory_warning_signal (int sig)
358 int sig;
359{ 358{
360 signal (sig, memory_warning_signal); 359 signal (sig, memory_warning_signal);
361 SIGNAL_THREAD_CHECK (sig); 360 SIGNAL_THREAD_CHECK (sig);
diff --git a/src/floatfns.c b/src/floatfns.c
index b5c8b4af5c3..e003f492fe6 100644
--- a/src/floatfns.c
+++ b/src/floatfns.c
@@ -961,8 +961,7 @@ Rounds the value toward zero. */)
961 961
962#ifdef FLOAT_CATCH_SIGILL 962#ifdef FLOAT_CATCH_SIGILL
963static void 963static void
964float_error (signo) 964float_error (int signo)
965 int signo;
966{ 965{
967 if (! in_float) 966 if (! in_float)
968 fatal_error_signal (signo); 967 fatal_error_signal (signo);
diff --git a/src/font.c b/src/font.c
index 5aff20b1346..5f8d22157d6 100644
--- a/src/font.c
+++ b/src/font.c
@@ -1738,8 +1738,7 @@ font_parse_family_registry (Lisp_Object family, Lisp_Object registry, Lisp_Objec
1738#define LGSTRING_GLYPH_SIZE 8 1738#define LGSTRING_GLYPH_SIZE 8
1739 1739
1740static int 1740static int
1741check_gstring (gstring) 1741check_gstring (Lisp_Object gstring)
1742 Lisp_Object gstring;
1743{ 1742{
1744 Lisp_Object val; 1743 Lisp_Object val;
1745 int i, j; 1744 int i, j;
@@ -1793,8 +1792,7 @@ check_gstring (gstring)
1793} 1792}
1794 1793
1795static void 1794static void
1796check_otf_features (otf_features) 1795check_otf_features (Lisp_Object otf_features)
1797 Lisp_Object otf_features;
1798{ 1796{
1799 Lisp_Object val; 1797 Lisp_Object val;
1800 1798
@@ -1827,8 +1825,7 @@ check_otf_features (otf_features)
1827Lisp_Object otf_list; 1825Lisp_Object otf_list;
1828 1826
1829static Lisp_Object 1827static Lisp_Object
1830otf_tag_symbol (tag) 1828otf_tag_symbol (OTF_Tag tag)
1831 OTF_Tag tag;
1832{ 1829{
1833 char name[5]; 1830 char name[5];
1834 1831
@@ -1837,8 +1834,7 @@ otf_tag_symbol (tag)
1837} 1834}
1838 1835
1839static OTF * 1836static OTF *
1840otf_open (file) 1837otf_open (Lisp_Object file)
1841 Lisp_Object file;
1842{ 1838{
1843 Lisp_Object val = Fassoc (file, otf_list); 1839 Lisp_Object val = Fassoc (file, otf_list);
1844 OTF *otf; 1840 OTF *otf;
@@ -1860,8 +1856,7 @@ otf_open (file)
1860 (struct font_driver).otf_capability. */ 1856 (struct font_driver).otf_capability. */
1861 1857
1862Lisp_Object 1858Lisp_Object
1863font_otf_capability (font) 1859font_otf_capability (struct font *font)
1864 struct font *font;
1865{ 1860{
1866 OTF *otf; 1861 OTF *otf;
1867 Lisp_Object capability = Fcons (Qnil, Qnil); 1862 Lisp_Object capability = Fcons (Qnil, Qnil);
@@ -1935,9 +1930,7 @@ font_otf_capability (font)
1935 FEATURES. */ 1930 FEATURES. */
1936 1931
1937static void 1932static void
1938generate_otf_features (spec, features) 1933generate_otf_features (Lisp_Object spec, char *features)
1939 Lisp_Object spec;
1940 char *features;
1941{ 1934{
1942 Lisp_Object val; 1935 Lisp_Object val;
1943 char *p; 1936 char *p;
@@ -1972,8 +1965,7 @@ generate_otf_features (spec, features)
1972} 1965}
1973 1966
1974Lisp_Object 1967Lisp_Object
1975font_otf_DeviceTable (device_table) 1968font_otf_DeviceTable (OTF_DeviceTable *device_table)
1976 OTF_DeviceTable *device_table;
1977{ 1969{
1978 int len = device_table->StartSize - device_table->EndSize + 1; 1970 int len = device_table->StartSize - device_table->EndSize + 1;
1979 1971
@@ -1982,9 +1974,7 @@ font_otf_DeviceTable (device_table)
1982} 1974}
1983 1975
1984Lisp_Object 1976Lisp_Object
1985font_otf_ValueRecord (value_format, value_record) 1977font_otf_ValueRecord (int value_format, OTF_ValueRecord *value_record)
1986 int value_format;
1987 OTF_ValueRecord *value_record;
1988{ 1978{
1989 Lisp_Object val = Fmake_vector (make_number (8), Qnil); 1979 Lisp_Object val = Fmake_vector (make_number (8), Qnil);
1990 1980
@@ -2008,8 +1998,7 @@ font_otf_ValueRecord (value_format, value_record)
2008} 1998}
2009 1999
2010Lisp_Object 2000Lisp_Object
2011font_otf_Anchor (anchor) 2001font_otf_Anchor (OTF_Anchor *anchor)
2012 OTF_Anchor *anchor;
2013{ 2002{
2014 Lisp_Object val; 2003 Lisp_Object val;
2015 2004
diff --git a/src/image.c b/src/image.c
index 6e8440fb431..fa39ff12681 100644
--- a/src/image.c
+++ b/src/image.c
@@ -5007,9 +5007,7 @@ pbm_scan_number (unsigned char **s, unsigned char *end)
5007 occurred. *SIZE is set to the size of the file. */ 5007 occurred. *SIZE is set to the size of the file. */
5008 5008
5009static char * 5009static char *
5010pbm_read_file (file, size) 5010pbm_read_file (Lisp_Object file, int *size)
5011 Lisp_Object file;
5012 int *size;
5013{ 5011{
5014 FILE *fp = NULL; 5012 FILE *fp = NULL;
5015 char *buf = NULL; 5013 char *buf = NULL;
diff --git a/src/indent.c b/src/indent.c
index 02d99d14ded..5c5966175aa 100644
--- a/src/indent.c
+++ b/src/indent.c
@@ -725,8 +725,7 @@ current_column_1 (void)
725 If END is nil, that stands for the end of STRING. */ 725 If END is nil, that stands for the end of STRING. */
726 726
727static double 727static double
728string_display_width (string, beg, end) 728string_display_width (Lisp_Object string, Lisp_Object beg, Lisp_Object end)
729 Lisp_Object string, beg, end;
730{ 729{
731 register int col; 730 register int col;
732 register unsigned char *ptr, *stop; 731 register unsigned char *ptr, *stop;
diff --git a/src/intervals.c b/src/intervals.c
index 4de001f2ffc..2063655cdb9 100644
--- a/src/intervals.c
+++ b/src/intervals.c
@@ -247,8 +247,7 @@ static int zero_length;
247INTERVAL search_interval, found_interval; 247INTERVAL search_interval, found_interval;
248 248
249void 249void
250check_for_interval (i) 250check_for_interval (INTERVAL i)
251 register INTERVAL i;
252{ 251{
253 if (i == search_interval) 252 if (i == search_interval)
254 { 253 {
@@ -258,8 +257,7 @@ check_for_interval (i)
258} 257}
259 258
260INTERVAL 259INTERVAL
261search_for_interval (i, tree) 260search_for_interval (INTERVAL i, INTERVAL tree)
262 register INTERVAL i, tree;
263{ 261{
264 icount = 0; 262 icount = 0;
265 search_interval = i; 263 search_interval = i;
@@ -269,8 +267,7 @@ search_for_interval (i, tree)
269} 267}
270 268
271static void 269static void
272inc_interval_count (i) 270inc_interval_count (INTERVAL i)
273 INTERVAL i;
274{ 271{
275 icount++; 272 icount++;
276 if (LENGTH (i) == 0) 273 if (LENGTH (i) == 0)
@@ -280,8 +277,7 @@ inc_interval_count (i)
280} 277}
281 278
282int 279int
283count_intervals (i) 280count_intervals (INTERVAL i)
284 register INTERVAL i;
285{ 281{
286 icount = 0; 282 icount = 0;
287 idepth = 0; 283 idepth = 0;
@@ -292,8 +288,7 @@ count_intervals (i)
292} 288}
293 289
294static INTERVAL 290static INTERVAL
295root_interval (interval) 291root_interval (INTERVAL interval)
296 INTERVAL interval;
297{ 292{
298 register INTERVAL i = interval; 293 register INTERVAL i = interval;
299 294
@@ -804,9 +799,8 @@ update_interval (register INTERVAL i, EMACS_INT pos)
804 to the root. */ 799 to the root. */
805 800
806static INTERVAL 801static INTERVAL
807adjust_intervals_for_insertion (tree, position, length) 802adjust_intervals_for_insertion (INTERVAL tree, EMACS_INT position,
808 INTERVAL tree; 803 EMACS_INT length)
809 EMACS_INT position, length;
810{ 804{
811 register EMACS_INT relative_position; 805 register EMACS_INT relative_position;
812 register INTERVAL this; 806 register INTERVAL this;
@@ -1615,9 +1609,7 @@ reproduce_tree_obj (INTERVAL source, Lisp_Object parent)
1615 interval. */ 1609 interval. */
1616 1610
1617static INTERVAL 1611static INTERVAL
1618make_new_interval (intervals, start, length) 1612make_new_interval (INTERVAL intervals, EMACS_INT start, EMACS_INT length)
1619 INTERVAL intervals;
1620 EMACS_INT start, length;
1621{ 1613{
1622 INTERVAL slot; 1614 INTERVAL slot;
1623 1615
diff --git a/src/lread.c b/src/lread.c
index a9b69a1977b..6cb217a21c6 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -4000,9 +4000,7 @@ defsubr (struct Lisp_Subr *sname)
4000 4000
4001#ifdef NOTDEF /* use fset in subr.el now */ 4001#ifdef NOTDEF /* use fset in subr.el now */
4002void 4002void
4003defalias (sname, string) 4003defalias (struct Lisp_Subr *sname, char *string)
4004 struct Lisp_Subr *sname;
4005 char *string;
4006{ 4004{
4007 Lisp_Object sym; 4005 Lisp_Object sym;
4008 sym = intern (string); 4006 sym = intern (string);
diff --git a/src/regex.c b/src/regex.c
index 479239897bc..625c59ccf0b 100644
--- a/src/regex.c
+++ b/src/regex.c
@@ -2202,10 +2202,9 @@ extend_range_table_work_area (struct range_table_work_area *work_area)
2202 Returns -1 if successful, REG_ESPACE if ran out of space. */ 2202 Returns -1 if successful, REG_ESPACE if ran out of space. */
2203 2203
2204static int 2204static int
2205set_image_of_range_1 (work_area, start, end, translate) 2205set_image_of_range_1 (struct range_table_work_area *work_area,
2206 RE_TRANSLATE_TYPE translate; 2206 re_wchar_t start, re_wchar_t end,
2207 struct range_table_work_area *work_area; 2207 RE_TRANSLATE_TYPE translate)
2208 re_wchar_t start, end;
2209{ 2208{
2210 /* `one_case' indicates a character, or a run of characters, 2209 /* `one_case' indicates a character, or a run of characters,
2211 each of which is an isolate (no case-equivalents). 2210 each of which is an isolate (no case-equivalents).
@@ -2355,10 +2354,9 @@ set_image_of_range_1 (work_area, start, end, translate)
2355 Returns -1 if successful, REG_ESPACE if ran out of space. */ 2354 Returns -1 if successful, REG_ESPACE if ran out of space. */
2356 2355
2357static int 2356static int
2358set_image_of_range (work_area, start, end, translate) 2357set_image_of_range (struct range_table_work_area *work_area,
2359 RE_TRANSLATE_TYPE translate; 2358 re_wchar_t start, re_wchar_t end,
2360 struct range_table_work_area *work_area; 2359 RE_TRANSLATE_TYPE translate)
2361 re_wchar_t start, end;
2362{ 2360{
2363 re_wchar_t cmin, cmax; 2361 re_wchar_t cmin, cmax;
2364 2362
@@ -2445,8 +2443,7 @@ static re_char **best_regstart, **best_regend;
2445 but don't make them smaller. */ 2443 but don't make them smaller. */
2446 2444
2447static 2445static
2448regex_grow_registers (num_regs) 2446regex_grow_registers (int num_regs)
2449 int num_regs;
2450{ 2447{
2451 if (num_regs > regs_allocated_size) 2448 if (num_regs > regs_allocated_size)
2452 { 2449 {
diff --git a/src/sysdep.c b/src/sysdep.c
index 46667cf292f..fc2f846b0dc 100644
--- a/src/sysdep.c
+++ b/src/sysdep.c
@@ -1802,8 +1802,7 @@ get_random (void)
1802#ifndef HAVE_STRERROR 1802#ifndef HAVE_STRERROR
1803#ifndef WINDOWSNT 1803#ifndef WINDOWSNT
1804char * 1804char *
1805strerror (errnum) 1805strerror (int errnum)
1806 int errnum;
1807{ 1806{
1808 extern char *sys_errlist[]; 1807 extern char *sys_errlist[];
1809 extern int sys_nerr; 1808 extern int sys_nerr;
diff --git a/src/termcap.c b/src/termcap.c
index e191f6b3af3..96b9303d62d 100644
--- a/src/termcap.c
+++ b/src/termcap.c
@@ -338,8 +338,7 @@ static int name_match (char *line, char *name);
338 338
339#ifdef MSDOS /* MW, May 1993 */ 339#ifdef MSDOS /* MW, May 1993 */
340static int 340static int
341valid_filename_p (fn) 341valid_filename_p (char *fn)
342 char *fn;
343{ 342{
344 return *fn == '/' || fn[1] == ':'; 343 return *fn == '/' || fn[1] == ':';
345} 344}
@@ -669,9 +668,29 @@ gobble_line (int fd, register struct termcap_buffer *bufp, char *append_end)
669 668
670#include <stdio.h> 669#include <stdio.h>
671 670
672main (argc, argv) 671static void
673 int argc; 672tprint (char *cap)
674 char **argv; 673{
674 char *x = tgetstr (cap, 0);
675 register char *y;
676
677 printf ("%s: ", cap);
678 if (x)
679 {
680 for (y = x; *y; y++)
681 if (*y <= ' ' || *y == 0177)
682 printf ("\\%0o", *y);
683 else
684 putchar (*y);
685 free (x);
686 }
687 else
688 printf ("none");
689 putchar ('\n');
690}
691
692int
693main (int argc, char **argv)
675{ 694{
676 char *term; 695 char *term;
677 char *buf; 696 char *buf;
@@ -693,27 +712,8 @@ main (argc, argv)
693 712
694 printf ("co: %d\n", tgetnum ("co")); 713 printf ("co: %d\n", tgetnum ("co"));
695 printf ("am: %d\n", tgetflag ("am")); 714 printf ("am: %d\n", tgetflag ("am"));
696}
697
698tprint (cap)
699 char *cap;
700{
701 char *x = tgetstr (cap, 0);
702 register char *y;
703 715
704 printf ("%s: ", cap); 716 return 0;
705 if (x)
706 {
707 for (y = x; *y; y++)
708 if (*y <= ' ' || *y == 0177)
709 printf ("\\%0o", *y);
710 else
711 putchar (*y);
712 free (x);
713 }
714 else
715 printf ("none");
716 putchar ('\n');
717} 717}
718 718
719#endif /* TEST */ 719#endif /* TEST */
diff --git a/src/tparam.c b/src/tparam.c
index 6aae0b97db9..ed28cd7397f 100644
--- a/src/tparam.c
+++ b/src/tparam.c
@@ -265,9 +265,8 @@ tparam1 (const char *string, char *outstring, int len,
265 265
266#ifdef DEBUG 266#ifdef DEBUG
267 267
268main (argc, argv) 268int
269 int argc; 269main (int argc, char **argv)
270 char **argv;
271{ 270{
272 char buf[50]; 271 char buf[50];
273 int args[3]; 272 int args[3];
diff --git a/src/unexhp9k800.c b/src/unexhp9k800.c
index f27415a252c..ce65faffd4e 100644
--- a/src/unexhp9k800.c
+++ b/src/unexhp9k800.c
@@ -64,8 +64,7 @@ static long brk_on_dump = 0;
64 64
65/* Called from main, if we use shared libraries. */ 65/* Called from main, if we use shared libraries. */
66int 66int
67run_time_remap (ignored) 67run_time_remap (char *ignored)
68 char *ignored;
69{ 68{
70 brk ((char *) brk_on_dump); 69 brk ((char *) brk_on_dump);
71} 70}
@@ -74,74 +73,11 @@ run_time_remap (ignored)
74#define roundup(x,n) (((x) + ((n) - 1)) & ~((n) - 1)) /* n is power of 2 */ 73#define roundup(x,n) (((x) + ((n) - 1)) & ~((n) - 1)) /* n is power of 2 */
75#define min(x,y) (((x) < (y)) ? (x) : (y)) 74#define min(x,y) (((x) < (y)) ? (x) : (y))
76 75
77
78/* Create a new a.out file, same as old but with current data space */
79void
80unexec (const char *new_name, /* name of the new a.out file to be created */
81 const char *old_name) /* name of the old a.out file */
82{
83 int old, new;
84 int old_size, new_size;
85 struct header hdr;
86 struct som_exec_auxhdr auxhdr;
87 long i;
88
89 /* For the greatest flexibility, should create a temporary file in
90 the same directory as the new file. When everything is complete,
91 rename the temp file to the new name.
92 This way, a program could update its own a.out file even while
93 it is still executing. If problems occur, everything is still
94 intact. NOT implemented. */
95
96 /* Open the input and output a.out files */
97 old = open (old_name, O_RDONLY);
98 if (old < 0)
99 { perror (old_name); exit (1); }
100 new = open (new_name, O_CREAT|O_RDWR|O_TRUNC, 0777);
101 if (new < 0)
102 { perror (new_name); exit (1); }
103
104 /* Read the old headers */
105 read_header (old, &hdr, &auxhdr);
106
107 brk_on_dump = (long) sbrk (0);
108
109 /* Decide how large the new and old data areas are */
110 old_size = auxhdr.exec_dsize;
111 /* I suspect these two statements are separate
112 to avoid a compiler bug in hpux version 8. */
113 i = (long) sbrk (0);
114 new_size = i - auxhdr.exec_dmem;
115
116 /* Copy the old file to the new, up to the data space */
117 lseek (old, 0, 0);
118 copy_file (old, new, auxhdr.exec_dfile);
119
120 /* Skip the old data segment and write a new one */
121 lseek (old, old_size, 1);
122 save_data_space (new, &hdr, &auxhdr, new_size);
123
124 /* Copy the rest of the file */
125 copy_rest (old, new);
126
127 /* Update file pointers since we probably changed size of data area */
128 update_file_ptrs (new, &hdr, &auxhdr, auxhdr.exec_dfile, new_size-old_size);
129
130 /* Save the modified header */
131 write_header (new, &hdr, &auxhdr);
132
133 /* Close the binary file */
134 close (old);
135 close (new);
136}
137
138/* Save current data space in the file, update header. */ 76/* Save current data space in the file, update header. */
139 77
140save_data_space (file, hdr, auxhdr, size) 78static void
141 int file; 79save_data_space (int file, struct header *hdr, struct som_exec_auxhdr *auxhdr,
142 struct header *hdr; 80 int size)
143 struct som_exec_auxhdr *auxhdr;
144 int size;
145{ 81{
146 /* Write the entire data space out to the file */ 82 /* Write the entire data space out to the file */
147 if (write (file, auxhdr->exec_dmem, size) != size) 83 if (write (file, auxhdr->exec_dmem, size) != size)
@@ -154,12 +90,9 @@ save_data_space (file, hdr, auxhdr, size)
154 90
155/* Update the values of file pointers when something is inserted. */ 91/* Update the values of file pointers when something is inserted. */
156 92
157update_file_ptrs (file, hdr, auxhdr, location, offset) 93static void
158 int file; 94update_file_ptrs (int file, struct header *hdr, struct som_exec_auxhdr *auxhdr,
159 struct header *hdr; 95 unsigned int location, int offset)
160 struct som_exec_auxhdr *auxhdr;
161 unsigned int location;
162 int offset;
163{ 96{
164 struct subspace_dictionary_record subspace; 97 struct subspace_dictionary_record subspace;
165 int i; 98 int i;
@@ -205,10 +138,8 @@ update_file_ptrs (file, hdr, auxhdr, location, offset)
205 138
206/* Read in the header records from an a.out file. */ 139/* Read in the header records from an a.out file. */
207 140
208read_header (file, hdr, auxhdr) 141static void
209 int file; 142read_header (int file, struct header *hdr, struct som_exec_auxhdr *auxhdr)
210 struct header *hdr;
211 struct som_exec_auxhdr *auxhdr;
212{ 143{
213 144
214 /* Read the header in */ 145 /* Read the header in */
@@ -233,10 +164,8 @@ read_header (file, hdr, auxhdr)
233 164
234/* Write out the header records into an a.out file. */ 165/* Write out the header records into an a.out file. */
235 166
236write_header (file, hdr, auxhdr) 167static void
237 int file; 168write_header (int file, struct header *hdr, struct som_exec_auxhdr *auxhdr)
238 struct header *hdr;
239 struct som_exec_auxhdr *auxhdr;
240{ 169{
241 /* Update the checksum */ 170 /* Update the checksum */
242 hdr->checksum = calculate_checksum (hdr); 171 hdr->checksum = calculate_checksum (hdr);
@@ -252,8 +181,8 @@ write_header (file, hdr, auxhdr)
252 181
253/* Calculate the checksum of a SOM header record. */ 182/* Calculate the checksum of a SOM header record. */
254 183
255calculate_checksum (hdr) 184static int
256 struct header *hdr; 185calculate_checksum (struct header *hdr)
257{ 186{
258 int checksum, i, *ptr; 187 int checksum, i, *ptr;
259 188
@@ -267,9 +196,8 @@ calculate_checksum (hdr)
267 196
268/* Copy size bytes from the old file to the new one. */ 197/* Copy size bytes from the old file to the new one. */
269 198
270copy_file (old, new, size) 199static void
271 int new, old; 200copy_file (int old, int new, int size)
272 int size;
273{ 201{
274 int len; 202 int len;
275 int buffer[8192]; /* word aligned will be faster */ 203 int buffer[8192]; /* word aligned will be faster */
@@ -286,8 +214,8 @@ copy_file (old, new, size)
286 214
287/* Copy the rest of the file, up to EOF. */ 215/* Copy the rest of the file, up to EOF. */
288 216
289copy_rest (old, new) 217static void
290 int new, old; 218copy_rest (int old, int new)
291{ 219{
292 int buffer[4096]; 220 int buffer[4096];
293 int len; 221 int len;
@@ -301,9 +229,8 @@ copy_rest (old, new)
301} 229}
302 230
303#ifdef DEBUG 231#ifdef DEBUG
304display_header (hdr, auxhdr) 232static void
305 struct header *hdr; 233display_header (struct header *hdr, struct som_exec_auxhdr *auxhdr)
306 struct som_exec_auxhdr *auxhdr;
307{ 234{
308 /* Display the header information (debug) */ 235 /* Display the header information (debug) */
309 printf ("\n\nFILE HEADER\n"); 236 printf ("\n\nFILE HEADER\n");
@@ -320,3 +247,64 @@ display_header (hdr, auxhdr)
320 hdr->unloadable_sp_location, hdr->unloadable_sp_size); 247 hdr->unloadable_sp_location, hdr->unloadable_sp_size);
321} 248}
322#endif /* DEBUG */ 249#endif /* DEBUG */
250
251
252/* Create a new a.out file, same as old but with current data space */
253void
254unexec (const char *new_name, /* name of the new a.out file to be created */
255 const char *old_name) /* name of the old a.out file */
256{
257 int old, new;
258 int old_size, new_size;
259 struct header hdr;
260 struct som_exec_auxhdr auxhdr;
261 long i;
262
263 /* For the greatest flexibility, should create a temporary file in
264 the same directory as the new file. When everything is complete,
265 rename the temp file to the new name.
266 This way, a program could update its own a.out file even while
267 it is still executing. If problems occur, everything is still
268 intact. NOT implemented. */
269
270 /* Open the input and output a.out files */
271 old = open (old_name, O_RDONLY);
272 if (old < 0)
273 { perror (old_name); exit (1); }
274 new = open (new_name, O_CREAT|O_RDWR|O_TRUNC, 0777);
275 if (new < 0)
276 { perror (new_name); exit (1); }
277
278 /* Read the old headers */
279 read_header (old, &hdr, &auxhdr);
280
281 brk_on_dump = (long) sbrk (0);
282
283 /* Decide how large the new and old data areas are */
284 old_size = auxhdr.exec_dsize;
285 /* I suspect these two statements are separate
286 to avoid a compiler bug in hpux version 8. */
287 i = (long) sbrk (0);
288 new_size = i - auxhdr.exec_dmem;
289
290 /* Copy the old file to the new, up to the data space */
291 lseek (old, 0, 0);
292 copy_file (old, new, auxhdr.exec_dfile);
293
294 /* Skip the old data segment and write a new one */
295 lseek (old, old_size, 1);
296 save_data_space (new, &hdr, &auxhdr, new_size);
297
298 /* Copy the rest of the file */
299 copy_rest (old, new);
300
301 /* Update file pointers since we probably changed size of data area */
302 update_file_ptrs (new, &hdr, &auxhdr, auxhdr.exec_dfile, new_size-old_size);
303
304 /* Save the modified header */
305 write_header (new, &hdr, &auxhdr);
306
307 /* Close the binary file */
308 close (old);
309 close (new);
310}
diff --git a/src/widget.c b/src/widget.c
index 6d871ad7cb2..a09ec2631ad 100644
--- a/src/widget.c
+++ b/src/widget.c
@@ -224,8 +224,7 @@ get_wm_shell (Widget w)
224#if 0 /* Currently not used. */ 224#if 0 /* Currently not used. */
225 225
226static void 226static void
227mark_shell_size_user_specified (wmshell) 227mark_shell_size_user_specified (Widget wmshell)
228 Widget wmshell;
229{ 228{
230 if (! XtIsWMShell (wmshell)) abort (); 229 if (! XtIsWMShell (wmshell)) abort ();
231 /* This is kind of sleazy, but I can't see how else to tell it to make it 230 /* This is kind of sleazy, but I can't see how else to tell it to make it
@@ -510,8 +509,7 @@ update_wm_hints (EmacsFrame ew)
510#if 0 509#if 0
511 510
512static void 511static void
513create_frame_gcs (ew) 512create_frame_gcs (EmacsFrame ew)
514 EmacsFrame ew;
515{ 513{
516 struct frame *s = ew->emacs_frame.frame; 514 struct frame *s = ew->emacs_frame.frame;
517 515
diff --git a/src/xdisp.c b/src/xdisp.c
index 774bc22699a..871317d86b8 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -2209,8 +2209,7 @@ safe_call2 (Lisp_Object fn, Lisp_Object arg1, Lisp_Object arg2)
2209 This is for debugging. It is too slow to do unconditionally. */ 2209 This is for debugging. It is too slow to do unconditionally. */
2210 2210
2211static void 2211static void
2212check_it (it) 2212check_it (struct it *it)
2213 struct it *it;
2214{ 2213{
2215 if (it->method == GET_FROM_STRING) 2214 if (it->method == GET_FROM_STRING)
2216 { 2215 {
diff --git a/src/xfaces.c b/src/xfaces.c
index 91f4b133466..c1e75ab3e59 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -536,8 +536,7 @@ int color_count[256];
536/* Register color PIXEL as allocated. */ 536/* Register color PIXEL as allocated. */
537 537
538void 538void
539register_color (pixel) 539register_color (unsigned long pixel)
540 unsigned long pixel;
541{ 540{
542 xassert (pixel < 256); 541 xassert (pixel < 256);
543 ++color_count[pixel]; 542 ++color_count[pixel];
@@ -547,8 +546,7 @@ register_color (pixel)
547/* Register color PIXEL as deallocated. */ 546/* Register color PIXEL as deallocated. */
548 547
549void 548void
550unregister_color (pixel) 549unregister_color (unsigned long pixel)
551 unsigned long pixel;
552{ 550{
553 xassert (pixel < 256); 551 xassert (pixel < 256);
554 if (color_count[pixel] > 0) 552 if (color_count[pixel] > 0)
@@ -561,9 +559,7 @@ unregister_color (pixel)
561/* Register N colors from PIXELS as deallocated. */ 559/* Register N colors from PIXELS as deallocated. */
562 560
563void 561void
564unregister_colors (pixels, n) 562unregister_colors (unsigned long *pixels, int n)
565 unsigned long *pixels;
566 int n;
567{ 563{
568 int i; 564 int i;
569 for (i = 0; i < n; ++i) 565 for (i = 0; i < n; ++i)
diff --git a/src/xfns.c b/src/xfns.c
index c70f4bb9a82..0d1e4a1bb5e 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -2001,11 +2001,8 @@ xic_create_fontsetname (const char *base_fontname, int motif)
2001 2001
2002#ifdef DEBUG_XIC_FONTSET 2002#ifdef DEBUG_XIC_FONTSET
2003static void 2003static void
2004print_fontset_result (xfs, name, missing_list, missing_count) 2004print_fontset_result (XFontSet xfs, char *name, char **missing_list,
2005 XFontSet xfs; 2005 int missing_count)
2006 char *name;
2007 char **missing_list;
2008 int missing_count;
2009{ 2006{
2010 if (xfs) 2007 if (xfs)
2011 fprintf (stderr, "XIC Fontset created: %s\n", name); 2008 fprintf (stderr, "XIC Fontset created: %s\n", name);
diff --git a/src/xrdb.c b/src/xrdb.c
index e18ff65f799..6a16e3260bd 100644
--- a/src/xrdb.c
+++ b/src/xrdb.c
@@ -651,9 +651,7 @@ typedef char **List;
651#define free_arglist(list) 651#define free_arglist(list)
652 652
653static List 653static List
654member (elt, list) 654member (char *elt, List list)
655 char *elt;
656 List list;
657{ 655{
658 List p; 656 List p;
659 657
@@ -665,20 +663,17 @@ member (elt, list)
665} 663}
666 664
667static void 665static void
668fatal (msg, prog, x1, x2, x3, x4, x5) 666fatal (char *msg, char *prog)
669 char *msg, *prog;
670 int x1, x2, x3, x4, x5;
671{ 667{
672 if (errno) 668 if (errno)
673 perror (prog); 669 perror (prog);
674 670
675 (void) fprintf (stderr, msg, prog, x1, x2, x3, x4, x5); 671 (void) fprintf (stderr, msg, prog);
676 exit (1); 672 exit (1);
677} 673}
678 674
679main (argc, argv) 675int
680 int argc; 676main (int argc, char **argv)
681 char **argv;
682{ 677{
683 Display *display; 678 Display *display;
684 char *displayname, *resource_string, *class, *name; 679 char *displayname, *resource_string, *class, *name;
@@ -749,5 +744,7 @@ main (argc, argv)
749 printf ("\tExit.\n\n"); 744 printf ("\tExit.\n\n");
750 745
751 XCloseDisplay (display); 746 XCloseDisplay (display);
747
748 return 0;
752} 749}
753#endif /* TESTRM */ 750#endif /* TESTRM */