diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2011-07-10 23:05:57 -0700 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2011-07-10 23:05:57 -0700 |
commit | da85a02af7585384008d3ebec836a7b8571f175d (patch) | |
tree | e6d4f34119ea1c45985eaed207ef6b47f650ea93 /src | |
parent | 7f5515125fbc9b46454e1f84b7e3052a0a5326f0 (diff) | |
parent | 4d45a8b7a237e1d33d0ae71d95a0ed7165ea6cda (diff) | |
download | emacs-da85a02af7585384008d3ebec836a7b8571f175d.tar.gz emacs-da85a02af7585384008d3ebec836a7b8571f175d.tar.bz2 emacs-da85a02af7585384008d3ebec836a7b8571f175d.zip |
Merge from trunk.
Diffstat (limited to 'src')
-rw-r--r-- | src/ChangeLog | 68 | ||||
-rw-r--r-- | src/alloc.c | 2 | ||||
-rw-r--r-- | src/buffer.c | 115 | ||||
-rw-r--r-- | src/chartab.c | 8 | ||||
-rw-r--r-- | src/cm.c | 3 | ||||
-rw-r--r-- | src/composite.c | 1 | ||||
-rw-r--r-- | src/data.c | 3 | ||||
-rw-r--r-- | src/dispnew.c | 3 | ||||
-rw-r--r-- | src/emacs.c | 3 | ||||
-rw-r--r-- | src/floatfns.c | 3 | ||||
-rw-r--r-- | src/font.c | 29 | ||||
-rw-r--r-- | src/gtkutil.c | 1 | ||||
-rw-r--r-- | src/image.c | 4 | ||||
-rw-r--r-- | src/indent.c | 3 | ||||
-rw-r--r-- | src/intervals.c | 24 | ||||
-rw-r--r-- | src/lread.c | 4 | ||||
-rw-r--r-- | src/ralloc.c | 2 | ||||
-rw-r--r-- | src/regex.c | 17 | ||||
-rw-r--r-- | src/sysdep.c | 3 | ||||
-rw-r--r-- | src/termcap.c | 50 | ||||
-rw-r--r-- | src/tparam.c | 5 | ||||
-rw-r--r-- | src/unexhp9k800.c | 172 | ||||
-rw-r--r-- | src/w32.c | 8 | ||||
-rw-r--r-- | src/widget.c | 6 | ||||
-rw-r--r-- | src/xdisp.c | 5 | ||||
-rw-r--r-- | src/xfaces.c | 10 | ||||
-rw-r--r-- | src/xfns.c | 7 | ||||
-rw-r--r-- | src/xmenu.c | 11 | ||||
-rw-r--r-- | src/xrdb.c | 23 |
29 files changed, 292 insertions, 301 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index e4f3401eb4d..4e69399154d 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,4 +1,4 @@ -2011-07-09 Paul Eggert <eggert@cs.ucla.edu> +2011-07-11 Paul Eggert <eggert@cs.ucla.edu> * image.c: Integer signedness and overflow and related fixes. This is not an exhaustive set of fixes, but it's time to @@ -151,6 +151,72 @@ Use EMACS_INT, not EMACS_UINT, for sizes. The code works equally well either way, and we prefer signed to unsigned. +2011-07-10 Johan Bockgård <bojohan@gnu.org> + + * xdisp.c (Ftool_bar_lines_needed): Fix WINDOWP check. + +2011-07-10 Jan Djärv <jan.h.d@swipnet.se> + + * xmenu.c (menu_highlight_callback): Only pass frame to show_help_event + for non-popups (Bug#3642). + +2011-07-10 Andreas Schwab <schwab@linux-m68k.org> + + * alloc.c (reset_malloc_hooks): Protoize. + * buffer.c (mmap_init, mmap_find, mmap_free_1, mmap_enlarge) + (mmap_set_vars, mmap_alloc, mmap_free, mmap_realloc): Likewise. + * cm.c (losecursor): Likewise. + * 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. + * ralloc.c (r_alloc_check): 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 <eggert@cs.ucla.edu> + + Fix minor problems found by static checking (Bug#9031). + * chartab.c (char_table_set_range, map_sub_char_table): + Remove unused locals. + (uniprop_table): Now static. + * composite.c (_work_char): Remove unused static var. + +2011-07-09 Juanma Barranquero <lekktu@gmail.com> + + * chartab.c (uniprop_table_uncompress): Remove unused local variable. + +2011-07-09 Jan Djärv <jan.h.d@swipnet.se> + + * gtkutil.c (qttip_cb): Remove code without function. + +2011-07-09 Eli Zaretskii <eliz@gnu.org> + + * w32.c (pthread_sigmask): New stub. + 2011-07-08 Paul Eggert <eggert@cs.ucla.edu> Use pthread_sigmask, not sigprocmask (Bug#9010). diff --git a/src/alloc.c b/src/alloc.c index 5cdd5af9ecf..f325b6ed449 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -1277,7 +1277,7 @@ emacs_blocked_realloc (void *ptr, size_t size, const void *ptr2) calls malloc because it is the first call, and we have an endless loop. */ void -reset_malloc_hooks () +reset_malloc_hooks (void) { __free_hook = old_free_hook; __malloc_hook = old_malloc_hook; diff --git a/src/buffer.c b/src/buffer.c index 48dde18b02c..05e96e85112 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -4466,24 +4466,40 @@ static int mmap_initialized_p; #define MMAP_ALLOCATED_P(start, end) 1 #endif -/* Function prototypes. */ +/* Perform necessary intializations for the use of mmap. */ -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); +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 @@ mmap_find (start, end) 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 @@ mmap_free_1 (r) 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 @@ mmap_enlarge (r, npages) 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 @@ mmap_set_vars (restore_p) 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 @@ mmap_alloc (var, nbytes) } +/* 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 @@ mmap_realloc (var, nbytes) } -/* 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 */ diff --git a/src/chartab.c b/src/chartab.c index e900a3ae71f..efe23eca83f 100644 --- a/src/chartab.c +++ b/src/chartab.c @@ -485,7 +485,6 @@ Lisp_Object char_table_set_range (Lisp_Object table, int from, int to, Lisp_Object val) { struct Lisp_Char_Table *tbl = XCHAR_TABLE (table); - Lisp_Object *contents = tbl->contents; if (from == to) char_table_set (table, from, val); @@ -759,8 +758,6 @@ map_sub_char_table (void (*c_function) (Lisp_Object, Lisp_Object, Lisp_Object), Lisp_Object function, Lisp_Object table, Lisp_Object arg, Lisp_Object val, Lisp_Object range, Lisp_Object top) { - /* Pointer to the elements of TABLE. */ - Lisp_Object *contents; /* Depth of TABLE. */ int depth; /* Minimum and maxinum characters covered by TABLE. */ @@ -777,14 +774,12 @@ map_sub_char_table (void (*c_function) (Lisp_Object, Lisp_Object, Lisp_Object), struct Lisp_Sub_Char_Table *tbl = XSUB_CHAR_TABLE (table); depth = XINT (tbl->depth); - contents = tbl->contents; min_char = XINT (tbl->min_char); max_char = min_char + chartab_chars[depth - 1] - 1; } else { depth = 0; - contents = XCHAR_TABLE (table)->contents; min_char = 0; max_char = MAX_CHAR; } @@ -1143,7 +1138,6 @@ uniprop_table_uncompress (Lisp_Object table, int idx) Lisp_Object sub = make_sub_char_table (3, min_char, Qnil); struct Lisp_Sub_Char_Table *subtbl = XSUB_CHAR_TABLE (sub); const unsigned char *p, *pend; - int i; XSUB_CHAR_TABLE (table)->contents[idx] = sub; p = SDATA (val), pend = p + SBYTES (val); @@ -1316,7 +1310,7 @@ uniprop_get_encoder (Lisp_Object table) function may load a Lisp file and thus may cause garbage-collection. */ -Lisp_Object +static Lisp_Object uniprop_table (Lisp_Object prop) { Lisp_Object val, table, result; @@ -305,7 +305,8 @@ done: } #if 0 -losecursor () +void +losecursor (void) { curY = -1; } diff --git a/src/composite.c b/src/composite.c index cf1e053f027..d402d5ad0c4 100644 --- a/src/composite.c +++ b/src/composite.c @@ -967,7 +967,6 @@ autocmp_chars (Lisp_Object rule, EMACS_INT charpos, EMACS_INT bytepos, EMACS_INT } static Lisp_Object _work_val; -static int _work_char; /* 1 iff the character C is composable. Characters of general category Z? or C? are not composable except for ZWNJ and ZWJ. */ diff --git a/src/data.c b/src/data.c index eb3f870b97c..76a54547a5d 100644 --- a/src/data.c +++ b/src/data.c @@ -2733,8 +2733,7 @@ Both must be integers or markers. */) #ifndef HAVE_FMOD double -fmod (f1, f2) - double f1, f2; +fmod (double f1, double f2) { double r = f1; diff --git a/src/dispnew.c b/src/dispnew.c index c95404b5c52..15d80367701 100644 --- a/src/dispnew.c +++ b/src/dispnew.c @@ -1029,8 +1029,7 @@ increment_row_positions (struct glyph_row *row, 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; diff --git a/src/emacs.c b/src/emacs.c index a055d89d35f..39870ec0079 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -356,8 +356,7 @@ fatal_error_signal (int sig) /* Handler for SIGDANGER. */ void -memory_warning_signal (sig) - int sig; +memory_warning_signal (int sig) { signal (sig, memory_warning_signal); SIGNAL_THREAD_CHECK (sig); diff --git a/src/floatfns.c b/src/floatfns.c index 850eb9f1bcc..89aa052e8b1 100644 --- a/src/floatfns.c +++ b/src/floatfns.c @@ -958,8 +958,7 @@ Rounds the value toward zero. */) #ifdef FLOAT_CATCH_SIGILL static void -float_error (signo) - int signo; +float_error (int signo) { if (! in_float) 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 #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 @@ check_gstring (gstring) } 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 @@ check_otf_features (otf_features) 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 @@ otf_tag_symbol (tag) } 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 @@ otf_open (file) (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 @@ font_otf_capability (font) 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 @@ generate_otf_features (spec, features) } 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 @@ font_otf_DeviceTable (device_table) } 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 @@ font_otf_ValueRecord (value_format, value_record) } Lisp_Object -font_otf_Anchor (anchor) - OTF_Anchor *anchor; +font_otf_Anchor (OTF_Anchor *anchor) { Lisp_Object val; diff --git a/src/gtkutil.c b/src/gtkutil.c index dfc5b63f375..35b366222de 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c @@ -647,7 +647,6 @@ qttip_cb (GtkWidget *widget, /* Change stupid Gtk+ default line wrapping. */ p = gtk_widget_get_parent (x->ttip_lbl); list = gtk_container_get_children (GTK_CONTAINER (p)); - iter; for (iter = list; iter; iter = g_list_next (iter)) { GtkWidget *w = GTK_WIDGET (iter->data); diff --git a/src/image.c b/src/image.c index a09fc7a8979..f6626f61c83 100644 --- a/src/image.c +++ b/src/image.c @@ -5002,9 +5002,7 @@ pbm_scan_number (unsigned char **s, unsigned char *end) 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; 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) 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; 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; 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 @@ check_for_interval (i) } 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 @@ search_for_interval (i, tree) } static void -inc_interval_count (i) - INTERVAL i; +inc_interval_count (INTERVAL i) { icount++; if (LENGTH (i) == 0) @@ -280,8 +277,7 @@ inc_interval_count (i) } int -count_intervals (i) - register INTERVAL i; +count_intervals (INTERVAL i) { icount = 0; idepth = 0; @@ -292,8 +288,7 @@ count_intervals (i) } static INTERVAL -root_interval (interval) - INTERVAL interval; +root_interval (INTERVAL interval) { register INTERVAL i = interval; @@ -804,9 +799,8 @@ update_interval (register INTERVAL i, EMACS_INT pos) 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 @@ reproduce_tree_obj (INTERVAL source, Lisp_Object parent) 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; diff --git a/src/lread.c b/src/lread.c index 6a97be2be42..bef1cc8e591 100644 --- a/src/lread.c +++ b/src/lread.c @@ -3981,9 +3981,7 @@ defsubr (struct Lisp_Subr *sname) #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); diff --git a/src/ralloc.c b/src/ralloc.c index 9c601a0ac24..64a47416202 100644 --- a/src/ralloc.c +++ b/src/ralloc.c @@ -1079,7 +1079,7 @@ r_alloc_reinit (void) #include <assert.h> void -r_alloc_check () +r_alloc_check (void) { int found = 0; heap_ptr h, ph = 0; diff --git a/src/regex.c b/src/regex.c index d347d274819..190d1d0fe21 100644 --- a/src/regex.c +++ b/src/regex.c @@ -2169,10 +2169,9 @@ extend_range_table_work_area (struct range_table_work_area *work_area) 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). @@ -2322,10 +2321,9 @@ set_image_of_range_1 (work_area, start, end, translate) 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; @@ -2412,8 +2410,7 @@ static re_char **best_regstart, **best_regend; 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) { diff --git a/src/sysdep.c b/src/sysdep.c index 077d4405593..4bd1f54b9e6 100644 --- a/src/sysdep.c +++ b/src/sysdep.c @@ -1800,8 +1800,7 @@ get_random (void) #ifndef HAVE_STRERROR #ifndef WINDOWSNT char * -strerror (errnum) - int errnum; +strerror (int errnum) { extern char *sys_errlist[]; 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); #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 @@ gobble_line (int fd, register struct termcap_buffer *bufp, char *append_end) #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 @@ main (argc, argv) 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 */ 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, #ifdef DEBUG -main (argc, argv) - int argc; - char **argv; +int +main (int argc, char **argv) { char buf[50]; 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; /* 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 @@ run_time_remap (ignored) #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 @@ save_data_space (file, hdr, auxhdr, size) /* 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 @@ update_file_ptrs (file, hdr, auxhdr, location, offset) /* 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 @@ read_header (file, hdr, auxhdr) /* 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 @@ write_header (file, hdr, auxhdr) /* 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 @@ calculate_checksum (hdr) /* 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_file (old, new, size) /* 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 @@ copy_rest (old, new) } #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 @@ display_header (hdr, auxhdr) 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); +} diff --git a/src/w32.c b/src/w32.c index 53bf2e811e2..de72e180c62 100644 --- a/src/w32.c +++ b/src/w32.c @@ -1452,6 +1452,14 @@ sigprocmask (int how, const sigset_t *set, sigset_t *oset) } int +pthread_sigmask (int how, const sigset_t *set, sigset_t *oset) +{ + if (sigprocmask (how, set, oset) == -1) + return EINVAL; + return 0; +} + +int setpgrp (int pid, int gid) { return 0; 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) #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 @@ update_wm_hints (EmacsFrame ew) #if 0 static void -create_frame_gcs (ew) - EmacsFrame ew; +create_frame_gcs (EmacsFrame ew) { struct frame *s = ew->emacs_frame.frame; diff --git a/src/xdisp.c b/src/xdisp.c index dfaa9cdeac3..a4a9e236a9e 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -2209,8 +2209,7 @@ safe_call2 (Lisp_Object fn, Lisp_Object arg1, Lisp_Object arg2) 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) { @@ -10510,7 +10509,7 @@ DEFUN ("tool-bar-lines-needed", Ftool_bar_lines_needed, Stool_bar_lines_needed, f = XFRAME (frame); if (WINDOWP (f->tool_bar_window) - || (w = XWINDOW (f->tool_bar_window), + && (w = XWINDOW (f->tool_bar_window), WINDOW_TOTAL_LINES (w) > 0)) { update_tool_bar (f, 1); 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]; /* 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) /* 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 @@ unregister_color (pixel) /* 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) 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) #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); diff --git a/src/xmenu.c b/src/xmenu.c index fc629b35104..b4338c1d653 100644 --- a/src/xmenu.c +++ b/src/xmenu.c @@ -740,10 +740,13 @@ menu_highlight_callback (GtkWidget *widget, gpointer call_data) help = call_data ? cb_data->help : Qnil; /* If popup_activated_flag is greater than 1 we are in a popup menu. - Don't show help for them, they won't appear before the - popup is popped down. */ - if (popup_activated_flag <= 1) - show_help_event (cb_data->cl_data->f, widget, help); + Don't pass the frame to show_help_event for those. + Passing frame creates an Emacs event. As we are looping in + popup_widget_loop, it won't be handeled. Passing NULL shows the tip + directly without using an Emacs event. This is what the Lucid code + does below. */ + show_help_event (popup_activated_flag <= 1 ? cb_data->cl_data->f : NULL, + widget, help); } #else static void 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; #define free_arglist(list) static List -member (elt, list) - char *elt; - List list; +member (char *elt, List list) { List p; @@ -665,20 +663,17 @@ member (elt, list) } 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 @@ main (argc, argv) printf ("\tExit.\n\n"); XCloseDisplay (display); + + return 0; } #endif /* TESTRM */ |