aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorStefan Monnier2011-03-31 00:24:03 -0400
committerStefan Monnier2011-03-31 00:24:03 -0400
commit40d83b412f584cc02e68d4eac8fd5e6eb769e2fe (patch)
treeb56f27a7e6d75a8c1fd27b00179a27b5efea0a32 /src
parentf488fb6528738131ef41859e1f04125f2e50efce (diff)
parent44f230aa043ebb222aa0876b44d70484d5dd38db (diff)
downloademacs-40d83b412f584cc02e68d4eac8fd5e6eb769e2fe.tar.gz
emacs-40d83b412f584cc02e68d4eac8fd5e6eb769e2fe.zip
Merge from trunk
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog.trunk496
-rw-r--r--src/alloc.c47
-rw-r--r--src/atimer.c51
-rw-r--r--src/buffer.c7
-rw-r--r--src/bytecode.c27
-rw-r--r--src/callint.c8
-rw-r--r--src/callproc.c88
-rw-r--r--src/character.c17
-rw-r--r--src/character.h70
-rw-r--r--src/charset.c7
-rw-r--r--src/chartab.c6
-rw-r--r--src/cm.c16
-rw-r--r--src/cm.h2
-rw-r--r--src/cmds.c4
-rw-r--r--src/coding.c28
-rw-r--r--src/composite.c34
-rw-r--r--src/data.c33
-rw-r--r--src/dbusbind.c51
-rw-r--r--src/deps.mk4
-rw-r--r--src/dispextern.h4
-rw-r--r--src/dispnew.c33
-rw-r--r--src/editfns.c69
-rw-r--r--src/emacs.c26
-rw-r--r--src/eval.c236
-rw-r--r--src/fileio.c23
-rw-r--r--src/floatfns.c6
-rw-r--r--src/fns.c63
-rw-r--r--src/font.c4
-rw-r--r--src/frame.c11
-rw-r--r--src/ftfont.c49
-rw-r--r--src/gtkutil.c2
-rw-r--r--src/image.c7
-rw-r--r--src/insdel.c80
-rw-r--r--src/intervals.c3
-rw-r--r--src/intervals.h10
-rw-r--r--src/keyboard.c314
-rw-r--r--src/keyboard.h10
-rw-r--r--src/keymap.c15
-rw-r--r--src/lisp.h31
-rw-r--r--src/menu.c3
-rw-r--r--src/minibuf.c12
-rw-r--r--src/nsmenu.m3
-rw-r--r--src/nsterm.m131
-rw-r--r--src/print.c131
-rw-r--r--src/process.c102
-rw-r--r--src/region-cache.c25
-rw-r--r--src/region-cache.h2
-rw-r--r--src/s/template.h9
-rw-r--r--src/s/usg5-4-common.h3
-rw-r--r--src/scroll.c15
-rw-r--r--src/search.c35
-rw-r--r--src/sound.c10
-rw-r--r--src/syntax.c6
-rw-r--r--src/sysdep.c10
-rw-r--r--src/syssignal.h2
-rw-r--r--src/term.c28
-rw-r--r--src/terminfo.c23
-rw-r--r--src/textprop.c32
-rw-r--r--src/tparam.h4
-rw-r--r--src/unexelf.c4
-rw-r--r--src/unexw32.c1
-rw-r--r--src/w32.c245
-rw-r--r--src/w32fns.c13
-rw-r--r--src/w32font.c10
-rw-r--r--src/w32inevt.c1
-rw-r--r--src/w32menu.c5
-rw-r--r--src/w32term.c16
-rw-r--r--src/w32uniscribe.c11
-rw-r--r--src/window.c44
-rw-r--r--src/xdisp.c141
-rw-r--r--src/xfont.c2
-rw-r--r--src/xftfont.c16
-rw-r--r--src/xmenu.c8
-rw-r--r--src/xml.c3
-rw-r--r--src/xselect.c10
-rw-r--r--src/xterm.c20
76 files changed, 1830 insertions, 1298 deletions
diff --git a/src/ChangeLog.trunk b/src/ChangeLog.trunk
index 6fa2d821565..a6623803a6e 100644
--- a/src/ChangeLog.trunk
+++ b/src/ChangeLog.trunk
@@ -1,3 +1,431 @@
12011-03-30 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * eval.c (struct backtrace): Don't cheat with negative numbers, but do
4 steal a few bits to be more compact.
5 (interactive_p, Fbacktrace, Fbacktrace_frame, mark_backtrace):
6 Remove unneeded casts.
7
8 * bytecode.c (Fbyte_code): CAR and CDR can GC.
9
102011-03-30 Zachary Kanfer <zkanfer@gmail.com> (tiny change)
11
12 * keyboard.c (Fexecute_extended_command): Do log the "suggest key
13 binding" message (bug#7967).
14
152011-03-30 Paul Eggert <eggert@cs.ucla.edu>
16
17 Fix more problems found by GCC 4.6.0's static checks.
18
19 * unexelf.c (unexec) [! (defined _SYSTYPE_SYSV || defined __sgi)]:
20 Remove unused local var.
21
22 * editfns.c (Fmessage_box): Remove unused local var.
23
24 * xdisp.c (try_window_reusing_current_matrix, x_produce_glyphs):
25 (note_mode_line_or_margin_highlight, note_mouse_highlight):
26 Omit unused local vars.
27 * window.c (shrink_windows): Omit unused local var.
28 * menu.c (digest_single_submenu): Omit unused local var.
29 * dispnew.c (update_window) [PERIODIC_PREEMPTION_CHECKING]:
30 Omit unused local var.
31
32 * keyboard.c (parse_modifiers_uncached, parse_modifiers):
33 Don't assume string length fits in int.
34 (keyremap_step, read_key_sequence): Use size_t for sizes.
35 (read_key_sequence): Don't check last_real_key_start redundantly.
36
37 * callproc.c (Fcall_process, Fcall_process_region): Use SAFE_ALLOCA
38 instead of alloca (Bug#8344).
39
40 * eval.c (Fbacktrace): Don't assume nargs fits in int.
41 (Fbacktrace_frame): Don't assume nframes fits in int.
42
43 * syntax.c (scan_sexps_forward): Avoid pointer wraparound.
44
45 * xterm.c (x_make_frame_visible, same_x_server): Redo to avoid overflow
46 concerns.
47
48 * term.c (produce_glyphless_glyph): Remove unnecessary test.
49
50 * cm.c (calccost): Turn while-do into do-while, for clarity.
51
52 * keyboard.c (syms_of_keyboard): Use the same style as later
53 in this function when indexing through an array. This also
54 works around GCC bug 48267.
55
56 * image.c (tiff_load): Fix off-by-one image count (Bug#8336).
57
58 * xselect.c (x_check_property_data): Return correct size (Bug#8335).
59
60 * chartab.c (sub_char_table_ref_and_range): Redo for slight
61 efficiency gain, and to bypass a gcc -Wstrict-overflow warning.
62
63 * keyboard.c, keyboard.h (num_input_events): Now size_t.
64 This avoids undefined behavior on integer overflow, and is a bit
65 more convenient anyway since it is compared to a size_t variable.
66
67 Variadic C functions now count arguments with size_t, not int.
68 This avoids an unnecessary limitation on 64-bit machines, which
69 caused (substring ...) to crash on large vectors (Bug#8344).
70 * lisp.h (struct Lisp_Subr.function.aMANY): Now takes size_t, not int.
71 (DEFUN_ARGS_MANY, internal_condition_case_n, safe_call): Likewise.
72 All variadic functions and their callers changed accordingly.
73 (struct gcpro.nvars): Now size_t, not int. All uses changed.
74 * data.c (arith_driver, float_arith_driver): Likewise.
75 * editfns.c (general_insert_function): Likewise.
76 * eval.c (struct backtrace.nargs, interactive_p)
77 (internal_condition_case_n, run_hook_with_args, apply_lambda)
78 (funcall_lambda, mark_backtrace): Likewise.
79 * fns.c (concat): Likewise.
80 * frame.c (x_set_frame_parameters): Likewise.
81 * fns.c (get_key_arg): Now accepts and returns size_t, and returns
82 0 if not found, not -1. All callers changed.
83
84 * alloc.c (garbage_collect): Don't assume stack size fits in int.
85 (stack_copy_size): Now size_t, not int.
86 (stack_copy, stack_copy_size): Define only if MAX_SAVE_STACK > 0.
87
882011-03-28 Juanma Barranquero <lekktu@gmail.com>
89
90 * coding.c (encode_designation_at_bol): Remove parameter `charbuf_end',
91 unused since 2002-03-01T01:17:24Z!handa@m17n.org and 2008-02-01T16:01:31Z!miles@gnu.org.
92 All callers changed.
93
94 * lisp.h (multibyte_char_to_unibyte):
95 * character.c (multibyte_char_to_unibyte): Remove parameter `rev_tbl',
96 unused since 2002-03-01T01:16:34Z!handa@m17n.org and 2008-02-01T16:01:31Z!miles@gnu.org.
97 * character.h (CHAR_TO_BYTE8):
98 * cmds.c (internal_self_insert):
99 * editfns.c (general_insert_function):
100 * keymap.c (push_key_description):
101 * search.c (Freplace_match):
102 * xdisp.c (message_dolog, set_message_1): All callers changed.
103
1042011-03-28 Stefan Monnier <monnier@iro.umontreal.ca>
105
106 * keyboard.c (safe_run_hook_funcall): New function.
107 (safe_run_hooks_1, safe_run_hooks_error, safe_run_hooks): On error,
108 don't set the hook to nil, but remove the offending function instead.
109 (Qcommand_hook_internal): Remove, unused.
110 (syms_of_keyboard): Don't initialize Qcommand_hook_internal nor define
111 Vcommand_hook_internal.
112
113 * eval.c (enum run_hooks_condition): Remove.
114 (funcall_nil, funcall_not): New functions.
115 (run_hook_with_args): Call each function through a `funcall' argument.
116 Remove `cond' argument, now redundant.
117 (Frun_hooks, Frun_hook_with_args, Frun_hook_with_args_until_success)
118 (Frun_hook_with_args_until_failure): Adjust accordingly.
119 (run_hook_wrapped_funcall, Frun_hook_wrapped): New functions.
120
1212011-03-28 Juanma Barranquero <lekktu@gmail.com>
122
123 * dispextern.h (string_buffer_position): Remove declaration.
124
125 * print.c (strout): Remove parameter `multibyte', unused since
126 1999-08-21T19:30:21Z!gerd@gnu.org. All callers changed.
127
128 * search.c (boyer_moore): Remove parameters `len', `pos' and `lim',
129 never used since function introduction in 1998-02-08T21:33:56Z!rms@gnu.org.
130 All callers changed.
131
132 * w32.c (_wsa_errlist): Use braces for struct initializers.
133
134 * xdisp.c (string_buffer_position_lim): Remove parameter `w',
135 never used since function introduction in 2001-03-09T18:41:50Z!gerd@gnu.org.
136 All callers changed.
137 (string_buffer_position): Likewise. Also, make static (it's never
138 used outside xdisp.c).
139 (cursor_row_p): Remove parameter `w', unused since
140 2000-10-17T16:08:57Z!gerd@gnu.org. All callers changed.
141 (decode_mode_spec): Remove parameter `precision', introduced during
142 Gerd Moellmann's rewrite at 1999-07-21T21:43:52Z!gerd@gnu.org, but never used.
143 All callers changed.
144
1452011-03-27 Jan Djärv <jan.h.d@swipnet.se>
146
147 * nsterm.m (syms_of_nsterm): Use doc: for ns-auto-hide-menu-bar.
148
1492011-03-27 Anders Lindgren <andlind@gmail.com>
150
151 * nsterm.m (ns_menu_bar_is_hidden): New variable.
152 (ns_constrain_all_frames, ns_menu_bar_should_be_hidden)
153 (ns_update_auto_hide_menu_bar): New functions.
154 (ns_update_begin): Call ns_update_auto_hide_menu_bar.
155 (applicationDidBecomeActive): Call ns_update_auto_hide_menu_bar and
156 ns_constrain_all_frames.
157 (constrainFrameRect): Return at once if ns_menu_bar_should_be_hidden.
158 (syms_of_nsterm): DEFVAR ns-auto-hide-menu-bar, init to Qnil.
159
1602011-03-27 Jan Djärv <jan.h.d@swipnet.se>
161
162 * nsmenu.m (runDialogAt): Remove argument to timer_check.
163
1642011-03-27 Glenn Morris <rgm@gnu.org>
165
166 * syssignal.h: Replace RETSIGTYPE with void.
167 * atimer.c, data.c, dispnew.c, emacs.c, floatfns.c, keyboard.c:
168 * keyboard.h, lisp.h, process.c, sysdep.c, xterm.c:
169 Replace SIGTYPE with void everywhere.
170 * s/usg5-4-common.h (SIGTYPE): Remove definition.
171 * s/template.h (SIGTYPE): Remove commented out definition.
172
1732011-03-26 Eli Zaretskii <eliz@gnu.org>
174
175 * xdisp.c (redisplay_window): Don't check buffer's clip_changed
176 flag as a prerequisite for invoking try_scrolling. (Bug#6671)
177
1782011-03-26 Juanma Barranquero <lekktu@gmail.com>
179
180 * w32.c (read_unc_volume): Use parameter `henum', instead of
181 global variable `wget_enum_handle'.
182
183 * keymap.c (describe_vector): Remove parameters `indices' and
184 `char_table_depth', unused since 2002-03-01T01:43:26Z!handa@m17n.org.
185 (describe_map, Fdescribe_vector): Adjust calls to `describe_vector'.
186
187 * keyboard.h (timer_check, show_help_echo): Remove unused parameters.
188
189 * keyboard.c (timer_check): Remove parameter `do_it_now',
190 unused since 1996-04-12T06:01:29Z!rms@gnu.org.
191 (show_help_echo): Remove parameter `ok_to_overwrite_keystroke_echo',
192 unused since 2008-04-19T19:30:53Z!monnier@iro.umontreal.ca.
193
194 * keyboard.c (read_char):
195 * w32menu.c (w32_menu_display_help):
196 * xmenu.c (show_help_event, menu_help_callback):
197 Adjust calls to `show_help_echo'.
198
199 * gtkutil.c (xg_maybe_add_timer):
200 * keyboard.c (readable_events):
201 * process.c (wait_reading_process_output):
202 * xmenu.c (x_menu_wait_for_event): Adjust calls to `timer_check'.
203
204 * insdel.c (adjust_markers_gap_motion):
205 Remove; no-op since 1998-01-02T21:29:48Z!rms@gnu.org.
206 (gap_left, gap_right): Don't call it.
207
2082011-03-25 Chong Yidong <cyd@stupidchicken.com>
209
210 * xdisp.c (handle_fontified_prop): Discard changes to clip_changed
211 incurred during fontification.
212
2132011-03-25 Juanma Barranquero <lekktu@gmail.com>
214
215 * buffer.c (defvar_per_buffer): Remove unused parameter `doc'.
216 (DEFVAR_PER_BUFFER): Don't pass it.
217
218 * dispnew.c (row_equal_p, add_row_entry): Remove unused parameter `w'.
219 (scrolling_window): Don't pass it.
220
2212011-03-25 Juanma Barranquero <lekktu@gmail.com>
222
223 * dispextern.h (glyph_matric): Use #if GLYPH_DEBUG, not #ifdef.
224
225 * fileio.c (check_executable) [DOS_NT]: Remove unused variables `len'
226 and `suffix'.
227 (Fset_file_selinux_context) [HAVE_LIBSELINUX]: Move here declaration
228 of variables specific to SELinux and computation of `encoded_absname'.
229
230 * image.c (XPutPixel): Remove unused variable `height'.
231
232 * keyboard.c (make_lispy_event): Remove unused variable `hpos'.
233
234 * unexw32.c (get_section_info): Remove unused variable `section'.
235
236 * w32.c (stat): Remove unused variables `drive_root' and `devtype'.
237 (system_process_attributes): Remove unused variable `sess'.
238 (sys_read): Remove unused variable `err'.
239
240 * w32fns.c (top): Wrap variables with #if GLYPH_DEBUG, not #ifdef.
241 (w32_wnd_proc): Remove unused variable `isdead'.
242 (unwind_create_frame): Use #if GLYPH_DEBUG, not #ifdef.
243 (Fx_server_max_request_size): Remove unused variable `dpyinfo'.
244 (x_create_tip_frame): Remove unused variable `tem'.
245
246 * w32inevt.c (w32_console_read_socket):
247 Remove unused variable `no_events'.
248
249 * w32term.c (x_draw_composite_glyph_string_foreground):
250 Remove unused variable `width'.
251
2522011-03-24 Juanma Barranquero <lekktu@gmail.com>
253
254 * w32term.c (x_set_glyph_string_clipping):
255 Don't pass uninitialized region to CombineRgn.
256
2572011-03-23 Juanma Barranquero <lekktu@gmail.com>
258
259 * w32fns.c (x_set_menu_bar_lines): Remove unused variable `olines'.
260 (w32_wnd_proc): Pass NULL to Windows API, not uninitialized buffer.
261 (Fx_close_connection): Remove unused variable `i'.
262
263 * w32font.c (w32font_draw): Return number of glyphs.
264 (w32font_open_internal): Remove unused variable `i'.
265 (w32font_driver): Add missing initializer.
266
267 * w32menu.c (utf8to16): Remove unused variable `utf16'.
268 (fill_in_menu): Remove unused variable `items_added'.
269
270 * w32term.c (last_mouse_press_frame): Remove static global variable.
271 (w32_clip_to_row): Remove unused variable `f'.
272 (x_delete_terminal): Remove unused variable `i'.
273
274 * w32uniscribe.c (uniscribe_shape): Remove unused variable `nclusters'.
275 (NOTHING): Remove unused static global variable.
276 (uniscribe_check_otf): Remove unused variable `table'.
277 (uniscribe_font_driver): Add missing initializers.
278
2792011-03-23 Julien Danjou <julien@danjou.info>
280
281 * term.c (Fsuspend_tty, Fresume_tty):
282 * minibuf.c (read_minibuf, run_exit_minibuf_hook):
283 * window.c (temp_output_buffer_show):
284 * insdel.c (signal_before_change):
285 * frame.c (Fhandle_switch_frame):
286 * fileio.c (Fdo_auto_save):
287 * emacs.c (Fkill_emacs):
288 * editfns.c (save_excursion_restore):
289 * cmds.c (internal_self_insert):
290 * callint.c (Fcall_interactively):
291 * buffer.c (Fkill_all_local_variables):
292 * keyboard.c (Fcommand_execute, Fsuspend_emacs, safe_run_hooks_1):
293 Use Frun_hooks.
294 (command_loop_1): Use Frun_hooks. Call safe_run_hooks
295 unconditionnaly since it does the check itself.
296
2972011-03-23 Paul Eggert <eggert@cs.ucla.edu>
298
299 Fix more problems found by GCC 4.5.2's static checks.
300
301 * coding.c (encode_coding_raw_text): Avoid unnecessary test
302 the first time through the loop, since we know p0 < p1 then.
303 This also avoids a gcc -Wstrict-overflow warning.
304
305 * lisp.h (SAFE_ALLOCA, SAFE_ALLOCA_LISP): Avoid 'int' overflow
306 leading to a memory leak, possible in functions like
307 load_charset_map_from_file that can allocate an unbounded number
308 of objects (Bug#8318).
309
310 * xmenu.c (set_frame_menubar): Use EMACS_UINT, not int, for indexes
311 that could (at least in theory) be that large.
312
313 * xdisp.c (message_log_check_duplicate): Return unsigned long, not int.
314 This is less likely to overflow, and avoids undefined behavior if
315 overflow does occur. All callers changed. Use strtoul to scan
316 for the unsigned long integer.
317 (pint2hrstr): Simplify and tune code slightly.
318 This also avoids a (bogus) GCC warning with gcc -Wstrict-overflow.
319
320 * scroll.c (do_scrolling): Work around GCC bug 48228.
321 See <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48228>.
322
323 * frame.c (Fmodify_frame_parameters): Simplify loop counter.
324 This also avoids a warning with gcc -Wstrict-overflow.
325 (validate_x_resource_name): Simplify count usage.
326 This also avoids a warning with gcc -Wstrict-overflow.
327
328 * fileio.c (Fcopy_file): Report error if fchown or fchmod
329 fail (Bug#8306).
330
331 * emacs.c (Fdaemon_initialized): Do not ignore I/O errors (Bug#8303).
332
333 * process.c (Fmake_network_process): Use socklen_t, not int,
334 where POSIX says socklen_t is required in portable programs.
335 This fixes a porting bug on hosts like 64-bit HP-UX, where
336 socklen_t is wider than int (Bug#8277).
337 (Fmake_network_process, server_accept_connection):
338 (wait_reading_process_output, read_process_output):
339 Likewise.
340
341 * process.c: Rename or move locals to avoid shadowing.
342 (list_processes_1, Fmake_network_process):
343 (read_process_output_error_handler, exec_sentinel_error_handler):
344 Rename or move locals.
345 (Fmake_network_process): Define label "retry_connect" only if needed.
346 (Fnetwork_interface_info): Fix pointer signedness.
347 (process_send_signal): Add cast to avoid pointer signedness problem.
348 (FIRST_PROC_DESC, IF_NON_BLOCKING_CONNECT): Remove unused macros.
349 (create_process): Use 'volatile' to avoid vfork clobbering (Bug#8298).
350
351 Make tparam.h and terminfo.c consistent.
352 * cm.c (tputs, tgoto, BC, UP): Remove extern decls.
353 Include tparam.h instead, since it declares them.
354 * cm.h (PC): Remove extern decl; tparam.h now does this.
355 * deps.mk (cm.o, terminfo.o): Depend on tparam.h.
356 * terminfo.c: Include tparam.h, to check interfaces.
357 (tparm): Make 1st arg a const pointer in decl. Put it at top level.
358 (tparam): Adjust signature to match interface in tparam.h;
359 this removes some undefined behavior. Check that outstring and len
360 are zero, which they always are with Emacs.
361 * tparam.h (PC, BC, UP): New extern decls.
362
363 * xftfont.c (xftfont_shape): Now static, and defined only if needed.
364 (xftfont_open): Rename locals to avoid shadowing.
365
366 * ftfont.c (ftfont_resolve_generic_family): Fix pointer signedness.
367 (ftfont_otf_capability, ftfont_shape): Omit decls if not needed.
368 (OTF_TAG_SYM): Omit macro if not needed.
369 (ftfont_list): Remove unused local.
370 (get_adstyle_property, ftfont_pattern_entity):
371 (ftfont_lookup_cache, ftfont_open, ftfont_anchor_point):
372 Rename locals to avoid shadowing.
373
374 * xfont.c (xfont_list_family): Mark var as initialized.
375
376 * xml.c (make_dom): Now static.
377
378 * composite.c (composition_compute_stop_pos): Rename local to
379 avoid shadowing.
380 (composition_reseat_it): Remove unused locals.
381 (find_automatic_composition, composition_adjust_point): Likewise.
382 (composition_update_it): Mark var as initialized.
383 (find_automatic_composition): Mark vars as initialized,
384 with a FIXME (Bug#8290).
385
386 character.h: Rename locals to avoid shadowing.
387 * character.h (PREV_CHAR_BOUNDARY, FETCH_STRING_CHAR_ADVANCE):
388 (FETCH_STRING_CHAR_AS_MULTIBYTE_ADVANCE, FETCH_CHAR_ADVANCE):
389 (FETCH_CHAR_ADVANCE_NO_CHECK, INC_POS, DEC_POS, BUF_INC_POS):
390 (BUF_DEC_POS): Be more systematic about renaming local temporaries
391 to avoid shadowing.
392
393 * textprop.c (property_change_between_p): Remove; unused.
394
395 * intervals.c (interval_start_pos): Now static.
396
397 * intervals.h (CHECK_TOTAL_LENGTH): Avoid empty "else".
398
399 * atimer.c (start_atimer, append_atimer_lists, set_alarm):
400 Rename locals to avoid shadowing.
401
402 * sound.c (wav_play, au_play, Fplay_sound_internal):
403 Fix pointer signedness.
404 (alsa_choose_format): Remove unused local var.
405 (wav_play): Initialize a variable to 0, to prevent undefined
406 behavior (Bug#8278).
407
408 * region-cache.c (insert_cache_boundary): Redo var to avoid shadowing.
409
410 * region-cache.h (pp_cache): New decl, for gcc -Wmissing-prototypes.
411
412 * callproc.c (Fcall_process): Use 'volatile' to avoid vfork
413 clobbering (Bug#8298).
414 * sysdep.c (sys_subshell): Likewise.
415 Previously, the sys_subshell 'volatile' was incorrectly IF_LINTted out.
416
417 * lisp.h (child_setup): Now NO_RETURN unless DOS_NT.
418 This should get cleaned up, so that child_setup has the
419 same signature on all platforms.
420
421 * callproc.c (call_process_cleanup): Now static.
422 (relocate_fd): Rename locals to avoid shadowing.
423
4242011-03-22 Chong Yidong <cyd@stupidchicken.com>
425
426 * xterm.c (x_clear_frame): Remove XClearWindow call. This appears
427 not to be necessary, and produces flickering.
428
12011-03-20 Glenn Morris <rgm@gnu.org> 4292011-03-20 Glenn Morris <rgm@gnu.org>
2 430
3 * config.in: Remove file. 431 * config.in: Remove file.
@@ -138,8 +566,8 @@
138 gcc -Wbad-function-cast warning. 566 gcc -Wbad-function-cast warning.
139 (default_value, arithcompare, arith_driver, arith_error): Now static. 567 (default_value, arithcompare, arith_driver, arith_error): Now static.
140 (store_symval_forwarding): Rename local to avoid shadowing. 568 (store_symval_forwarding): Rename local to avoid shadowing.
141 (Fmake_variable_buffer_local, Fmake_local_variable): Mark 569 (Fmake_variable_buffer_local, Fmake_local_variable):
142 variables as initialized. 570 Mark variables as initialized.
143 (do_blv_forwarding, do_symval_forwarding): Remove; unused. 571 (do_blv_forwarding, do_symval_forwarding): Remove; unused.
144 572
145 * alloc.c (check_cons_list): Do not define unless GC_CHECK_CONS_LIST. 573 * alloc.c (check_cons_list): Do not define unless GC_CHECK_CONS_LIST.
@@ -393,8 +821,8 @@
393 (BUF_PT_BYTE): Rewrite to handle indirect buffers (Bug#8219). 821 (BUF_PT_BYTE): Rewrite to handle indirect buffers (Bug#8219).
394 These macros can no longer be used for assignment. 822 These macros can no longer be used for assignment.
395 823
396 * buffer.c (Fget_buffer_create, Fmake_indirect_buffer): Assign 824 * buffer.c (Fget_buffer_create, Fmake_indirect_buffer):
397 struct members directly, instead of using BUF_BEGV etc. 825 Assign struct members directly, instead of using BUF_BEGV etc.
398 (record_buffer_markers, fetch_buffer_markers): New functions for 826 (record_buffer_markers, fetch_buffer_markers): New functions for
399 recording and fetching special buffer markers. 827 recording and fetching special buffer markers.
400 (set_buffer_internal_1, set_buffer_temp): Use them. 828 (set_buffer_internal_1, set_buffer_temp): Use them.
@@ -515,8 +943,8 @@
515 * term.c (encode_terminal_code): Now external again, used by 943 * term.c (encode_terminal_code): Now external again, used by
516 w32console.c and msdos.c. 944 w32console.c and msdos.c.
517 945
518 * makefile.w32-in ($(BLD)/term.$(O), ($(BLD)/tparam.$(O)): Depend 946 * makefile.w32-in ($(BLD)/term.$(O), ($(BLD)/tparam.$(O)):
519 on $(SRC)/tparam.h, see 2011-03-11T07:24:21Z!eggert@cs.ucla.edu. 947 Depend on $(SRC)/tparam.h, see 2011-03-11T07:24:21Z!eggert@cs.ucla.edu.
520 948
5212011-03-11 Paul Eggert <eggert@cs.ucla.edu> 9492011-03-11 Paul Eggert <eggert@cs.ucla.edu>
522 950
@@ -580,8 +1008,8 @@
580 (x_delete_glyphs, x_ins_del_lines): Mark with NO_RETURN. 1008 (x_delete_glyphs, x_ins_del_lines): Mark with NO_RETURN.
581 (x_connection_closed): Tell GCC not to suggest NO_RETURN. 1009 (x_connection_closed): Tell GCC not to suggest NO_RETURN.
582 1010
583 * xfaces.c (clear_face_cache, Fx_list_fonts, Fface_font): Rename 1011 * xfaces.c (clear_face_cache, Fx_list_fonts, Fface_font):
584 or move locals to avoid shadowing. 1012 Rename or move locals to avoid shadowing.
585 (tty_defined_color, merge_face_heights): Now static. 1013 (tty_defined_color, merge_face_heights): Now static.
586 (free_realized_faces_for_fontset): Remove; not used. 1014 (free_realized_faces_for_fontset): Remove; not used.
587 (Fx_list_fonts): Mark variable that gcc -Wuninitialized 1015 (Fx_list_fonts): Mark variable that gcc -Wuninitialized
@@ -739,12 +1167,12 @@
739 (xg_prepare_tooltip, xg_hide_tooltip): Call gdk_window_get_screen. 1167 (xg_prepare_tooltip, xg_hide_tooltip): Call gdk_window_get_screen.
740 (xg_prepare_tooltip, create_dialog, menubar_map_cb) 1168 (xg_prepare_tooltip, create_dialog, menubar_map_cb)
741 (xg_update_frame_menubar, xg_tool_bar_detach_callback) 1169 (xg_update_frame_menubar, xg_tool_bar_detach_callback)
742 (xg_tool_bar_attach_callback, xg_update_tool_bar_sizes): Call 1170 (xg_tool_bar_attach_callback, xg_update_tool_bar_sizes):
743 gtk_widget_get_preferred_size. 1171 Call gtk_widget_get_preferred_size.
744 (xg_frame_resized): gdk_window_get_geometry only takes 5 1172 (xg_frame_resized): gdk_window_get_geometry only takes 5
745 parameters. 1173 parameters.
746 (xg_win_to_widget, xg_event_is_for_menubar): Call 1174 (xg_win_to_widget, xg_event_is_for_menubar):
747 gdk_x11_window_lookup_for_display. 1175 Call gdk_x11_window_lookup_for_display.
748 (xg_set_widget_bg): New function. 1176 (xg_set_widget_bg): New function.
749 (delete_cb): New function. 1177 (delete_cb): New function.
750 (xg_create_frame_widgets): connect delete-event to delete_cb. 1178 (xg_create_frame_widgets): connect delete-event to delete_cb.
@@ -840,7 +1268,7 @@
840 (produce_glyphless_glyph): Make a pointer "const" 1268 (produce_glyphless_glyph): Make a pointer "const"
841 since it might point to immutable storage. 1269 since it might point to immutable storage.
842 (update_window_cursor): Now static, since it's not used elsewhere. 1270 (update_window_cursor): Now static, since it's not used elsewhere.
843 (SKIP_GLYPHS): Removed unused macro. 1271 (SKIP_GLYPHS): Remove unused macro.
844 1272
8452011-03-06 Michael Shields <shields@msrl.com> (tiny change) 12732011-03-06 Michael Shields <shields@msrl.com> (tiny change)
846 1274
@@ -7337,7 +7765,7 @@
7337 * xterm.c (x_send_scroll_bar_event, SET_SAVED_MENU_EVENT) 7765 * xterm.c (x_send_scroll_bar_event, SET_SAVED_MENU_EVENT)
7338 (handle_one_xevent, x_check_errors, xim_initialize, x_term_init): 7766 (handle_one_xevent, x_check_errors, xim_initialize, x_term_init):
7339 Likewise. 7767 Likewise.
7340 * character.h (BCOPY_SHORT): Removed. 7768 * character.h (BCOPY_SHORT): Remove.
7341 * config.in: Regenerate. 7769 * config.in: Regenerate.
7342 * dispnew.c (safe_bcopy): Only define as dummy if PROFILING. 7770 * dispnew.c (safe_bcopy): Only define as dummy if PROFILING.
7343 * emacs.c (main) [PROFILING]: Don't declare 7771 * emacs.c (main) [PROFILING]: Don't declare
@@ -10342,8 +10770,8 @@
10342 (POSIX_SIGNALS): Do not define. 10770 (POSIX_SIGNALS): Do not define.
10343 10771
10344 Remove support for old UNIX System V systems. 10772 Remove support for old UNIX System V systems.
10345 * s/unixware.h: Add the contents of s/usg-5-4-2.h. 10773 * s/unixware.h: Add the contents of s/usg5-4-2.h.
10346 * s/usg-5-4-2.h: Remove. 10774 * s/usg5-4-2.h: Remove.
10347 10775
10348 Remove support for Solaris on PPC and for old versions. 10776 Remove support for Solaris on PPC and for old versions.
10349 * s/sol2-6.h: Add the contents of s/sol-2.3.h, s/sol-2.4.h, s/sol-2.5.h. 10777 * s/sol2-6.h: Add the contents of s/sol-2.3.h, s/sol-2.4.h, s/sol-2.5.h.
@@ -19126,7 +19554,7 @@
19126 Set xftfont_info->ft_size. Don't unlock the face. Check BDF 19554 Set xftfont_info->ft_size. Don't unlock the face. Check BDF
19127 properties if appropriate. 19555 properties if appropriate.
19128 (xftfont_close): Unlock the face. 19556 (xftfont_close): Unlock the face.
19129 (xftfont_anchor_point, xftfont_shape): Deleted. 19557 (xftfont_anchor_point, xftfont_shape): Delete.
19130 (syms_of_xftfont): Don't set members anchor_point and shape of 19558 (syms_of_xftfont): Don't set members anchor_point and shape of
19131 xftfont_driver. 19559 xftfont_driver.
19132 19560
@@ -21031,7 +21459,7 @@
21031 Delete externs. 21459 Delete externs.
21032 (fontset_from_font_name): Extern it. 21460 (fontset_from_font_name): Extern it.
21033 (FS_LOAD_FONT, FONT_INFO_ID, FONT_INFO_FROM_ID) 21461 (FS_LOAD_FONT, FONT_INFO_ID, FONT_INFO_FROM_ID)
21034 (FONT_INFO_FROM_FACE): Deleted. 21462 (FONT_INFO_FROM_FACE): Delete.
21035 (face_for_font): Adjust prototype. 21463 (face_for_font): Adjust prototype.
21036 21464
21037 * fontset.c: Throughout the file, delete all USE_FONT_BACKEND 21465 * fontset.c: Throughout the file, delete all USE_FONT_BACKEND
@@ -21048,7 +21476,7 @@
21048 (fontset_compare_rfontdef): New function. 21476 (fontset_compare_rfontdef): New function.
21049 (reorder_font_vector): Remove the argument CHARSET-ID. Sort 21477 (reorder_font_vector): Remove the argument CHARSET-ID. Sort
21050 rfont-defs by qsort. Adjusted for the change of font-group vector. 21478 rfont-defs by qsort. Adjusted for the change of font-group vector.
21051 (load_font_get_repertory): Deleted. 21479 (load_font_get_repertory): Delete.
21052 (fontset_find_font): Use new macros to ref/set elements of 21480 (fontset_find_font): Use new macros to ref/set elements of
21053 font-def and rfont-def. 21481 font-def and rfont-def.
21054 (fontset_font): Fix the timing of remembering that no font for C. 21482 (fontset_font): Fix the timing of remembering that no font for C.
@@ -21064,11 +21492,11 @@
21064 font-def. 21492 font-def.
21065 (Fnew_fontset): Use font_unparse_xlfd to generate 21493 (Fnew_fontset): Use font_unparse_xlfd to generate
21066 FONTSET_ASCII (fontset). 21494 FONTSET_ASCII (fontset).
21067 (new_fontset_from_font_name): Deleted. 21495 (new_fontset_from_font_name): Delete.
21068 (fontset_from_font): Rename from new_fontset_from_font. Check if 21496 (fontset_from_font): Rename from new_fontset_from_font. Check if
21069 a fontset is already created for the font. FIx updating of 21497 a fontset is already created for the font. FIx updating of
21070 Vfontset_alias_alist. 21498 Vfontset_alias_alist.
21071 (fontset_ascii_font): Deleted. 21499 (fontset_ascii_font): Delete.
21072 (Ffont_info): Adjust for the format change of font-spec. 21500 (Ffont_info): Adjust for the format change of font-spec.
21073 (Finternal_char_font): Likewise. 21501 (Finternal_char_font): Likewise.
21074 (Ffontset_info): Likewise. 21502 (Ffontset_info): Likewise.
@@ -21096,7 +21524,7 @@
21096 (ftfont_list): Return a list, not vector. 21524 (ftfont_list): Return a list, not vector.
21097 (ftfont_match): Use ftfont_spec_pattern to get a pattern. 21525 (ftfont_match): Use ftfont_spec_pattern to get a pattern.
21098 (ftfont_list_family): Don't downcase names. 21526 (ftfont_list_family): Don't downcase names.
21099 (ftfont_free_entity): Deleted. 21527 (ftfont_free_entity): Delete.
21100 (ftfont_open): Return a font-object. Adjusted for the change of 21528 (ftfont_open): Return a font-object. Adjusted for the change of
21101 struct font. Get underline_thickness and underline_position from 21529 struct font. Get underline_thickness and underline_position from
21102 font property. Don't update dpyinfo->smallest_font_height and 21530 font property. Don't update dpyinfo->smallest_font_height and
@@ -21148,13 +21576,13 @@
21148 (QCfoundry, QCadstyle, QCregistry, QCspacing, QCsize, QCavgwidth) 21576 (QCfoundry, QCadstyle, QCregistry, QCspacing, QCsize, QCavgwidth)
21149 (Qp): Extern them. 21577 (Qp): Extern them.
21150 (clear_font_table, load_face_font, xlfd_lookup_field_contents): 21578 (clear_font_table, load_face_font, xlfd_lookup_field_contents):
21151 Deleted. 21579 Delete.
21152 (struct font_name): Deleted. 21580 (struct font_name): Delete.
21153 (xlfd_numeric_value, xlfd_symbolic_value): Deleted. 21581 (xlfd_numeric_value, xlfd_symbolic_value): Delete.
21154 (compare_fonts_by_sort_order): New function. 21582 (compare_fonts_by_sort_order): New function.
21155 (xlfd_numeric_slant, xlfd_symbolic_slant, xlfd_numeric_weight) 21583 (xlfd_numeric_slant, xlfd_symbolic_slant, xlfd_numeric_weight)
21156 (xlfd_symbolic_weight, xlfd_numeric_swidth, xlfd_symbolic_swidth): 21584 (xlfd_symbolic_weight, xlfd_numeric_swidth, xlfd_symbolic_swidth):
21157 Deleted. 21585 Delete.
21158 (Fx_family_fonts): Use font_list_entities, and sort fonts by 21586 (Fx_family_fonts): Use font_list_entities, and sort fonts by
21159 compare_fonts_by_sort_order. 21587 compare_fonts_by_sort_order.
21160 (Fx_font_family_list): Call Ffont_family_list. 21588 (Fx_font_family_list): Call Ffont_family_list.
@@ -21167,9 +21595,9 @@
21167 (free_font_names, sort_fonts, x_face_list_fonts) 21595 (free_font_names, sort_fonts, x_face_list_fonts)
21168 (face_font_available_p, sorted_font_list, cmp_font_names) 21596 (face_font_available_p, sorted_font_list, cmp_font_names)
21169 (font_list_1, concat_font_list, font_list, remove_duplicates): 21597 (font_list_1, concat_font_list, font_list, remove_duplicates):
21170 Deleted. 21598 Delete.
21171 (Fx_list_fonts): Use Ffont_list. 21599 (Fx_list_fonts): Use Ffont_list.
21172 (LFACE_AVGWIDTH): Deleted. 21600 (LFACE_AVGWIDTH): Delete.
21173 (check_lface_attrs): Don't check LFACE_AVGWIDTH. Check LFACE_FONT 21601 (check_lface_attrs): Don't check LFACE_AVGWIDTH. Check LFACE_FONT
21174 by FONTP. 21602 by FONTP.
21175 (lface_fully_specified_p): Don't check LFACE_AVGWIDTH. 21603 (lface_fully_specified_p): Don't check LFACE_AVGWIDTH.
@@ -21191,7 +21619,7 @@
21191 (Fface_font): Get a font name from font->props[FONT_NAME_INDEX]. 21619 (Fface_font): Get a font name from font->props[FONT_NAME_INDEX].
21192 (lface_same_font_attributes_p): Don't check LFACE_AVGWIDTH. 21620 (lface_same_font_attributes_p): Don't check LFACE_AVGWIDTH.
21193 Compare fonts by EQ. 21621 Compare fonts by EQ.
21194 (lookup_non_ascii_face): Deleted. 21622 (lookup_non_ascii_face): Delete.
21195 (face_for_font): The 2nd argument changed. 21623 (face_for_font): The 2nd argument changed.
21196 (x_supports_face_attributes_p): Don't check LFACE_AVGWIDTH. 21624 (x_supports_face_attributes_p): Don't check LFACE_AVGWIDTH.
21197 Check atomic font properties by case insensitive. 21625 Check atomic font properties by case insensitive.
@@ -21214,7 +21642,7 @@
21214 21642
21215 * xfont.c: Include <stdlib.h> and "ccl.h". 21643 * xfont.c: Include <stdlib.h> and "ccl.h".
21216 (struct xfont_info): New structure. 21644 (struct xfont_info): New structure.
21217 (xfont_query_font): Deleted. 21645 (xfont_query_font): Delete.
21218 (xfont_find_ccl_program): Rename from x_find_ccl_program and 21646 (xfont_find_ccl_program): Rename from x_find_ccl_program and
21219 moved from xterm.c. 21647 moved from xterm.c.
21220 (xfont_driver): Adjust for the change of struct font_driver. 21648 (xfont_driver): Adjust for the change of struct font_driver.
@@ -21230,7 +21658,7 @@
21230 dpyinfo->smallest_char_width. 21658 dpyinfo->smallest_char_width.
21231 (xfont_close): Don't free struct font. 21659 (xfont_close): Don't free struct font.
21232 (xfont_prepare_face): Adjust for the change of struct font. 21660 (xfont_prepare_face): Adjust for the change of struct font.
21233 (xfont_done_face): Deleted. 21661 (xfont_done_face): Delete.
21234 (xfont_has_char): Adjust for the change of struct font. 21662 (xfont_has_char): Adjust for the change of struct font.
21235 (xfont_encode_char, xfont_draw): Likewise. 21663 (xfont_encode_char, xfont_draw): Likewise.
21236 (xfont_check): New function. 21664 (xfont_check): New function.
@@ -21260,7 +21688,7 @@
21260 * xterm.c: Throughout the file, delete all USE_FONT_BACKEND 21688 * xterm.c: Throughout the file, delete all USE_FONT_BACKEND
21261 conditionals. Don't check enable_font_backend. Delete all codes 21689 conditionals. Don't check enable_font_backend. Delete all codes
21262 used only when USE_FONT_BACKEND is not defined. Don't include ccl.h. 21690 used only when USE_FONT_BACKEND is not defined. Don't include ccl.h.
21263 (x_per_char_metric, x_encode_char): Deleted. 21691 (x_per_char_metric, x_encode_char): Delete.
21264 (x_set_cursor_gc, x_set_mouse_face_gc): Don't set GCFont. 21692 (x_set_cursor_gc, x_set_mouse_face_gc): Don't set GCFont.
21265 (x_compute_glyph_string_overhangs): Adjust for the change of 21693 (x_compute_glyph_string_overhangs): Adjust for the change of
21266 `struct face'. 21694 `struct face'.
@@ -21269,10 +21697,10 @@
21269 (x_draw_glyph_string): Likewise. Use font->underline_position and 21697 (x_draw_glyph_string): Likewise. Use font->underline_position and
21270 font->underline_thickness. 21698 font->underline_thickness.
21271 (x_new_font): Rename from x_new_fontset2. 21699 (x_new_font): Rename from x_new_fontset2.
21272 (x_new_fontset, x_get_font_info, x_list_fonts): Deleted. 21700 (x_new_fontset, x_get_font_info, x_list_fonts): Delete.
21273 (x_check_font): Call `check' method of a font driver. 21701 (x_check_font): Call `check' method of a font driver.
21274 (x_font_min_bounds, x_compute_min_glyph_bounds, x_load_font) 21702 (x_font_min_bounds, x_compute_min_glyph_bounds, x_load_font)
21275 (x_query_font, x_get_font_repertory): Deleted. 21703 (x_query_font, x_get_font_repertory): Delete.
21276 (x_find_ccl_program): Rename and moved to xfont.c. 21704 (x_find_ccl_program): Rename and moved to xfont.c.
21277 (x_redisplay_interface): Adjust for the change of `struct 21705 (x_redisplay_interface): Adjust for the change of `struct
21278 redisplay_interface'. 21706 redisplay_interface'.
diff --git a/src/alloc.c b/src/alloc.c
index 0ca702fe0cd..07f1caae46b 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -254,8 +254,10 @@ const char *pending_malloc_warning;
254 254
255/* Buffer in which we save a copy of the C stack at each GC. */ 255/* Buffer in which we save a copy of the C stack at each GC. */
256 256
257#if MAX_SAVE_STACK > 0
257static char *stack_copy; 258static char *stack_copy;
258static int stack_copy_size; 259static size_t stack_copy_size;
260#endif
259 261
260/* Non-zero means ignore malloc warnings. Set during initialization. 262/* Non-zero means ignore malloc warnings. Set during initialization.
261 Currently not used. */ 263 Currently not used. */
@@ -2705,7 +2707,7 @@ DEFUN ("list", Flist, Slist, 0, MANY, 0,
2705 doc: /* Return a newly created list with specified arguments as elements. 2707 doc: /* Return a newly created list with specified arguments as elements.
2706Any number of arguments, even zero arguments, are allowed. 2708Any number of arguments, even zero arguments, are allowed.
2707usage: (list &rest OBJECTS) */) 2709usage: (list &rest OBJECTS) */)
2708 (int nargs, register Lisp_Object *args) 2710 (size_t nargs, register Lisp_Object *args)
2709{ 2711{
2710 register Lisp_Object val; 2712 register Lisp_Object val;
2711 val = Qnil; 2713 val = Qnil;
@@ -2921,10 +2923,10 @@ DEFUN ("vector", Fvector, Svector, 0, MANY, 0,
2921 doc: /* Return a newly created vector with specified arguments as elements. 2923 doc: /* Return a newly created vector with specified arguments as elements.
2922Any number of arguments, even zero arguments, are allowed. 2924Any number of arguments, even zero arguments, are allowed.
2923usage: (vector &rest OBJECTS) */) 2925usage: (vector &rest OBJECTS) */)
2924 (register int nargs, Lisp_Object *args) 2926 (register size_t nargs, Lisp_Object *args)
2925{ 2927{
2926 register Lisp_Object len, val; 2928 register Lisp_Object len, val;
2927 register int i; 2929 register size_t i;
2928 register struct Lisp_Vector *p; 2930 register struct Lisp_Vector *p;
2929 2931
2930 XSETFASTINT (len, nargs); 2932 XSETFASTINT (len, nargs);
@@ -2952,10 +2954,10 @@ argument to catch the left-over arguments. If such an integer is used, the
2952arguments will not be dynamically bound but will be instead pushed on the 2954arguments will not be dynamically bound but will be instead pushed on the
2953stack before executing the byte-code. 2955stack before executing the byte-code.
2954usage: (make-byte-code ARGLIST BYTE-CODE CONSTANTS DEPTH &optional DOCSTRING INTERACTIVE-SPEC &rest ELEMENTS) */) 2956usage: (make-byte-code ARGLIST BYTE-CODE CONSTANTS DEPTH &optional DOCSTRING INTERACTIVE-SPEC &rest ELEMENTS) */)
2955 (register int nargs, Lisp_Object *args) 2957 (register size_t nargs, Lisp_Object *args)
2956{ 2958{
2957 register Lisp_Object len, val; 2959 register Lisp_Object len, val;
2958 register int i; 2960 register size_t i;
2959 register struct Lisp_Vector *p; 2961 register struct Lisp_Vector *p;
2960 2962
2961 XSETFASTINT (len, nargs); 2963 XSETFASTINT (len, nargs);
@@ -4238,7 +4240,7 @@ static void
4238check_gcpros (void) 4240check_gcpros (void)
4239{ 4241{
4240 struct gcpro *p; 4242 struct gcpro *p;
4241 int i; 4243 size_t i;
4242 4244
4243 for (p = gcprolist; p; p = p->next) 4245 for (p = gcprolist; p; p = p->next)
4244 for (i = 0; i < p->nvars; ++i) 4246 for (i = 0; i < p->nvars; ++i)
@@ -4847,7 +4849,7 @@ returns nil, because real GC can't be done. */)
4847{ 4849{
4848 register struct specbinding *bind; 4850 register struct specbinding *bind;
4849 char stack_top_variable; 4851 char stack_top_variable;
4850 register int i; 4852 register size_t i;
4851 int message_p; 4853 int message_p;
4852 Lisp_Object total[8]; 4854 Lisp_Object total[8];
4853 int count = SPECPDL_INDEX (); 4855 int count = SPECPDL_INDEX ();
@@ -4913,21 +4915,26 @@ returns nil, because real GC can't be done. */)
4913#if MAX_SAVE_STACK > 0 4915#if MAX_SAVE_STACK > 0
4914 if (NILP (Vpurify_flag)) 4916 if (NILP (Vpurify_flag))
4915 { 4917 {
4916 i = &stack_top_variable - stack_bottom; 4918 char *stack;
4917 if (i < 0) i = -i; 4919 size_t stack_size;
4918 if (i < MAX_SAVE_STACK) 4920 if (&stack_top_variable < stack_bottom)
4919 { 4921 {
4920 if (stack_copy == 0) 4922 stack = &stack_top_variable;
4921 stack_copy = (char *) xmalloc (stack_copy_size = i); 4923 stack_size = stack_bottom - &stack_top_variable;
4922 else if (stack_copy_size < i) 4924 }
4923 stack_copy = (char *) xrealloc (stack_copy, (stack_copy_size = i)); 4925 else
4924 if (stack_copy) 4926 {
4927 stack = stack_bottom;
4928 stack_size = &stack_top_variable - stack_bottom;
4929 }
4930 if (stack_size <= MAX_SAVE_STACK)
4931 {
4932 if (stack_copy_size < stack_size)
4925 { 4933 {
4926 if ((EMACS_INT) (&stack_top_variable - stack_bottom) > 0) 4934 stack_copy = (char *) xrealloc (stack_copy, stack_size);
4927 memcpy (stack_copy, stack_bottom, i); 4935 stack_copy_size = stack_size;
4928 else
4929 memcpy (stack_copy, &stack_top_variable, i);
4930 } 4936 }
4937 memcpy (stack_copy, stack, stack_size);
4931 } 4938 }
4932 } 4939 }
4933#endif /* MAX_SAVE_STACK > 0 */ 4940#endif /* MAX_SAVE_STACK > 0 */
diff --git a/src/atimer.c b/src/atimer.c
index 309a4eaee4f..b947ea59ccd 100644
--- a/src/atimer.c
+++ b/src/atimer.c
@@ -64,7 +64,7 @@ static void set_alarm (void);
64static void schedule_atimer (struct atimer *); 64static void schedule_atimer (struct atimer *);
65static struct atimer *append_atimer_lists (struct atimer *, 65static struct atimer *append_atimer_lists (struct atimer *,
66 struct atimer *); 66 struct atimer *);
67SIGTYPE alarm_signal_handler (int signo); 67void alarm_signal_handler (int signo);
68 68
69 69
70/* Start a new atimer of type TYPE. TIME specifies when the timer is 70/* Start a new atimer of type TYPE. TIME specifies when the timer is
@@ -86,7 +86,7 @@ SIGTYPE alarm_signal_handler (int signo);
86 to cancel_atimer; don't free it yourself. */ 86 to cancel_atimer; don't free it yourself. */
87 87
88struct atimer * 88struct atimer *
89start_atimer (enum atimer_type type, EMACS_TIME time, atimer_callback fn, 89start_atimer (enum atimer_type type, EMACS_TIME timestamp, atimer_callback fn,
90 void *client_data) 90 void *client_data)
91{ 91{
92 struct atimer *t; 92 struct atimer *t;
@@ -94,10 +94,10 @@ start_atimer (enum atimer_type type, EMACS_TIME time, atimer_callback fn,
94 /* Round TIME up to the next full second if we don't have 94 /* Round TIME up to the next full second if we don't have
95 itimers. */ 95 itimers. */
96#ifndef HAVE_SETITIMER 96#ifndef HAVE_SETITIMER
97 if (EMACS_USECS (time) != 0) 97 if (EMACS_USECS (timestamp) != 0)
98 { 98 {
99 EMACS_SET_USECS (time, 0); 99 EMACS_SET_USECS (timestamp, 0);
100 EMACS_SET_SECS (time, EMACS_SECS (time) + 1); 100 EMACS_SET_SECS (timestamp, EMACS_SECS (timestamp) + 1);
101 } 101 }
102#endif /* not HAVE_SETITIMER */ 102#endif /* not HAVE_SETITIMER */
103 103
@@ -123,18 +123,18 @@ start_atimer (enum atimer_type type, EMACS_TIME time, atimer_callback fn,
123 switch (type) 123 switch (type)
124 { 124 {
125 case ATIMER_ABSOLUTE: 125 case ATIMER_ABSOLUTE:
126 t->expiration = time; 126 t->expiration = timestamp;
127 break; 127 break;
128 128
129 case ATIMER_RELATIVE: 129 case ATIMER_RELATIVE:
130 EMACS_GET_TIME (t->expiration); 130 EMACS_GET_TIME (t->expiration);
131 EMACS_ADD_TIME (t->expiration, t->expiration, time); 131 EMACS_ADD_TIME (t->expiration, t->expiration, timestamp);
132 break; 132 break;
133 133
134 case ATIMER_CONTINUOUS: 134 case ATIMER_CONTINUOUS:
135 EMACS_GET_TIME (t->expiration); 135 EMACS_GET_TIME (t->expiration);
136 EMACS_ADD_TIME (t->expiration, t->expiration, time); 136 EMACS_ADD_TIME (t->expiration, t->expiration, timestamp);
137 t->interval = time; 137 t->interval = timestamp;
138 break; 138 break;
139 } 139 }
140 140
@@ -187,24 +187,24 @@ cancel_atimer (struct atimer *timer)
187} 187}
188 188
189 189
190/* Append two lists of atimers LIST1 and LIST2 and return the 190/* Append two lists of atimers LIST_1 and LIST_2 and return the
191 result list. */ 191 result list. */
192 192
193static struct atimer * 193static struct atimer *
194append_atimer_lists (struct atimer *list1, struct atimer *list2) 194append_atimer_lists (struct atimer *list_1, struct atimer *list_2)
195{ 195{
196 if (list1 == NULL) 196 if (list_1 == NULL)
197 return list2; 197 return list_2;
198 else if (list2 == NULL) 198 else if (list_2 == NULL)
199 return list1; 199 return list_1;
200 else 200 else
201 { 201 {
202 struct atimer *p; 202 struct atimer *p;
203 203
204 for (p = list1; p->next; p = p->next) 204 for (p = list_1; p->next; p = p->next)
205 ; 205 ;
206 p->next = list2; 206 p->next = list_2;
207 return list1; 207 return list_1;
208 } 208 }
209} 209}
210 210
@@ -287,28 +287,28 @@ set_alarm (void)
287{ 287{
288 if (atimers) 288 if (atimers)
289 { 289 {
290 EMACS_TIME now, time; 290 EMACS_TIME now, timestamp;
291#ifdef HAVE_SETITIMER 291#ifdef HAVE_SETITIMER
292 struct itimerval it; 292 struct itimerval it;
293#endif 293#endif
294 294
295 /* Determine s/us till the next timer is ripe. */ 295 /* Determine s/us till the next timer is ripe. */
296 EMACS_GET_TIME (now); 296 EMACS_GET_TIME (now);
297 EMACS_SUB_TIME (time, atimers->expiration, now); 297 EMACS_SUB_TIME (timestamp, atimers->expiration, now);
298 298
299#ifdef HAVE_SETITIMER 299#ifdef HAVE_SETITIMER
300 /* Don't set the interval to 0; this disables the timer. */ 300 /* Don't set the interval to 0; this disables the timer. */
301 if (EMACS_TIME_LE (atimers->expiration, now)) 301 if (EMACS_TIME_LE (atimers->expiration, now))
302 { 302 {
303 EMACS_SET_SECS (time, 0); 303 EMACS_SET_SECS (timestamp, 0);
304 EMACS_SET_USECS (time, 1000); 304 EMACS_SET_USECS (timestamp, 1000);
305 } 305 }
306 306
307 memset (&it, 0, sizeof it); 307 memset (&it, 0, sizeof it);
308 it.it_value = time; 308 it.it_value = timestamp;
309 setitimer (ITIMER_REAL, &it, 0); 309 setitimer (ITIMER_REAL, &it, 0);
310#else /* not HAVE_SETITIMER */ 310#else /* not HAVE_SETITIMER */
311 alarm (max (EMACS_SECS (time), 1)); 311 alarm (max (EMACS_SECS (timestamp), 1));
312#endif /* not HAVE_SETITIMER */ 312#endif /* not HAVE_SETITIMER */
313 } 313 }
314} 314}
@@ -388,7 +388,7 @@ run_timers (void)
388/* Signal handler for SIGALRM. SIGNO is the signal number, i.e. 388/* Signal handler for SIGALRM. SIGNO is the signal number, i.e.
389 SIGALRM. */ 389 SIGALRM. */
390 390
391SIGTYPE 391void
392alarm_signal_handler (int signo) 392alarm_signal_handler (int signo)
393{ 393{
394#ifndef SYNC_INPUT 394#ifndef SYNC_INPUT
@@ -442,4 +442,3 @@ init_atimer (void)
442 /* pending_signals is initialized in init_keyboard.*/ 442 /* pending_signals is initialized in init_keyboard.*/
443 signal (SIGALRM, alarm_signal_handler); 443 signal (SIGALRM, alarm_signal_handler);
444} 444}
445
diff --git a/src/buffer.c b/src/buffer.c
index d301e7f14f9..cdcd2ccecff 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -2520,8 +2520,7 @@ The first thing this function does is run
2520the normal hook `change-major-mode-hook'. */) 2520the normal hook `change-major-mode-hook'. */)
2521 (void) 2521 (void)
2522{ 2522{
2523 if (!NILP (Vrun_hooks)) 2523 Frun_hooks (1, &Qchange_major_mode_hook);
2524 call1 (Vrun_hooks, Qchange_major_mode_hook);
2525 2524
2526 /* Make sure none of the bindings in local_var_alist 2525 /* Make sure none of the bindings in local_var_alist
2527 remain swapped in, in their symbols. */ 2526 remain swapped in, in their symbols. */
@@ -5225,12 +5224,12 @@ init_buffer (void)
5225#define DEFVAR_PER_BUFFER(lname, vname, type, doc) \ 5224#define DEFVAR_PER_BUFFER(lname, vname, type, doc) \
5226 do { \ 5225 do { \
5227 static struct Lisp_Buffer_Objfwd bo_fwd; \ 5226 static struct Lisp_Buffer_Objfwd bo_fwd; \
5228 defvar_per_buffer (&bo_fwd, lname, vname, type, 0); \ 5227 defvar_per_buffer (&bo_fwd, lname, vname, type); \
5229 } while (0) 5228 } while (0)
5230 5229
5231static void 5230static void
5232defvar_per_buffer (struct Lisp_Buffer_Objfwd *bo_fwd, const char *namestring, 5231defvar_per_buffer (struct Lisp_Buffer_Objfwd *bo_fwd, const char *namestring,
5233 Lisp_Object *address, Lisp_Object type, char *doc) 5232 Lisp_Object *address, Lisp_Object type)
5234{ 5233{
5235 struct Lisp_Symbol *sym; 5234 struct Lisp_Symbol *sym;
5236 int offset; 5235 int offset;
diff --git a/src/bytecode.c b/src/bytecode.c
index d887668dd39..01ae8055ebf 100644
--- a/src/bytecode.c
+++ b/src/bytecode.c
@@ -425,7 +425,7 @@ according to which any remaining arguments are pushed on the stack
425before executing BYTESTR. 425before executing BYTESTR.
426 426
427usage: (byte-code BYTESTR VECTOR MAXDEP &optional ARGS-TEMPLATE &rest ARGS) */) 427usage: (byte-code BYTESTR VECTOR MAXDEP &optional ARGS-TEMPLATE &rest ARGS) */)
428 (int nargs, Lisp_Object *args) 428 (size_t nargs, Lisp_Object *args)
429{ 429{
430 Lisp_Object args_tmpl = nargs >= 4 ? args[3] : Qnil; 430 Lisp_Object args_tmpl = nargs >= 4 ? args[3] : Qnil;
431 int pnargs = nargs >= 4 ? nargs - 4 : 0; 431 int pnargs = nargs >= 4 ? nargs - 4 : 0;
@@ -631,7 +631,16 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth,
631 { 631 {
632 Lisp_Object v1; 632 Lisp_Object v1;
633 v1 = TOP; 633 v1 = TOP;
634 TOP = CAR (v1); 634 if (CONSP (v1))
635 TOP = XCAR (v1);
636 else if (NILP (v1))
637 TOP = Qnil;
638 else
639 {
640 BEFORE_POTENTIAL_GC ();
641 wrong_type_argument (Qlistp, v1);
642 AFTER_POTENTIAL_GC ();
643 }
635 break; 644 break;
636 } 645 }
637 646
@@ -657,7 +666,17 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth,
657 { 666 {
658 Lisp_Object v1; 667 Lisp_Object v1;
659 v1 = TOP; 668 v1 = TOP;
660 TOP = CDR (v1); 669 if (CONSP (v1))
670 TOP = XCDR (v1);
671 else if (NILP (v1))
672 TOP = Qnil;
673 else
674 {
675 BEFORE_POTENTIAL_GC ();
676 wrong_type_argument (Qlistp, v1);
677 AFTER_POTENTIAL_GC ();
678 }
679 break;
661 break; 680 break;
662 } 681 }
663 682
@@ -994,13 +1013,13 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth,
994 v1 = POP; 1013 v1 = POP;
995 v2 = TOP; 1014 v2 = TOP;
996 CHECK_NUMBER (v2); 1015 CHECK_NUMBER (v2);
997 AFTER_POTENTIAL_GC ();
998 op = XINT (v2); 1016 op = XINT (v2);
999 immediate_quit = 1; 1017 immediate_quit = 1;
1000 while (--op >= 0 && CONSP (v1)) 1018 while (--op >= 0 && CONSP (v1))
1001 v1 = XCDR (v1); 1019 v1 = XCDR (v1);
1002 immediate_quit = 0; 1020 immediate_quit = 0;
1003 TOP = CAR (v1); 1021 TOP = CAR (v1);
1022 AFTER_POTENTIAL_GC ();
1004 break; 1023 break;
1005 } 1024 }
1006 1025
diff --git a/src/callint.c b/src/callint.c
index 3c520742e27..489fa392e46 100644
--- a/src/callint.c
+++ b/src/callint.c
@@ -269,8 +269,9 @@ invoke it. If KEYS is omitted or nil, the return value of
269 recorded as a call to the function named callint_argfuns[varies[i]]. */ 269 recorded as a call to the function named callint_argfuns[varies[i]]. */
270 int *varies; 270 int *varies;
271 271
272 register int i, j; 272 register size_t i, j;
273 int count, foo; 273 size_t count;
274 int foo;
274 char prompt1[100]; 275 char prompt1[100];
275 char *tem1; 276 char *tem1;
276 int arg_from_tty = 0; 277 int arg_from_tty = 0;
@@ -430,8 +431,7 @@ invoke it. If KEYS is omitted or nil, the return value of
430 error ("Attempt to select inactive minibuffer window"); 431 error ("Attempt to select inactive minibuffer window");
431 432
432 /* If the current buffer wants to clean up, let it. */ 433 /* If the current buffer wants to clean up, let it. */
433 if (!NILP (Vmouse_leave_buffer_hook)) 434 Frun_hooks (1, &Qmouse_leave_buffer_hook);
434 call1 (Vrun_hooks, Qmouse_leave_buffer_hook);
435 435
436 Fselect_window (w, Qnil); 436 Fselect_window (w, Qnil);
437 } 437 }
diff --git a/src/callproc.c b/src/callproc.c
index c53a92bbaf8..eb2a2268fe1 100644
--- a/src/callproc.c
+++ b/src/callproc.c
@@ -107,7 +107,7 @@ call_process_kill (Lisp_Object fdpid)
107 return Qnil; 107 return Qnil;
108} 108}
109 109
110Lisp_Object 110static Lisp_Object
111call_process_cleanup (Lisp_Object arg) 111call_process_cleanup (Lisp_Object arg)
112{ 112{
113 Lisp_Object fdpid = Fcdr (arg); 113 Lisp_Object fdpid = Fcdr (arg);
@@ -177,10 +177,10 @@ and returns a numeric exit status or a signal description string.
177If you quit, the process is killed with SIGINT, or SIGKILL if you quit again. 177If you quit, the process is killed with SIGINT, or SIGKILL if you quit again.
178 178
179usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) 179usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
180 (int nargs, register Lisp_Object *args) 180 (size_t nargs, register Lisp_Object *args)
181{ 181{
182 Lisp_Object infile, buffer, current_dir, path; 182 Lisp_Object infile, buffer, current_dir, path;
183 int display_p; 183 volatile int display_p_volatile;
184 int fd[2]; 184 int fd[2];
185 int filefd; 185 int filefd;
186 register int pid; 186 register int pid;
@@ -189,7 +189,9 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
189 char buf[CALLPROC_BUFFER_SIZE_MAX]; 189 char buf[CALLPROC_BUFFER_SIZE_MAX];
190 int bufsize = CALLPROC_BUFFER_SIZE_MIN; 190 int bufsize = CALLPROC_BUFFER_SIZE_MIN;
191 int count = SPECPDL_INDEX (); 191 int count = SPECPDL_INDEX ();
192 volatile USE_SAFE_ALLOCA;
192 193
194 const unsigned char **volatile new_argv_volatile;
193 register const unsigned char **new_argv; 195 register const unsigned char **new_argv;
194 /* File to use for stderr in the child. 196 /* File to use for stderr in the child.
195 t means use same as standard output. */ 197 t means use same as standard output. */
@@ -220,7 +222,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
220 /* Decide the coding-system for giving arguments. */ 222 /* Decide the coding-system for giving arguments. */
221 { 223 {
222 Lisp_Object val, *args2; 224 Lisp_Object val, *args2;
223 int i; 225 size_t i;
224 226
225 /* If arguments are supplied, we may have to encode them. */ 227 /* If arguments are supplied, we may have to encode them. */
226 if (nargs >= 5) 228 if (nargs >= 5)
@@ -241,7 +243,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
241 val = Qraw_text; 243 val = Qraw_text;
242 else 244 else
243 { 245 {
244 args2 = (Lisp_Object *) alloca ((nargs + 1) * sizeof *args2); 246 SAFE_ALLOCA (args2, Lisp_Object *, (nargs + 1) * sizeof *args2);
245 args2[0] = Qcall_process; 247 args2[0] = Qcall_process;
246 for (i = 0; i < nargs; i++) args2[i + 1] = args[i]; 248 for (i = 0; i < nargs; i++) args2[i + 1] = args[i];
247 coding_systems = Ffind_operation_coding_system (nargs + 1, args2); 249 coding_systems = Ffind_operation_coding_system (nargs + 1, args2);
@@ -343,7 +345,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
343 UNGCPRO; 345 UNGCPRO;
344 } 346 }
345 347
346 display_p = INTERACTIVE && nargs >= 4 && !NILP (args[3]); 348 display_p_volatile = INTERACTIVE && nargs >= 4 && !NILP (args[3]);
347 349
348 filefd = emacs_open (SSDATA (infile), O_RDONLY, 0); 350 filefd = emacs_open (SSDATA (infile), O_RDONLY, 0);
349 if (filefd < 0) 351 if (filefd < 0)
@@ -371,11 +373,12 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
371 && SREF (path, 1) == ':') 373 && SREF (path, 1) == ':')
372 path = Fsubstring (path, make_number (2), Qnil); 374 path = Fsubstring (path, make_number (2), Qnil);
373 375
374 new_argv = (const unsigned char **) 376 SAFE_ALLOCA (new_argv, const unsigned char **,
375 alloca (max (2, nargs - 2) * sizeof (char *)); 377 (nargs > 4 ? nargs - 2 : 2) * sizeof *new_argv);
378 new_argv_volatile = new_argv;
376 if (nargs > 4) 379 if (nargs > 4)
377 { 380 {
378 register int i; 381 register size_t i;
379 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5; 382 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5;
380 383
381 GCPRO5 (infile, buffer, current_dir, path, error_file); 384 GCPRO5 (infile, buffer, current_dir, path, error_file);
@@ -542,6 +545,8 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
542 545
543 pid = vfork (); 546 pid = vfork ();
544 547
548 new_argv = new_argv_volatile;
549
545 if (pid == 0) 550 if (pid == 0)
546 { 551 {
547 if (fd[0] >= 0) 552 if (fd[0] >= 0)
@@ -640,9 +645,9 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
640 { 645 {
641 if (EQ (coding_systems, Qt)) 646 if (EQ (coding_systems, Qt))
642 { 647 {
643 int i; 648 size_t i;
644 649
645 args2 = (Lisp_Object *) alloca ((nargs + 1) * sizeof *args2); 650 SAFE_ALLOCA (args2, Lisp_Object *, (nargs + 1) * sizeof *args2);
646 args2[0] = Qcall_process; 651 args2[0] = Qcall_process;
647 for (i = 0; i < nargs; i++) args2[i + 1] = args[i]; 652 for (i = 0; i < nargs; i++) args2[i + 1] = args[i];
648 coding_systems 653 coding_systems
@@ -673,6 +678,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
673 int first = 1; 678 int first = 1;
674 EMACS_INT total_read = 0; 679 EMACS_INT total_read = 0;
675 int carryover = 0; 680 int carryover = 0;
681 int display_p = display_p_volatile;
676 int display_on_the_fly = display_p; 682 int display_on_the_fly = display_p;
677 struct coding_system saved_coding; 683 struct coding_system saved_coding;
678 684
@@ -805,6 +811,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
805 when exiting. */ 811 when exiting. */
806 call_process_exited = 1; 812 call_process_exited = 1;
807 813
814 SAFE_FREE ();
808 unbind_to (count, Qnil); 815 unbind_to (count, Qnil);
809 816
810 if (synch_process_termsig) 817 if (synch_process_termsig)
@@ -860,7 +867,7 @@ and returns a numeric exit status or a signal description string.
860If you quit, the process is killed with SIGINT, or SIGKILL if you quit again. 867If you quit, the process is killed with SIGINT, or SIGKILL if you quit again.
861 868
862usage: (call-process-region START END PROGRAM &optional DELETE BUFFER DISPLAY &rest ARGS) */) 869usage: (call-process-region START END PROGRAM &optional DELETE BUFFER DISPLAY &rest ARGS) */)
863 (int nargs, register Lisp_Object *args) 870 (size_t nargs, register Lisp_Object *args)
864{ 871{
865 struct gcpro gcpro1; 872 struct gcpro gcpro1;
866 Lisp_Object filename_string; 873 Lisp_Object filename_string;
@@ -869,7 +876,7 @@ usage: (call-process-region START END PROGRAM &optional DELETE BUFFER DISPLAY &r
869 /* Qt denotes we have not yet called Ffind_operation_coding_system. */ 876 /* Qt denotes we have not yet called Ffind_operation_coding_system. */
870 Lisp_Object coding_systems; 877 Lisp_Object coding_systems;
871 Lisp_Object val, *args2; 878 Lisp_Object val, *args2;
872 int i; 879 size_t i;
873 char *tempfile; 880 char *tempfile;
874 Lisp_Object tmpdir, pattern; 881 Lisp_Object tmpdir, pattern;
875 882
@@ -893,30 +900,35 @@ usage: (call-process-region START END PROGRAM &optional DELETE BUFFER DISPLAY &r
893#endif 900#endif
894 } 901 }
895 902
896 pattern = Fexpand_file_name (Vtemp_file_name_pattern, tmpdir); 903 {
897 tempfile = (char *) alloca (SBYTES (pattern) + 1); 904 USE_SAFE_ALLOCA;
898 memcpy (tempfile, SDATA (pattern), SBYTES (pattern) + 1); 905 pattern = Fexpand_file_name (Vtemp_file_name_pattern, tmpdir);
899 coding_systems = Qt; 906 SAFE_ALLOCA (tempfile, char *, SBYTES (pattern) + 1);
907 memcpy (tempfile, SDATA (pattern), SBYTES (pattern) + 1);
908 coding_systems = Qt;
900 909
901#ifdef HAVE_MKSTEMP 910#ifdef HAVE_MKSTEMP
902 { 911 {
903 int fd; 912 int fd;
904 913
905 BLOCK_INPUT; 914 BLOCK_INPUT;
906 fd = mkstemp (tempfile); 915 fd = mkstemp (tempfile);
907 UNBLOCK_INPUT; 916 UNBLOCK_INPUT;
908 if (fd == -1) 917 if (fd == -1)
909 report_file_error ("Failed to open temporary file", 918 report_file_error ("Failed to open temporary file",
910 Fcons (Vtemp_file_name_pattern, Qnil)); 919 Fcons (Vtemp_file_name_pattern, Qnil));
911 else 920 else
912 close (fd); 921 close (fd);
913 } 922 }
914#else 923#else
915 mktemp (tempfile); 924 mktemp (tempfile);
916#endif 925#endif
917 926
918 filename_string = build_string (tempfile); 927 filename_string = build_string (tempfile);
919 GCPRO1 (filename_string); 928 GCPRO1 (filename_string);
929 SAFE_FREE ();
930 }
931
920 start = args[0]; 932 start = args[0];
921 end = args[1]; 933 end = args[1];
922 /* Decide coding-system of the contents of the temporary file. */ 934 /* Decide coding-system of the contents of the temporary file. */
@@ -926,11 +938,13 @@ usage: (call-process-region START END PROGRAM &optional DELETE BUFFER DISPLAY &r
926 val = Qraw_text; 938 val = Qraw_text;
927 else 939 else
928 { 940 {
929 args2 = (Lisp_Object *) alloca ((nargs + 1) * sizeof *args2); 941 USE_SAFE_ALLOCA;
942 SAFE_ALLOCA (args2, Lisp_Object *, (nargs + 1) * sizeof *args2);
930 args2[0] = Qcall_process_region; 943 args2[0] = Qcall_process_region;
931 for (i = 0; i < nargs; i++) args2[i + 1] = args[i]; 944 for (i = 0; i < nargs; i++) args2[i + 1] = args[i];
932 coding_systems = Ffind_operation_coding_system (nargs + 1, args2); 945 coding_systems = Ffind_operation_coding_system (nargs + 1, args2);
933 val = CONSP (coding_systems) ? XCDR (coding_systems) : Qnil; 946 val = CONSP (coding_systems) ? XCDR (coding_systems) : Qnil;
947 SAFE_FREE ();
934 } 948 }
935 val = complement_process_encoding_system (val); 949 val = complement_process_encoding_system (val);
936 950
@@ -1272,12 +1286,12 @@ relocate_fd (int fd, int minfd)
1272#endif 1286#endif
1273 if (new == -1) 1287 if (new == -1)
1274 { 1288 {
1275 const char *message1 = "Error while setting up child: "; 1289 const char *message_1 = "Error while setting up child: ";
1276 const char *errmessage = strerror (errno); 1290 const char *errmessage = strerror (errno);
1277 const char *message2 = "\n"; 1291 const char *message_2 = "\n";
1278 emacs_write (2, message1, strlen (message1)); 1292 emacs_write (2, message_1, strlen (message_1));
1279 emacs_write (2, errmessage, strlen (errmessage)); 1293 emacs_write (2, errmessage, strlen (errmessage));
1280 emacs_write (2, message2, strlen (message2)); 1294 emacs_write (2, message_2, strlen (message_2));
1281 _exit (1); 1295 _exit (1);
1282 } 1296 }
1283 emacs_close (fd); 1297 emacs_close (fd);
diff --git a/src/character.c b/src/character.c
index fdaf22f04f8..bac9f6af81e 100644
--- a/src/character.c
+++ b/src/character.c
@@ -232,13 +232,10 @@ translate_char (Lisp_Object table, int c)
232} 232}
233 233
234/* Convert ASCII or 8-bit character C to unibyte. If C is none of 234/* Convert ASCII or 8-bit character C to unibyte. If C is none of
235 them, return (C & 0xFF). 235 them, return (C & 0xFF). */
236
237 The argument REV_TBL is now ignored. It will be removed in the
238 future. */
239 236
240int 237int
241multibyte_char_to_unibyte (int c, Lisp_Object rev_tbl) 238multibyte_char_to_unibyte (int c)
242{ 239{
243 if (c < 0x80) 240 if (c < 0x80)
244 return c; 241 return c;
@@ -893,9 +890,10 @@ DEFUN ("string", Fstring, Sstring, 0, MANY, 0,
893 doc: /* 890 doc: /*
894Concatenate all the argument characters and make the result a string. 891Concatenate all the argument characters and make the result a string.
895usage: (string &rest CHARACTERS) */) 892usage: (string &rest CHARACTERS) */)
896 (int n, Lisp_Object *args) 893 (size_t n, Lisp_Object *args)
897{ 894{
898 int i, c; 895 size_t i;
896 int c;
899 unsigned char *buf, *p; 897 unsigned char *buf, *p;
900 Lisp_Object str; 898 Lisp_Object str;
901 USE_SAFE_ALLOCA; 899 USE_SAFE_ALLOCA;
@@ -918,9 +916,10 @@ usage: (string &rest CHARACTERS) */)
918DEFUN ("unibyte-string", Funibyte_string, Sunibyte_string, 0, MANY, 0, 916DEFUN ("unibyte-string", Funibyte_string, Sunibyte_string, 0, MANY, 0,
919 doc: /* Concatenate all the argument bytes and make the result a unibyte string. 917 doc: /* Concatenate all the argument bytes and make the result a unibyte string.
920usage: (unibyte-string &rest BYTES) */) 918usage: (unibyte-string &rest BYTES) */)
921 (int n, Lisp_Object *args) 919 (size_t n, Lisp_Object *args)
922{ 920{
923 int i, c; 921 size_t i;
922 int c;
924 unsigned char *buf, *p; 923 unsigned char *buf, *p;
925 Lisp_Object str; 924 Lisp_Object str;
926 USE_SAFE_ALLOCA; 925 USE_SAFE_ALLOCA;
diff --git a/src/character.h b/src/character.h
index 4c468e14d2c..7a75ac186fa 100644
--- a/src/character.h
+++ b/src/character.h
@@ -69,7 +69,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
69#define CHAR_TO_BYTE8(c) \ 69#define CHAR_TO_BYTE8(c) \
70 (CHAR_BYTE8_P (c) \ 70 (CHAR_BYTE8_P (c) \
71 ? (c) - 0x3FFF00 \ 71 ? (c) - 0x3FFF00 \
72 : multibyte_char_to_unibyte (c, Qnil)) 72 : multibyte_char_to_unibyte (c))
73 73
74/* Return the raw 8-bit byte for character C, 74/* Return the raw 8-bit byte for character C,
75 or -1 if C doesn't correspond to a byte. */ 75 or -1 if C doesn't correspond to a byte. */
@@ -278,11 +278,11 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
278 do { \ 278 do { \
279 if ((p) > (limit)) \ 279 if ((p) > (limit)) \
280 { \ 280 { \
281 const unsigned char *pcb = (p); \ 281 const unsigned char *chp = (p); \
282 do { \ 282 do { \
283 pcb--; \ 283 chp--; \
284 } while (pcb >= limit && ! CHAR_HEAD_P (*pcb)); \ 284 } while (chp >= limit && ! CHAR_HEAD_P (*chp)); \
285 (p) = (BYTES_BY_CHAR_HEAD (*pcb) == (p) - pcb) ? pcb : (p) - 1; \ 285 (p) = (BYTES_BY_CHAR_HEAD (*chp) == (p) - chp) ? chp : (p) - 1; \
286 } \ 286 } \
287 } while (0) 287 } while (0)
288 288
@@ -353,11 +353,11 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
353 CHARIDX++; \ 353 CHARIDX++; \
354 if (STRING_MULTIBYTE (STRING)) \ 354 if (STRING_MULTIBYTE (STRING)) \
355 { \ 355 { \
356 unsigned char *string_ptr = &SDATA (STRING)[BYTEIDX]; \ 356 unsigned char *chp = &SDATA (STRING)[BYTEIDX]; \
357 int string_len; \ 357 int chlen; \
358 \ 358 \
359 OUTPUT = STRING_CHAR_AND_LENGTH (string_ptr, string_len); \ 359 OUTPUT = STRING_CHAR_AND_LENGTH (chp, chlen); \
360 BYTEIDX += string_len; \ 360 BYTEIDX += chlen; \
361 } \ 361 } \
362 else \ 362 else \
363 { \ 363 { \
@@ -376,11 +376,11 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
376 CHARIDX++; \ 376 CHARIDX++; \
377 if (STRING_MULTIBYTE (STRING)) \ 377 if (STRING_MULTIBYTE (STRING)) \
378 { \ 378 { \
379 unsigned char *ptr = &SDATA (STRING)[BYTEIDX]; \ 379 unsigned char *chp = &SDATA (STRING)[BYTEIDX]; \
380 int ptrlen; \ 380 int chlen; \
381 \ 381 \
382 OUTPUT = STRING_CHAR_AND_LENGTH (ptr, ptrlen); \ 382 OUTPUT = STRING_CHAR_AND_LENGTH (chp, chlen); \
383 BYTEIDX += ptrlen; \ 383 BYTEIDX += chlen; \
384 } \ 384 } \
385 else \ 385 else \
386 { \ 386 { \
@@ -416,11 +416,11 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
416 CHARIDX++; \ 416 CHARIDX++; \
417 if (!NILP (BVAR (current_buffer, enable_multibyte_characters))) \ 417 if (!NILP (BVAR (current_buffer, enable_multibyte_characters))) \
418 { \ 418 { \
419 unsigned char *ptr = BYTE_POS_ADDR (BYTEIDX); \ 419 unsigned char *chp = BYTE_POS_ADDR (BYTEIDX); \
420 int string_len; \ 420 int chlen; \
421 \ 421 \
422 OUTPUT= STRING_CHAR_AND_LENGTH (ptr, string_len); \ 422 OUTPUT= STRING_CHAR_AND_LENGTH (chp, chlen); \
423 BYTEIDX += string_len; \ 423 BYTEIDX += chlen; \
424 } \ 424 } \
425 else \ 425 else \
426 { \ 426 { \
@@ -436,11 +436,11 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
436#define FETCH_CHAR_ADVANCE_NO_CHECK(OUTPUT, CHARIDX, BYTEIDX) \ 436#define FETCH_CHAR_ADVANCE_NO_CHECK(OUTPUT, CHARIDX, BYTEIDX) \
437 do \ 437 do \
438 { \ 438 { \
439 unsigned char *ptr = BYTE_POS_ADDR (BYTEIDX); \ 439 unsigned char *chp = BYTE_POS_ADDR (BYTEIDX); \
440 int len; \ 440 int chlen; \
441 \ 441 \
442 OUTPUT = STRING_CHAR_AND_LENGTH (ptr, len); \ 442 OUTPUT = STRING_CHAR_AND_LENGTH (chp, chlen); \
443 BYTEIDX += len; \ 443 BYTEIDX += chlen; \
444 CHARIDX++; \ 444 CHARIDX++; \
445 } \ 445 } \
446 while (0) 446 while (0)
@@ -451,8 +451,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
451 451
452#define INC_POS(pos_byte) \ 452#define INC_POS(pos_byte) \
453 do { \ 453 do { \
454 unsigned char *ptr = BYTE_POS_ADDR (pos_byte); \ 454 unsigned char *chp = BYTE_POS_ADDR (pos_byte); \
455 pos_byte += BYTES_BY_CHAR_HEAD (*ptr); \ 455 pos_byte += BYTES_BY_CHAR_HEAD (*chp); \
456 } while (0) 456 } while (0)
457 457
458 458
@@ -461,16 +461,16 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
461 461
462#define DEC_POS(pos_byte) \ 462#define DEC_POS(pos_byte) \
463 do { \ 463 do { \
464 unsigned char *ptr; \ 464 unsigned char *chp; \
465 \ 465 \
466 pos_byte--; \ 466 pos_byte--; \
467 if (pos_byte < GPT_BYTE) \ 467 if (pos_byte < GPT_BYTE) \
468 ptr = BEG_ADDR + pos_byte - BEG_BYTE; \ 468 chp = BEG_ADDR + pos_byte - BEG_BYTE; \
469 else \ 469 else \
470 ptr = BEG_ADDR + GAP_SIZE + pos_byte - BEG_BYTE; \ 470 chp = BEG_ADDR + GAP_SIZE + pos_byte - BEG_BYTE; \
471 while (!CHAR_HEAD_P (*ptr)) \ 471 while (!CHAR_HEAD_P (*chp)) \
472 { \ 472 { \
473 ptr--; \ 473 chp--; \
474 pos_byte--; \ 474 pos_byte--; \
475 } \ 475 } \
476 } while (0) 476 } while (0)
@@ -510,8 +510,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
510 510
511#define BUF_INC_POS(buf, pos_byte) \ 511#define BUF_INC_POS(buf, pos_byte) \
512 do { \ 512 do { \
513 unsigned char *bbp = BUF_BYTE_ADDRESS (buf, pos_byte); \ 513 unsigned char *chp = BUF_BYTE_ADDRESS (buf, pos_byte); \
514 pos_byte += BYTES_BY_CHAR_HEAD (*bbp); \ 514 pos_byte += BYTES_BY_CHAR_HEAD (*chp); \
515 } while (0) 515 } while (0)
516 516
517 517
@@ -520,15 +520,15 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
520 520
521#define BUF_DEC_POS(buf, pos_byte) \ 521#define BUF_DEC_POS(buf, pos_byte) \
522 do { \ 522 do { \
523 unsigned char *p; \ 523 unsigned char *chp; \
524 pos_byte--; \ 524 pos_byte--; \
525 if (pos_byte < BUF_GPT_BYTE (buf)) \ 525 if (pos_byte < BUF_GPT_BYTE (buf)) \
526 p = BUF_BEG_ADDR (buf) + pos_byte - BEG_BYTE; \ 526 chp = BUF_BEG_ADDR (buf) + pos_byte - BEG_BYTE; \
527 else \ 527 else \
528 p = BUF_BEG_ADDR (buf) + BUF_GAP_SIZE (buf) + pos_byte - BEG_BYTE;\ 528 chp = BUF_BEG_ADDR (buf) + BUF_GAP_SIZE (buf) + pos_byte - BEG_BYTE;\
529 while (!CHAR_HEAD_P (*p)) \ 529 while (!CHAR_HEAD_P (*chp)) \
530 { \ 530 { \
531 p--; \ 531 chp--; \
532 pos_byte--; \ 532 pos_byte--; \
533 } \ 533 } \
534 } while (0) 534 } while (0)
diff --git a/src/charset.c b/src/charset.c
index d82b29ae44b..32836d459f3 100644
--- a/src/charset.c
+++ b/src/charset.c
@@ -845,7 +845,7 @@ DEFUN ("define-charset-internal", Fdefine_charset_internal,
845 Sdefine_charset_internal, charset_arg_max, MANY, 0, 845 Sdefine_charset_internal, charset_arg_max, MANY, 0,
846 doc: /* For internal use only. 846 doc: /* For internal use only.
847usage: (define-charset-internal ...) */) 847usage: (define-charset-internal ...) */)
848 (int nargs, Lisp_Object *args) 848 (size_t nargs, Lisp_Object *args)
849{ 849{
850 /* Charset attr vector. */ 850 /* Charset attr vector. */
851 Lisp_Object attrs; 851 Lisp_Object attrs;
@@ -2171,11 +2171,12 @@ DEFUN ("set-charset-priority", Fset_charset_priority, Sset_charset_priority,
2171 1, MANY, 0, 2171 1, MANY, 0,
2172 doc: /* Assign higher priority to the charsets given as arguments. 2172 doc: /* Assign higher priority to the charsets given as arguments.
2173usage: (set-charset-priority &rest charsets) */) 2173usage: (set-charset-priority &rest charsets) */)
2174 (int nargs, Lisp_Object *args) 2174 (size_t nargs, Lisp_Object *args)
2175{ 2175{
2176 Lisp_Object new_head, old_list, arglist[2]; 2176 Lisp_Object new_head, old_list, arglist[2];
2177 Lisp_Object list_2022, list_emacs_mule; 2177 Lisp_Object list_2022, list_emacs_mule;
2178 int i, id; 2178 size_t i;
2179 int id;
2179 2180
2180 old_list = Fcopy_sequence (Vcharset_ordered_list); 2181 old_list = Fcopy_sequence (Vcharset_ordered_list);
2181 new_head = Qnil; 2182 new_head = Qnil;
diff --git a/src/chartab.c b/src/chartab.c
index 85aa5932ac3..9ad182131e9 100644
--- a/src/chartab.c
+++ b/src/chartab.c
@@ -215,7 +215,6 @@ sub_char_table_ref_and_range (Lisp_Object table, int c, int *from, int *to, Lisp
215 struct Lisp_Sub_Char_Table *tbl = XSUB_CHAR_TABLE (table); 215 struct Lisp_Sub_Char_Table *tbl = XSUB_CHAR_TABLE (table);
216 int depth = XINT (tbl->depth); 216 int depth = XINT (tbl->depth);
217 int min_char = XINT (tbl->min_char); 217 int min_char = XINT (tbl->min_char);
218 int max_char = min_char + chartab_chars[depth - 1] - 1;
219 int chartab_idx = CHARTAB_IDX (c, depth, min_char), idx; 218 int chartab_idx = CHARTAB_IDX (c, depth, min_char), idx;
220 Lisp_Object val; 219 Lisp_Object val;
221 220
@@ -244,8 +243,9 @@ sub_char_table_ref_and_range (Lisp_Object table, int c, int *from, int *to, Lisp
244 break; 243 break;
245 } 244 }
246 } 245 }
247 while ((c = min_char + (chartab_idx + 1) * chartab_chars[depth]) <= max_char 246 while (((c = (chartab_idx + 1) * chartab_chars[depth])
248 && *to >= c) 247 < chartab_chars[depth - 1])
248 && (c += min_char) <= *to)
249 { 249 {
250 Lisp_Object this_val; 250 Lisp_Object this_val;
251 251
diff --git a/src/cm.c b/src/cm.c
index 108ee5720f3..42f855f1694 100644
--- a/src/cm.c
+++ b/src/cm.c
@@ -27,19 +27,11 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
27#include "cm.h" 27#include "cm.h"
28#include "termhooks.h" 28#include "termhooks.h"
29#include "termchar.h" 29#include "termchar.h"
30 30#include "tparam.h"
31
32/* For now, don't try to include termcap.h. On some systems,
33 configure finds a non-standard termcap.h that the main build
34 won't find. */
35extern void tputs (const char *, int, int (*)(int));
36extern char *tgoto (const char *, int, int);
37 31
38#define BIG 9999 /* 9999 good on VAXen. For 16 bit machines 32#define BIG 9999 /* 9999 good on VAXen. For 16 bit machines
39 use about 2000.... */ 33 use about 2000.... */
40 34
41extern char *BC, *UP;
42
43int cost; /* sums up costs */ 35int cost; /* sums up costs */
44 36
45/* ARGSUSED */ 37/* ARGSUSED */
@@ -222,8 +214,9 @@ calccost (struct tty_display_info *tty,
222 } 214 }
223 totalcost = c * deltay; 215 totalcost = c * deltay;
224 if (doit) 216 if (doit)
225 while (--deltay >= 0) 217 do
226 emacs_tputs (tty, p, 1, cmputc); 218 emacs_tputs (tty, p, 1, cmputc);
219 while (0 < --deltay);
227x: 220x:
228 if ((deltax = dstx - srcx) == 0) 221 if ((deltax = dstx - srcx) == 0)
229 goto done; 222 goto done;
@@ -304,8 +297,9 @@ fail:
304 } 297 }
305 totalcost += c * deltax; 298 totalcost += c * deltax;
306 if (doit) 299 if (doit)
307 while (--deltax >= 0) 300 do
308 emacs_tputs (tty, p, 1, cmputc); 301 emacs_tputs (tty, p, 1, cmputc);
302 while (0 < --deltax);
309done: 303done:
310 return totalcost; 304 return totalcost;
311} 305}
diff --git a/src/cm.h b/src/cm.h
index 5d430598f0c..8f23990ce55 100644
--- a/src/cm.h
+++ b/src/cm.h
@@ -96,8 +96,6 @@ struct cm
96 int cc_vabs; 96 int cc_vabs;
97 }; 97 };
98 98
99extern char PC; /* Pad character */
100
101/* Shorthand */ 99/* Shorthand */
102#ifndef NoCMShortHand 100#ifndef NoCMShortHand
103#define curY(tty) (tty)->Wcm->cm_curY 101#define curY(tty) (tty)->Wcm->cm_curY
diff --git a/src/cmds.c b/src/cmds.c
index fa1ac5028ae..1cf7ff24fec 100644
--- a/src/cmds.c
+++ b/src/cmds.c
@@ -352,7 +352,7 @@ internal_self_insert (int c, EMACS_INT n)
352 { 352 {
353 str[0] = (SINGLE_BYTE_CHAR_P (c) 353 str[0] = (SINGLE_BYTE_CHAR_P (c)
354 ? c 354 ? c
355 : multibyte_char_to_unibyte (c, Qnil)); 355 : multibyte_char_to_unibyte (c));
356 len = 1; 356 len = 1;
357 } 357 }
358 if (!NILP (overwrite) 358 if (!NILP (overwrite)
@@ -501,7 +501,7 @@ internal_self_insert (int c, EMACS_INT n)
501 } 501 }
502 502
503 /* Run hooks for electric keys. */ 503 /* Run hooks for electric keys. */
504 call1 (Vrun_hooks, Qpost_self_insert_hook); 504 Frun_hooks (1, &Qpost_self_insert_hook);
505 505
506 return hairy; 506 return hairy;
507} 507}
diff --git a/src/coding.c b/src/coding.c
index 0c2836c19f6..9e28a1c9f9b 100644
--- a/src/coding.c
+++ b/src/coding.c
@@ -853,8 +853,7 @@ static unsigned char *alloc_destination (struct coding_system *,
853 EMACS_INT, unsigned char *); 853 EMACS_INT, unsigned char *);
854static void setup_iso_safe_charsets (Lisp_Object); 854static void setup_iso_safe_charsets (Lisp_Object);
855static unsigned char *encode_designation_at_bol (struct coding_system *, 855static unsigned char *encode_designation_at_bol (struct coding_system *,
856 int *, int *, 856 int *, unsigned char *);
857 unsigned char *);
858static int detect_eol (const unsigned char *, 857static int detect_eol (const unsigned char *,
859 EMACS_INT, enum coding_category); 858 EMACS_INT, enum coding_category);
860static Lisp_Object adjust_coding_eol_type (struct coding_system *, int); 859static Lisp_Object adjust_coding_eol_type (struct coding_system *, int);
@@ -4299,7 +4298,7 @@ encode_invocation_designation (struct charset *charset,
4299 4298
4300static unsigned char * 4299static unsigned char *
4301encode_designation_at_bol (struct coding_system *coding, int *charbuf, 4300encode_designation_at_bol (struct coding_system *coding, int *charbuf,
4302 int *charbuf_end, unsigned char *dst) 4301 unsigned char *dst)
4303{ 4302{
4304 struct charset *charset; 4303 struct charset *charset;
4305 /* Table of charsets to be designated to each graphic register. */ 4304 /* Table of charsets to be designated to each graphic register. */
@@ -4390,7 +4389,7 @@ encode_coding_iso_2022 (struct coding_system *coding)
4390 unsigned char *dst_prev = dst; 4389 unsigned char *dst_prev = dst;
4391 4390
4392 /* We have to produce designation sequences if any now. */ 4391 /* We have to produce designation sequences if any now. */
4393 dst = encode_designation_at_bol (coding, charbuf, charbuf_end, dst); 4392 dst = encode_designation_at_bol (coding, charbuf, dst);
4394 bol_designation = 0; 4393 bol_designation = 0;
4395 /* We are sure that designation sequences are all ASCII bytes. */ 4394 /* We are sure that designation sequences are all ASCII bytes. */
4396 produced_chars += dst - dst_prev; 4395 produced_chars += dst - dst_prev;
@@ -5266,11 +5265,12 @@ encode_coding_raw_text (struct coding_system *coding)
5266 unsigned char str[MAX_MULTIBYTE_LENGTH], *p0 = str, *p1 = str; 5265 unsigned char str[MAX_MULTIBYTE_LENGTH], *p0 = str, *p1 = str;
5267 5266
5268 CHAR_STRING_ADVANCE (c, p1); 5267 CHAR_STRING_ADVANCE (c, p1);
5269 while (p0 < p1) 5268 do
5270 { 5269 {
5271 EMIT_ONE_BYTE (*p0); 5270 EMIT_ONE_BYTE (*p0);
5272 p0++; 5271 p0++;
5273 } 5272 }
5273 while (p0 < p1);
5274 } 5274 }
5275 } 5275 }
5276 else 5276 else
@@ -9299,7 +9299,7 @@ function to call for FILENAME, that function should examine the
9299contents of BUFFER instead of reading the file. 9299contents of BUFFER instead of reading the file.
9300 9300
9301usage: (find-operation-coding-system OPERATION ARGUMENTS...) */) 9301usage: (find-operation-coding-system OPERATION ARGUMENTS...) */)
9302 (int nargs, Lisp_Object *args) 9302 (size_t nargs, Lisp_Object *args)
9303{ 9303{
9304 Lisp_Object operation, target_idx, target, val; 9304 Lisp_Object operation, target_idx, target, val;
9305 register Lisp_Object chain; 9305 register Lisp_Object chain;
@@ -9308,17 +9308,17 @@ usage: (find-operation-coding-system OPERATION ARGUMENTS...) */)
9308 error ("Too few arguments"); 9308 error ("Too few arguments");
9309 operation = args[0]; 9309 operation = args[0];
9310 if (!SYMBOLP (operation) 9310 if (!SYMBOLP (operation)
9311 || !INTEGERP (target_idx = Fget (operation, Qtarget_idx))) 9311 || !NATNUMP (target_idx = Fget (operation, Qtarget_idx)))
9312 error ("Invalid first argument"); 9312 error ("Invalid first argument");
9313 if (nargs < 1 + XINT (target_idx)) 9313 if (nargs < 1 + XFASTINT (target_idx))
9314 error ("Too few arguments for operation: %s", 9314 error ("Too few arguments for operation: %s",
9315 SDATA (SYMBOL_NAME (operation))); 9315 SDATA (SYMBOL_NAME (operation)));
9316 target = args[XINT (target_idx) + 1]; 9316 target = args[XFASTINT (target_idx) + 1];
9317 if (!(STRINGP (target) 9317 if (!(STRINGP (target)
9318 || (EQ (operation, Qinsert_file_contents) && CONSP (target) 9318 || (EQ (operation, Qinsert_file_contents) && CONSP (target)
9319 && STRINGP (XCAR (target)) && BUFFERP (XCDR (target))) 9319 && STRINGP (XCAR (target)) && BUFFERP (XCDR (target)))
9320 || (EQ (operation, Qopen_network_stream) && INTEGERP (target)))) 9320 || (EQ (operation, Qopen_network_stream) && INTEGERP (target))))
9321 error ("Invalid %dth argument", XINT (target_idx) + 1); 9321 error ("Invalid %dth argument", XFASTINT (target_idx) + 1);
9322 if (CONSP (target)) 9322 if (CONSP (target))
9323 target = XCAR (target); 9323 target = XCAR (target);
9324 9324
@@ -9375,9 +9375,9 @@ If multiple coding systems belong to the same category,
9375all but the first one are ignored. 9375all but the first one are ignored.
9376 9376
9377usage: (set-coding-system-priority &rest coding-systems) */) 9377usage: (set-coding-system-priority &rest coding-systems) */)
9378 (int nargs, Lisp_Object *args) 9378 (size_t nargs, Lisp_Object *args)
9379{ 9379{
9380 int i, j; 9380 size_t i, j;
9381 int changed[coding_category_max]; 9381 int changed[coding_category_max];
9382 enum coding_category priorities[coding_category_max]; 9382 enum coding_category priorities[coding_category_max];
9383 9383
@@ -9420,7 +9420,7 @@ usage: (set-coding-system-priority &rest coding-systems) */)
9420 9420
9421 /* Update `coding-category-list'. */ 9421 /* Update `coding-category-list'. */
9422 Vcoding_category_list = Qnil; 9422 Vcoding_category_list = Qnil;
9423 for (i = coding_category_max - 1; i >= 0; i--) 9423 for (i = coding_category_max; i-- > 0; )
9424 Vcoding_category_list 9424 Vcoding_category_list
9425 = Fcons (AREF (Vcoding_category_table, priorities[i]), 9425 = Fcons (AREF (Vcoding_category_table, priorities[i]),
9426 Vcoding_category_list); 9426 Vcoding_category_list);
@@ -9481,7 +9481,7 @@ DEFUN ("define-coding-system-internal", Fdefine_coding_system_internal,
9481 Sdefine_coding_system_internal, coding_arg_max, MANY, 0, 9481 Sdefine_coding_system_internal, coding_arg_max, MANY, 0,
9482 doc: /* For internal use only. 9482 doc: /* For internal use only.
9483usage: (define-coding-system-internal ...) */) 9483usage: (define-coding-system-internal ...) */)
9484 (int nargs, Lisp_Object *args) 9484 (size_t nargs, Lisp_Object *args)
9485{ 9485{
9486 Lisp_Object name; 9486 Lisp_Object name;
9487 Lisp_Object spec_vec; /* [ ATTRS ALIASE EOL_TYPE ] */ 9487 Lisp_Object spec_vec; /* [ ATTRS ALIASE EOL_TYPE ] */
diff --git a/src/composite.c b/src/composite.c
index 0b0602bf283..bc5644a4612 100644
--- a/src/composite.c
+++ b/src/composite.c
@@ -1115,7 +1115,7 @@ composition_compute_stop_pos (struct composition_it *cmp_it, EMACS_INT charpos,
1115 if (! NILP (val)) 1115 if (! NILP (val))
1116 { 1116 {
1117 Lisp_Object elt; 1117 Lisp_Object elt;
1118 int ridx, back, len; 1118 int ridx, back, blen;
1119 1119
1120 for (ridx = 0; CONSP (val); val = XCDR (val), ridx++) 1120 for (ridx = 0; CONSP (val); val = XCDR (val), ridx++)
1121 { 1121 {
@@ -1132,17 +1132,17 @@ composition_compute_stop_pos (struct composition_it *cmp_it, EMACS_INT charpos,
1132 bpos = (NILP (string) ? CHAR_TO_BYTE (cpos) 1132 bpos = (NILP (string) ? CHAR_TO_BYTE (cpos)
1133 : string_char_to_byte (string, cpos)); 1133 : string_char_to_byte (string, cpos));
1134 if (STRINGP (AREF (elt, 0))) 1134 if (STRINGP (AREF (elt, 0)))
1135 len = fast_looking_at (AREF (elt, 0), cpos, bpos, 1135 blen = fast_looking_at (AREF (elt, 0), cpos, bpos,
1136 start + 1, limit, string); 1136 start + 1, limit, string);
1137 else 1137 else
1138 len = 1; 1138 blen = 1;
1139 if (len > 0) 1139 if (blen > 0)
1140 { 1140 {
1141 /* Make CPOS point to the last character of 1141 /* Make CPOS point to the last character of
1142 match. Note that LEN is byte-length. */ 1142 match. Note that BLEN is byte-length. */
1143 if (len > 1) 1143 if (blen > 1)
1144 { 1144 {
1145 bpos += len; 1145 bpos += blen;
1146 if (NILP (string)) 1146 if (NILP (string))
1147 cpos = BYTE_TO_CHAR (bpos) - 1; 1147 cpos = BYTE_TO_CHAR (bpos) - 1;
1148 else 1148 else
@@ -1248,8 +1248,8 @@ composition_reseat_it (struct composition_it *cmp_it, EMACS_INT charpos, EMACS_I
1248 else if (w) 1248 else if (w)
1249 { 1249 {
1250 Lisp_Object lgstring = Qnil; 1250 Lisp_Object lgstring = Qnil;
1251 Lisp_Object val, elt, re; 1251 Lisp_Object val, elt;
1252 int len, i; 1252 int i;
1253 1253
1254 val = CHAR_TABLE_REF (Vcomposition_function_table, cmp_it->ch); 1254 val = CHAR_TABLE_REF (Vcomposition_function_table, cmp_it->ch);
1255 for (i = 0; i < cmp_it->rule_idx; i++, val = XCDR (val)); 1255 for (i = 0; i < cmp_it->rule_idx; i++, val = XCDR (val));
@@ -1364,7 +1364,7 @@ composition_reseat_it (struct composition_it *cmp_it, EMACS_INT charpos, EMACS_I
1364int 1364int
1365composition_update_it (struct composition_it *cmp_it, EMACS_INT charpos, EMACS_INT bytepos, Lisp_Object string) 1365composition_update_it (struct composition_it *cmp_it, EMACS_INT charpos, EMACS_INT bytepos, Lisp_Object string)
1366{ 1366{
1367 int i, c; 1367 int i, c IF_LINT (= 0);
1368 1368
1369 if (cmp_it->ch < 0) 1369 if (cmp_it->ch < 0)
1370 { 1370 {
@@ -1489,9 +1489,14 @@ find_automatic_composition (EMACS_INT pos, EMACS_INT limit, EMACS_INT *start, EM
1489 EMACS_INT head, tail, stop; 1489 EMACS_INT head, tail, stop;
1490 /* Limit to check a composition after POS. */ 1490 /* Limit to check a composition after POS. */
1491 EMACS_INT fore_check_limit; 1491 EMACS_INT fore_check_limit;
1492 struct position_record orig, cur, check, prev; 1492 struct position_record orig, cur;
1493
1494 /* FIXME: It's not obvious whether these two variables need initialization.
1495 If they do, please supply initial values.
1496 If not, please remove this comment. */
1497 struct position_record check IF_LINT (= {0}), prev IF_LINT (= {0});
1498
1493 Lisp_Object check_val, val, elt; 1499 Lisp_Object check_val, val, elt;
1494 int check_lookback;
1495 int c; 1500 int c;
1496 Lisp_Object window; 1501 Lisp_Object window;
1497 struct window *w; 1502 struct window *w;
@@ -1657,7 +1662,7 @@ find_automatic_composition (EMACS_INT pos, EMACS_INT limit, EMACS_INT *start, EM
1657EMACS_INT 1662EMACS_INT
1658composition_adjust_point (EMACS_INT last_pt, EMACS_INT new_pt) 1663composition_adjust_point (EMACS_INT last_pt, EMACS_INT new_pt)
1659{ 1664{
1660 EMACS_INT charpos, bytepos, startpos, beg, end, pos; 1665 EMACS_INT beg, end;
1661 Lisp_Object val; 1666 Lisp_Object val;
1662 int i; 1667 int i;
1663 1668
@@ -2032,4 +2037,3 @@ See also the documentation of `auto-composition-mode'. */);
2032 defsubr (&Sfind_composition_internal); 2037 defsubr (&Sfind_composition_internal);
2033 defsubr (&Scomposition_get_gstring); 2038 defsubr (&Scomposition_get_gstring);
2034} 2039}
2035
diff --git a/src/data.c b/src/data.c
index e5c485f5322..4b9d2ec0387 100644
--- a/src/data.c
+++ b/src/data.c
@@ -2476,13 +2476,13 @@ enum arithop
2476 Amin 2476 Amin
2477 }; 2477 };
2478 2478
2479static Lisp_Object float_arith_driver (double, int, enum arithop, 2479static Lisp_Object float_arith_driver (double, size_t, enum arithop,
2480 int, Lisp_Object *); 2480 size_t, Lisp_Object *);
2481static Lisp_Object 2481static Lisp_Object
2482arith_driver (enum arithop code, int nargs, register Lisp_Object *args) 2482arith_driver (enum arithop code, size_t nargs, register Lisp_Object *args)
2483{ 2483{
2484 register Lisp_Object val; 2484 register Lisp_Object val;
2485 register int argnum; 2485 register size_t argnum;
2486 register EMACS_INT accum = 0; 2486 register EMACS_INT accum = 0;
2487 register EMACS_INT next; 2487 register EMACS_INT next;
2488 2488
@@ -2564,7 +2564,8 @@ arith_driver (enum arithop code, int nargs, register Lisp_Object *args)
2564#define isnan(x) ((x) != (x)) 2564#define isnan(x) ((x) != (x))
2565 2565
2566static Lisp_Object 2566static Lisp_Object
2567float_arith_driver (double accum, register int argnum, enum arithop code, int nargs, register Lisp_Object *args) 2567float_arith_driver (double accum, register size_t argnum, enum arithop code,
2568 size_t nargs, register Lisp_Object *args)
2568{ 2569{
2569 register Lisp_Object val; 2570 register Lisp_Object val;
2570 double next; 2571 double next;
@@ -2626,7 +2627,7 @@ float_arith_driver (double accum, register int argnum, enum arithop code, int na
2626DEFUN ("+", Fplus, Splus, 0, MANY, 0, 2627DEFUN ("+", Fplus, Splus, 0, MANY, 0,
2627 doc: /* Return sum of any number of arguments, which are numbers or markers. 2628 doc: /* Return sum of any number of arguments, which are numbers or markers.
2628usage: (+ &rest NUMBERS-OR-MARKERS) */) 2629usage: (+ &rest NUMBERS-OR-MARKERS) */)
2629 (int nargs, Lisp_Object *args) 2630 (size_t nargs, Lisp_Object *args)
2630{ 2631{
2631 return arith_driver (Aadd, nargs, args); 2632 return arith_driver (Aadd, nargs, args);
2632} 2633}
@@ -2636,7 +2637,7 @@ DEFUN ("-", Fminus, Sminus, 0, MANY, 0,
2636With one arg, negates it. With more than one arg, 2637With one arg, negates it. With more than one arg,
2637subtracts all but the first from the first. 2638subtracts all but the first from the first.
2638usage: (- &optional NUMBER-OR-MARKER &rest MORE-NUMBERS-OR-MARKERS) */) 2639usage: (- &optional NUMBER-OR-MARKER &rest MORE-NUMBERS-OR-MARKERS) */)
2639 (int nargs, Lisp_Object *args) 2640 (size_t nargs, Lisp_Object *args)
2640{ 2641{
2641 return arith_driver (Asub, nargs, args); 2642 return arith_driver (Asub, nargs, args);
2642} 2643}
@@ -2644,7 +2645,7 @@ usage: (- &optional NUMBER-OR-MARKER &rest MORE-NUMBERS-OR-MARKERS) */)
2644DEFUN ("*", Ftimes, Stimes, 0, MANY, 0, 2645DEFUN ("*", Ftimes, Stimes, 0, MANY, 0,
2645 doc: /* Return product of any number of arguments, which are numbers or markers. 2646 doc: /* Return product of any number of arguments, which are numbers or markers.
2646usage: (* &rest NUMBERS-OR-MARKERS) */) 2647usage: (* &rest NUMBERS-OR-MARKERS) */)
2647 (int nargs, Lisp_Object *args) 2648 (size_t nargs, Lisp_Object *args)
2648{ 2649{
2649 return arith_driver (Amult, nargs, args); 2650 return arith_driver (Amult, nargs, args);
2650} 2651}
@@ -2653,9 +2654,9 @@ DEFUN ("/", Fquo, Squo, 2, MANY, 0,
2653 doc: /* Return first argument divided by all the remaining arguments. 2654 doc: /* Return first argument divided by all the remaining arguments.
2654The arguments must be numbers or markers. 2655The arguments must be numbers or markers.
2655usage: (/ DIVIDEND DIVISOR &rest DIVISORS) */) 2656usage: (/ DIVIDEND DIVISOR &rest DIVISORS) */)
2656 (int nargs, Lisp_Object *args) 2657 (size_t nargs, Lisp_Object *args)
2657{ 2658{
2658 int argnum; 2659 size_t argnum;
2659 for (argnum = 2; argnum < nargs; argnum++) 2660 for (argnum = 2; argnum < nargs; argnum++)
2660 if (FLOATP (args[argnum])) 2661 if (FLOATP (args[argnum]))
2661 return float_arith_driver (0, 0, Adiv, nargs, args); 2662 return float_arith_driver (0, 0, Adiv, nargs, args);
@@ -2737,7 +2738,7 @@ DEFUN ("max", Fmax, Smax, 1, MANY, 0,
2737 doc: /* Return largest of all the arguments (which must be numbers or markers). 2738 doc: /* Return largest of all the arguments (which must be numbers or markers).
2738The value is always a number; markers are converted to numbers. 2739The value is always a number; markers are converted to numbers.
2739usage: (max NUMBER-OR-MARKER &rest NUMBERS-OR-MARKERS) */) 2740usage: (max NUMBER-OR-MARKER &rest NUMBERS-OR-MARKERS) */)
2740 (int nargs, Lisp_Object *args) 2741 (size_t nargs, Lisp_Object *args)
2741{ 2742{
2742 return arith_driver (Amax, nargs, args); 2743 return arith_driver (Amax, nargs, args);
2743} 2744}
@@ -2746,7 +2747,7 @@ DEFUN ("min", Fmin, Smin, 1, MANY, 0,
2746 doc: /* Return smallest of all the arguments (which must be numbers or markers). 2747 doc: /* Return smallest of all the arguments (which must be numbers or markers).
2747The value is always a number; markers are converted to numbers. 2748The value is always a number; markers are converted to numbers.
2748usage: (min NUMBER-OR-MARKER &rest NUMBERS-OR-MARKERS) */) 2749usage: (min NUMBER-OR-MARKER &rest NUMBERS-OR-MARKERS) */)
2749 (int nargs, Lisp_Object *args) 2750 (size_t nargs, Lisp_Object *args)
2750{ 2751{
2751 return arith_driver (Amin, nargs, args); 2752 return arith_driver (Amin, nargs, args);
2752} 2753}
@@ -2755,7 +2756,7 @@ DEFUN ("logand", Flogand, Slogand, 0, MANY, 0,
2755 doc: /* Return bitwise-and of all the arguments. 2756 doc: /* Return bitwise-and of all the arguments.
2756Arguments may be integers, or markers converted to integers. 2757Arguments may be integers, or markers converted to integers.
2757usage: (logand &rest INTS-OR-MARKERS) */) 2758usage: (logand &rest INTS-OR-MARKERS) */)
2758 (int nargs, Lisp_Object *args) 2759 (size_t nargs, Lisp_Object *args)
2759{ 2760{
2760 return arith_driver (Alogand, nargs, args); 2761 return arith_driver (Alogand, nargs, args);
2761} 2762}
@@ -2764,7 +2765,7 @@ DEFUN ("logior", Flogior, Slogior, 0, MANY, 0,
2764 doc: /* Return bitwise-or of all the arguments. 2765 doc: /* Return bitwise-or of all the arguments.
2765Arguments may be integers, or markers converted to integers. 2766Arguments may be integers, or markers converted to integers.
2766usage: (logior &rest INTS-OR-MARKERS) */) 2767usage: (logior &rest INTS-OR-MARKERS) */)
2767 (int nargs, Lisp_Object *args) 2768 (size_t nargs, Lisp_Object *args)
2768{ 2769{
2769 return arith_driver (Alogior, nargs, args); 2770 return arith_driver (Alogior, nargs, args);
2770} 2771}
@@ -2773,7 +2774,7 @@ DEFUN ("logxor", Flogxor, Slogxor, 0, MANY, 0,
2773 doc: /* Return bitwise-exclusive-or of all the arguments. 2774 doc: /* Return bitwise-exclusive-or of all the arguments.
2774Arguments may be integers, or markers converted to integers. 2775Arguments may be integers, or markers converted to integers.
2775usage: (logxor &rest INTS-OR-MARKERS) */) 2776usage: (logxor &rest INTS-OR-MARKERS) */)
2776 (int nargs, Lisp_Object *args) 2777 (size_t nargs, Lisp_Object *args)
2777{ 2778{
2778 return arith_driver (Alogxor, nargs, args); 2779 return arith_driver (Alogxor, nargs, args);
2779} 2780}
@@ -3302,7 +3303,7 @@ syms_of_data (void)
3302 XSYMBOL (intern_c_string ("most-negative-fixnum"))->constant = 1; 3303 XSYMBOL (intern_c_string ("most-negative-fixnum"))->constant = 1;
3303} 3304}
3304 3305
3305static SIGTYPE 3306static void
3306arith_error (int signo) 3307arith_error (int signo)
3307{ 3308{
3308 sigsetmask (SIGEMPTYMASK); 3309 sigsetmask (SIGEMPTYMASK);
diff --git a/src/dbusbind.c b/src/dbusbind.c
index 2c8de20a4d4..8a6870555d0 100644
--- a/src/dbusbind.c
+++ b/src/dbusbind.c
@@ -1051,7 +1051,7 @@ object is returned instead of a list containing this single Lisp object.
1051 => "i686" 1051 => "i686"
1052 1052
1053usage: (dbus-call-method BUS SERVICE PATH INTERFACE METHOD &optional :timeout TIMEOUT &rest ARGS) */) 1053usage: (dbus-call-method BUS SERVICE PATH INTERFACE METHOD &optional :timeout TIMEOUT &rest ARGS) */)
1054 (int nargs, register Lisp_Object *args) 1054 (size_t nargs, register Lisp_Object *args)
1055{ 1055{
1056 Lisp_Object bus, service, path, interface, method; 1056 Lisp_Object bus, service, path, interface, method;
1057 Lisp_Object result; 1057 Lisp_Object result;
@@ -1063,7 +1063,7 @@ usage: (dbus-call-method BUS SERVICE PATH INTERFACE METHOD &optional :timeout TI
1063 DBusError derror; 1063 DBusError derror;
1064 unsigned int dtype; 1064 unsigned int dtype;
1065 int timeout = -1; 1065 int timeout = -1;
1066 int i = 5; 1066 size_t i = 5;
1067 char signature[DBUS_MAXIMUM_SIGNATURE_LENGTH]; 1067 char signature[DBUS_MAXIMUM_SIGNATURE_LENGTH];
1068 1068
1069 /* Check parameters. */ 1069 /* Check parameters. */
@@ -1116,7 +1116,7 @@ usage: (dbus-call-method BUS SERVICE PATH INTERFACE METHOD &optional :timeout TI
1116 { 1116 {
1117 XD_DEBUG_VALID_LISP_OBJECT_P (args[i]); 1117 XD_DEBUG_VALID_LISP_OBJECT_P (args[i]);
1118 XD_DEBUG_VALID_LISP_OBJECT_P (args[i+1]); 1118 XD_DEBUG_VALID_LISP_OBJECT_P (args[i+1]);
1119 XD_DEBUG_MESSAGE ("Parameter%d %s %s", i-4, 1119 XD_DEBUG_MESSAGE ("Parameter%lu %s %s", (unsigned long) (i-4),
1120 SDATA (format2 ("%s", args[i], Qnil)), 1120 SDATA (format2 ("%s", args[i], Qnil)),
1121 SDATA (format2 ("%s", args[i+1], Qnil))); 1121 SDATA (format2 ("%s", args[i+1], Qnil)));
1122 ++i; 1122 ++i;
@@ -1124,7 +1124,7 @@ usage: (dbus-call-method BUS SERVICE PATH INTERFACE METHOD &optional :timeout TI
1124 else 1124 else
1125 { 1125 {
1126 XD_DEBUG_VALID_LISP_OBJECT_P (args[i]); 1126 XD_DEBUG_VALID_LISP_OBJECT_P (args[i]);
1127 XD_DEBUG_MESSAGE ("Parameter%d %s", i-4, 1127 XD_DEBUG_MESSAGE ("Parameter%lu %s", (unsigned long) (i-4),
1128 SDATA (format2 ("%s", args[i], Qnil))); 1128 SDATA (format2 ("%s", args[i], Qnil)));
1129 } 1129 }
1130 1130
@@ -1233,7 +1233,7 @@ Example:
1233 -| i686 1233 -| i686
1234 1234
1235usage: (dbus-call-method-asynchronously BUS SERVICE PATH INTERFACE METHOD HANDLER &optional :timeout TIMEOUT &rest ARGS) */) 1235usage: (dbus-call-method-asynchronously BUS SERVICE PATH INTERFACE METHOD HANDLER &optional :timeout TIMEOUT &rest ARGS) */)
1236 (int nargs, register Lisp_Object *args) 1236 (size_t nargs, register Lisp_Object *args)
1237{ 1237{
1238 Lisp_Object bus, service, path, interface, method, handler; 1238 Lisp_Object bus, service, path, interface, method, handler;
1239 Lisp_Object result; 1239 Lisp_Object result;
@@ -1243,7 +1243,7 @@ usage: (dbus-call-method-asynchronously BUS SERVICE PATH INTERFACE METHOD HANDLE
1243 DBusMessageIter iter; 1243 DBusMessageIter iter;
1244 unsigned int dtype; 1244 unsigned int dtype;
1245 int timeout = -1; 1245 int timeout = -1;
1246 int i = 6; 1246 size_t i = 6;
1247 char signature[DBUS_MAXIMUM_SIGNATURE_LENGTH]; 1247 char signature[DBUS_MAXIMUM_SIGNATURE_LENGTH];
1248 1248
1249 /* Check parameters. */ 1249 /* Check parameters. */
@@ -1298,7 +1298,7 @@ usage: (dbus-call-method-asynchronously BUS SERVICE PATH INTERFACE METHOD HANDLE
1298 { 1298 {
1299 XD_DEBUG_VALID_LISP_OBJECT_P (args[i]); 1299 XD_DEBUG_VALID_LISP_OBJECT_P (args[i]);
1300 XD_DEBUG_VALID_LISP_OBJECT_P (args[i+1]); 1300 XD_DEBUG_VALID_LISP_OBJECT_P (args[i+1]);
1301 XD_DEBUG_MESSAGE ("Parameter%d %s %s", i-4, 1301 XD_DEBUG_MESSAGE ("Parameter%lu %s %s", (unsigned long) (i-4),
1302 SDATA (format2 ("%s", args[i], Qnil)), 1302 SDATA (format2 ("%s", args[i], Qnil)),
1303 SDATA (format2 ("%s", args[i+1], Qnil))); 1303 SDATA (format2 ("%s", args[i+1], Qnil)));
1304 ++i; 1304 ++i;
@@ -1306,7 +1306,7 @@ usage: (dbus-call-method-asynchronously BUS SERVICE PATH INTERFACE METHOD HANDLE
1306 else 1306 else
1307 { 1307 {
1308 XD_DEBUG_VALID_LISP_OBJECT_P (args[i]); 1308 XD_DEBUG_VALID_LISP_OBJECT_P (args[i]);
1309 XD_DEBUG_MESSAGE ("Parameter%d %s", i-4, 1309 XD_DEBUG_MESSAGE ("Parameter%lu %s", (unsigned long) (i - 4),
1310 SDATA (format2 ("%s", args[i], Qnil))); 1310 SDATA (format2 ("%s", args[i], Qnil)));
1311 } 1311 }
1312 1312
@@ -1357,7 +1357,7 @@ DEFUN ("dbus-method-return-internal", Fdbus_method_return_internal,
1357This is an internal function, it shall not be used outside dbus.el. 1357This is an internal function, it shall not be used outside dbus.el.
1358 1358
1359usage: (dbus-method-return-internal BUS SERIAL SERVICE &rest ARGS) */) 1359usage: (dbus-method-return-internal BUS SERIAL SERVICE &rest ARGS) */)
1360 (int nargs, register Lisp_Object *args) 1360 (size_t nargs, register Lisp_Object *args)
1361{ 1361{
1362 Lisp_Object bus, serial, service; 1362 Lisp_Object bus, serial, service;
1363 struct gcpro gcpro1, gcpro2, gcpro3; 1363 struct gcpro gcpro1, gcpro2, gcpro3;
@@ -1365,7 +1365,7 @@ usage: (dbus-method-return-internal BUS SERIAL SERVICE &rest ARGS) */)
1365 DBusMessage *dmessage; 1365 DBusMessage *dmessage;
1366 DBusMessageIter iter; 1366 DBusMessageIter iter;
1367 unsigned int dtype; 1367 unsigned int dtype;
1368 int i; 1368 size_t i;
1369 char signature[DBUS_MAXIMUM_SIGNATURE_LENGTH]; 1369 char signature[DBUS_MAXIMUM_SIGNATURE_LENGTH];
1370 1370
1371 /* Check parameters. */ 1371 /* Check parameters. */
@@ -1405,7 +1405,7 @@ usage: (dbus-method-return-internal BUS SERIAL SERVICE &rest ARGS) */)
1405 { 1405 {
1406 XD_DEBUG_VALID_LISP_OBJECT_P (args[i]); 1406 XD_DEBUG_VALID_LISP_OBJECT_P (args[i]);
1407 XD_DEBUG_VALID_LISP_OBJECT_P (args[i+1]); 1407 XD_DEBUG_VALID_LISP_OBJECT_P (args[i+1]);
1408 XD_DEBUG_MESSAGE ("Parameter%d %s %s", i-2, 1408 XD_DEBUG_MESSAGE ("Parameter%lu %s %s", (unsigned long) (i-2),
1409 SDATA (format2 ("%s", args[i], Qnil)), 1409 SDATA (format2 ("%s", args[i], Qnil)),
1410 SDATA (format2 ("%s", args[i+1], Qnil))); 1410 SDATA (format2 ("%s", args[i+1], Qnil)));
1411 ++i; 1411 ++i;
@@ -1413,7 +1413,7 @@ usage: (dbus-method-return-internal BUS SERIAL SERVICE &rest ARGS) */)
1413 else 1413 else
1414 { 1414 {
1415 XD_DEBUG_VALID_LISP_OBJECT_P (args[i]); 1415 XD_DEBUG_VALID_LISP_OBJECT_P (args[i]);
1416 XD_DEBUG_MESSAGE ("Parameter%d %s", i-2, 1416 XD_DEBUG_MESSAGE ("Parameter%lu %s", (unsigned long) (i-2),
1417 SDATA (format2 ("%s", args[i], Qnil))); 1417 SDATA (format2 ("%s", args[i], Qnil)));
1418 } 1418 }
1419 1419
@@ -1445,7 +1445,7 @@ DEFUN ("dbus-method-error-internal", Fdbus_method_error_internal,
1445This is an internal function, it shall not be used outside dbus.el. 1445This is an internal function, it shall not be used outside dbus.el.
1446 1446
1447usage: (dbus-method-error-internal BUS SERIAL SERVICE &rest ARGS) */) 1447usage: (dbus-method-error-internal BUS SERIAL SERVICE &rest ARGS) */)
1448 (int nargs, register Lisp_Object *args) 1448 (size_t nargs, register Lisp_Object *args)
1449{ 1449{
1450 Lisp_Object bus, serial, service; 1450 Lisp_Object bus, serial, service;
1451 struct gcpro gcpro1, gcpro2, gcpro3; 1451 struct gcpro gcpro1, gcpro2, gcpro3;
@@ -1453,7 +1453,7 @@ usage: (dbus-method-error-internal BUS SERIAL SERVICE &rest ARGS) */)
1453 DBusMessage *dmessage; 1453 DBusMessage *dmessage;
1454 DBusMessageIter iter; 1454 DBusMessageIter iter;
1455 unsigned int dtype; 1455 unsigned int dtype;
1456 int i; 1456 size_t i;
1457 char signature[DBUS_MAXIMUM_SIGNATURE_LENGTH]; 1457 char signature[DBUS_MAXIMUM_SIGNATURE_LENGTH];
1458 1458
1459 /* Check parameters. */ 1459 /* Check parameters. */
@@ -1494,7 +1494,7 @@ usage: (dbus-method-error-internal BUS SERIAL SERVICE &rest ARGS) */)
1494 { 1494 {
1495 XD_DEBUG_VALID_LISP_OBJECT_P (args[i]); 1495 XD_DEBUG_VALID_LISP_OBJECT_P (args[i]);
1496 XD_DEBUG_VALID_LISP_OBJECT_P (args[i+1]); 1496 XD_DEBUG_VALID_LISP_OBJECT_P (args[i+1]);
1497 XD_DEBUG_MESSAGE ("Parameter%d %s %s", i-2, 1497 XD_DEBUG_MESSAGE ("Parameter%lu %s %s", (unsigned long) (i-2),
1498 SDATA (format2 ("%s", args[i], Qnil)), 1498 SDATA (format2 ("%s", args[i], Qnil)),
1499 SDATA (format2 ("%s", args[i+1], Qnil))); 1499 SDATA (format2 ("%s", args[i+1], Qnil)));
1500 ++i; 1500 ++i;
@@ -1502,7 +1502,7 @@ usage: (dbus-method-error-internal BUS SERIAL SERVICE &rest ARGS) */)
1502 else 1502 else
1503 { 1503 {
1504 XD_DEBUG_VALID_LISP_OBJECT_P (args[i]); 1504 XD_DEBUG_VALID_LISP_OBJECT_P (args[i]);
1505 XD_DEBUG_MESSAGE ("Parameter%d %s", i-2, 1505 XD_DEBUG_MESSAGE ("Parameter%lu %s", (unsigned long) (i-2),
1506 SDATA (format2 ("%s", args[i], Qnil))); 1506 SDATA (format2 ("%s", args[i], Qnil)));
1507 } 1507 }
1508 1508
@@ -1557,7 +1557,7 @@ Example:
1557 "org.gnu.Emacs.FileManager" "FileModified" "/home/albinus/.emacs") 1557 "org.gnu.Emacs.FileManager" "FileModified" "/home/albinus/.emacs")
1558 1558
1559usage: (dbus-send-signal BUS SERVICE PATH INTERFACE SIGNAL &rest ARGS) */) 1559usage: (dbus-send-signal BUS SERVICE PATH INTERFACE SIGNAL &rest ARGS) */)
1560 (int nargs, register Lisp_Object *args) 1560 (size_t nargs, register Lisp_Object *args)
1561{ 1561{
1562 Lisp_Object bus, service, path, interface, signal; 1562 Lisp_Object bus, service, path, interface, signal;
1563 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5; 1563 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5;
@@ -1565,7 +1565,7 @@ usage: (dbus-send-signal BUS SERVICE PATH INTERFACE SIGNAL &rest ARGS) */)
1565 DBusMessage *dmessage; 1565 DBusMessage *dmessage;
1566 DBusMessageIter iter; 1566 DBusMessageIter iter;
1567 unsigned int dtype; 1567 unsigned int dtype;
1568 int i; 1568 size_t i;
1569 char signature[DBUS_MAXIMUM_SIGNATURE_LENGTH]; 1569 char signature[DBUS_MAXIMUM_SIGNATURE_LENGTH];
1570 1570
1571 /* Check parameters. */ 1571 /* Check parameters. */
@@ -1609,7 +1609,7 @@ usage: (dbus-send-signal BUS SERVICE PATH INTERFACE SIGNAL &rest ARGS) */)
1609 { 1609 {
1610 XD_DEBUG_VALID_LISP_OBJECT_P (args[i]); 1610 XD_DEBUG_VALID_LISP_OBJECT_P (args[i]);
1611 XD_DEBUG_VALID_LISP_OBJECT_P (args[i+1]); 1611 XD_DEBUG_VALID_LISP_OBJECT_P (args[i+1]);
1612 XD_DEBUG_MESSAGE ("Parameter%d %s %s", i-4, 1612 XD_DEBUG_MESSAGE ("Parameter%lu %s %s", (unsigned long) (i-4),
1613 SDATA (format2 ("%s", args[i], Qnil)), 1613 SDATA (format2 ("%s", args[i], Qnil)),
1614 SDATA (format2 ("%s", args[i+1], Qnil))); 1614 SDATA (format2 ("%s", args[i+1], Qnil)));
1615 ++i; 1615 ++i;
@@ -1617,7 +1617,7 @@ usage: (dbus-send-signal BUS SERVICE PATH INTERFACE SIGNAL &rest ARGS) */)
1617 else 1617 else
1618 { 1618 {
1619 XD_DEBUG_VALID_LISP_OBJECT_P (args[i]); 1619 XD_DEBUG_VALID_LISP_OBJECT_P (args[i]);
1620 XD_DEBUG_MESSAGE ("Parameter%d %s", i-4, 1620 XD_DEBUG_MESSAGE ("Parameter%lu %s", (unsigned long) (i-4),
1621 SDATA (format2 ("%s", args[i], Qnil))); 1621 SDATA (format2 ("%s", args[i], Qnil)));
1622 } 1622 }
1623 1623
@@ -1885,11 +1885,11 @@ Example:
1885 => :already-owner. 1885 => :already-owner.
1886 1886
1887usage: (dbus-register-service BUS SERVICE &rest FLAGS) */) 1887usage: (dbus-register-service BUS SERVICE &rest FLAGS) */)
1888 (int nargs, register Lisp_Object *args) 1888 (size_t nargs, register Lisp_Object *args)
1889{ 1889{
1890 Lisp_Object bus, service; 1890 Lisp_Object bus, service;
1891 DBusConnection *connection; 1891 DBusConnection *connection;
1892 unsigned int i; 1892 size_t i;
1893 unsigned int value; 1893 unsigned int value;
1894 unsigned int flags = 0; 1894 unsigned int flags = 0;
1895 int result; 1895 int result;
@@ -1985,13 +1985,13 @@ INTERFACE, SIGNAL and HANDLER must not be nil. Example:
1985`dbus-unregister-object' for removing the registration. 1985`dbus-unregister-object' for removing the registration.
1986 1986
1987usage: (dbus-register-signal BUS SERVICE PATH INTERFACE SIGNAL HANDLER &rest ARGS) */) 1987usage: (dbus-register-signal BUS SERVICE PATH INTERFACE SIGNAL HANDLER &rest ARGS) */)
1988 (int nargs, register Lisp_Object *args) 1988 (size_t nargs, register Lisp_Object *args)
1989{ 1989{
1990 Lisp_Object bus, service, path, interface, signal, handler; 1990 Lisp_Object bus, service, path, interface, signal, handler;
1991 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5, gcpro6; 1991 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5, gcpro6;
1992 Lisp_Object uname, key, key1, value; 1992 Lisp_Object uname, key, key1, value;
1993 DBusConnection *connection; 1993 DBusConnection *connection;
1994 int i; 1994 size_t i;
1995 char rule[DBUS_MAXIMUM_MATCH_RULE_LENGTH]; 1995 char rule[DBUS_MAXIMUM_MATCH_RULE_LENGTH];
1996 char x[DBUS_MAXIMUM_MATCH_RULE_LENGTH]; 1996 char x[DBUS_MAXIMUM_MATCH_RULE_LENGTH];
1997 DBusError derror; 1997 DBusError derror;
@@ -2061,7 +2061,8 @@ usage: (dbus-register-signal BUS SERVICE PATH INTERFACE SIGNAL HANDLER &rest ARG
2061 if (!NILP (args[i])) 2061 if (!NILP (args[i]))
2062 { 2062 {
2063 CHECK_STRING (args[i]); 2063 CHECK_STRING (args[i]);
2064 sprintf (x, ",arg%d='%s'", i-6, SDATA (args[i])); 2064 sprintf (x, ",arg%lu='%s'", (unsigned long) (i-6),
2065 SDATA (args[i]));
2065 strcat (rule, x); 2066 strcat (rule, x);
2066 } 2067 }
2067 2068
diff --git a/src/deps.mk b/src/deps.mk
index 35754dfa7de..d84e80dca44 100644
--- a/src/deps.mk
+++ b/src/deps.mk
@@ -65,7 +65,7 @@ coding.o: coding.c coding.h ccl.h buffer.h character.h charset.h composite.h \
65 window.h dispextern.h msdos.h frame.h termhooks.h \ 65 window.h dispextern.h msdos.h frame.h termhooks.h \
66 lisp.h globals.h $(config_h) 66 lisp.h globals.h $(config_h)
67cm.o: cm.c frame.h cm.h termhooks.h termchar.h dispextern.h msdos.h \ 67cm.o: cm.c frame.h cm.h termhooks.h termchar.h dispextern.h msdos.h \
68 lisp.h globals.h $(config_h) 68 tparam.h lisp.h globals.h $(config_h)
69cmds.o: cmds.c syntax.h buffer.h character.h commands.h window.h lisp.h \ 69cmds.o: cmds.c syntax.h buffer.h character.h commands.h window.h lisp.h \
70 globals.h $(config_h) msdos.h dispextern.h keyboard.h keymap.h systime.h \ 70 globals.h $(config_h) msdos.h dispextern.h keyboard.h keymap.h systime.h \
71 coding.h frame.h composite.h 71 coding.h frame.h composite.h
@@ -196,7 +196,7 @@ termcap.o: termcap.c lisp.h tparam.h msdos.h $(config_h)
196terminal.o: terminal.c frame.h termchar.h termhooks.h charset.h coding.h \ 196terminal.o: terminal.c frame.h termchar.h termhooks.h charset.h coding.h \
197 keyboard.h lisp.h globals.h $(config_h) dispextern.h composite.h systime.h \ 197 keyboard.h lisp.h globals.h $(config_h) dispextern.h composite.h systime.h \
198 msdos.h 198 msdos.h
199terminfo.o: terminfo.c lisp.h globals.h $(config_h) 199terminfo.o: terminfo.c tparam.h lisp.h globals.h $(config_h)
200tparam.o: tparam.c tparam.h lisp.h $(config_h) 200tparam.o: tparam.c tparam.h lisp.h $(config_h)
201undo.o: undo.c buffer.h commands.h window.h dispextern.h msdos.h \ 201undo.o: undo.c buffer.h commands.h window.h dispextern.h msdos.h \
202 lisp.h globals.h $(config_h) 202 lisp.h globals.h $(config_h)
diff --git a/src/dispextern.h b/src/dispextern.h
index 9843dfd1fcd..17a9bc39fb2 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -662,7 +662,7 @@ struct glyph_matrix
662 line. */ 662 line. */
663 unsigned header_line_p : 1; 663 unsigned header_line_p : 1;
664 664
665#ifdef GLYPH_DEBUG 665#if GLYPH_DEBUG
666 /* A string identifying the method used to display the matrix. */ 666 /* A string identifying the method used to display the matrix. */
667 char method[512]; 667 char method[512];
668#endif 668#endif
@@ -2953,8 +2953,6 @@ extern int bidi_mirror_char (int);
2953struct glyph_row *row_containing_pos (struct window *, EMACS_INT, 2953struct glyph_row *row_containing_pos (struct window *, EMACS_INT,
2954 struct glyph_row *, 2954 struct glyph_row *,
2955 struct glyph_row *, int); 2955 struct glyph_row *, int);
2956EMACS_INT string_buffer_position (struct window *, Lisp_Object,
2957 EMACS_INT);
2958int line_bottom_y (struct it *); 2956int line_bottom_y (struct it *);
2959int display_prop_intangible_p (Lisp_Object); 2957int display_prop_intangible_p (Lisp_Object);
2960void resize_echo_area_exactly (void); 2958void resize_echo_area_exactly (void);
diff --git a/src/dispnew.c b/src/dispnew.c
index 1408bea2fc6..3a78845fa56 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -1297,13 +1297,11 @@ line_draw_cost (struct glyph_matrix *matrix, int vpos)
1297 1297
1298 1298
1299/* Test two glyph rows A and B for equality. Value is non-zero if A 1299/* Test two glyph rows A and B for equality. Value is non-zero if A
1300 and B have equal contents. W is the window to which the glyphs 1300 and B have equal contents. MOUSE_FACE_P non-zero means compare the
1301 rows A and B belong. It is needed here to test for partial row 1301 mouse_face_p flags of A and B, too. */
1302 visibility. MOUSE_FACE_P non-zero means compare the mouse_face_p
1303 flags of A and B, too. */
1304 1302
1305static INLINE int 1303static INLINE int
1306row_equal_p (struct window *w, struct glyph_row *a, struct glyph_row *b, int mouse_face_p) 1304row_equal_p (struct glyph_row *a, struct glyph_row *b, int mouse_face_p)
1307{ 1305{
1308 if (a == b) 1306 if (a == b)
1309 return 1; 1307 return 1;
@@ -3592,7 +3590,10 @@ update_window (struct window *w, int force_p)
3592 struct glyph_row *row, *end; 3590 struct glyph_row *row, *end;
3593 struct glyph_row *mode_line_row; 3591 struct glyph_row *mode_line_row;
3594 struct glyph_row *header_line_row; 3592 struct glyph_row *header_line_row;
3595 int yb, changed_p = 0, mouse_face_overwritten_p = 0, n_updated; 3593 int yb, changed_p = 0, mouse_face_overwritten_p = 0;
3594#if ! PERIODIC_PREEMPTION_CHECKING
3595 int n_updated = 0;
3596#endif
3596 3597
3597 rif->update_window_begin_hook (w); 3598 rif->update_window_begin_hook (w);
3598 yb = window_text_bottom_y (w); 3599 yb = window_text_bottom_y (w);
@@ -3645,7 +3646,7 @@ update_window (struct window *w, int force_p)
3645 } 3646 }
3646 3647
3647 /* Update the rest of the lines. */ 3648 /* Update the rest of the lines. */
3648 for (n_updated = 0; row < end && (force_p || !input_pending); ++row) 3649 for (; row < end && (force_p || !input_pending); ++row)
3649 if (row->enabled_p) 3650 if (row->enabled_p)
3650 { 3651 {
3651 int vpos = MATRIX_ROW_VPOS (row, desired_matrix); 3652 int vpos = MATRIX_ROW_VPOS (row, desired_matrix);
@@ -4251,17 +4252,16 @@ static int runs_size;
4251 4252
4252static struct run **runs; 4253static struct run **runs;
4253 4254
4254/* Add glyph row ROW to the scrolling hash table during the scrolling 4255/* Add glyph row ROW to the scrolling hash table. */
4255 of window W. */
4256 4256
4257static INLINE struct row_entry * 4257static INLINE struct row_entry *
4258add_row_entry (struct window *w, struct glyph_row *row) 4258add_row_entry (struct glyph_row *row)
4259{ 4259{
4260 struct row_entry *entry; 4260 struct row_entry *entry;
4261 int i = row->hash % row_table_size; 4261 int i = row->hash % row_table_size;
4262 4262
4263 entry = row_table[i]; 4263 entry = row_table[i];
4264 while (entry && !row_equal_p (w, entry->row, row, 1)) 4264 while (entry && !row_equal_p (entry->row, row, 1))
4265 entry = entry->next; 4265 entry = entry->next;
4266 4266
4267 if (entry == NULL) 4267 if (entry == NULL)
@@ -4328,7 +4328,7 @@ scrolling_window (struct window *w, int header_line_p)
4328 && c->y == d->y 4328 && c->y == d->y
4329 && MATRIX_ROW_BOTTOM_Y (c) <= yb 4329 && MATRIX_ROW_BOTTOM_Y (c) <= yb
4330 && MATRIX_ROW_BOTTOM_Y (d) <= yb 4330 && MATRIX_ROW_BOTTOM_Y (d) <= yb
4331 && row_equal_p (w, c, d, 1)) 4331 && row_equal_p (c, d, 1))
4332 { 4332 {
4333 assign_row (c, d); 4333 assign_row (c, d);
4334 d->enabled_p = 0; 4334 d->enabled_p = 0;
@@ -4381,8 +4381,7 @@ scrolling_window (struct window *w, int header_line_p)
4381 && (MATRIX_ROW (current_matrix, i - 1)->y 4381 && (MATRIX_ROW (current_matrix, i - 1)->y
4382 == MATRIX_ROW (desired_matrix, j - 1)->y) 4382 == MATRIX_ROW (desired_matrix, j - 1)->y)
4383 && !MATRIX_ROW (desired_matrix, j - 1)->redraw_fringe_bitmaps_p 4383 && !MATRIX_ROW (desired_matrix, j - 1)->redraw_fringe_bitmaps_p
4384 && row_equal_p (w, 4384 && row_equal_p (MATRIX_ROW (desired_matrix, i - 1),
4385 MATRIX_ROW (desired_matrix, i - 1),
4386 MATRIX_ROW (current_matrix, j - 1), 1)) 4385 MATRIX_ROW (current_matrix, j - 1), 1))
4387 --i, --j; 4386 --i, --j;
4388 last_new = i; 4387 last_new = i;
@@ -4443,7 +4442,7 @@ scrolling_window (struct window *w, int header_line_p)
4443 { 4442 {
4444 if (MATRIX_ROW (current_matrix, i)->enabled_p) 4443 if (MATRIX_ROW (current_matrix, i)->enabled_p)
4445 { 4444 {
4446 entry = add_row_entry (w, MATRIX_ROW (current_matrix, i)); 4445 entry = add_row_entry (MATRIX_ROW (current_matrix, i));
4447 old_lines[i] = entry; 4446 old_lines[i] = entry;
4448 ++entry->old_uses; 4447 ++entry->old_uses;
4449 } 4448 }
@@ -4454,7 +4453,7 @@ scrolling_window (struct window *w, int header_line_p)
4454 for (i = first_new; i < last_new; ++i) 4453 for (i = first_new; i < last_new; ++i)
4455 { 4454 {
4456 xassert (MATRIX_ROW_ENABLED_P (desired_matrix, i)); 4455 xassert (MATRIX_ROW_ENABLED_P (desired_matrix, i));
4457 entry = add_row_entry (w, MATRIX_ROW (desired_matrix, i)); 4456 entry = add_row_entry (MATRIX_ROW (desired_matrix, i));
4458 ++entry->new_uses; 4457 ++entry->new_uses;
4459 entry->new_line_number = i; 4458 entry->new_line_number = i;
4460 new_lines[i] = entry; 4459 new_lines[i] = entry;
@@ -5570,7 +5569,7 @@ marginal_area_string (struct window *w, enum window_part part,
5570 5569
5571#ifdef SIGWINCH 5570#ifdef SIGWINCH
5572 5571
5573static SIGTYPE 5572static void
5574window_change_signal (int signalnum) /* If we don't have an argument, */ 5573window_change_signal (int signalnum) /* If we don't have an argument, */
5575 /* some compilers complain in signal calls. */ 5574 /* some compilers complain in signal calls. */
5576{ 5575{
diff --git a/src/editfns.c b/src/editfns.c
index 1f98ff040b3..d0f1df694d5 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -101,7 +101,7 @@ static void general_insert_function (void (*) (const char *, EMACS_INT),
101 void (*) (Lisp_Object, EMACS_INT, 101 void (*) (Lisp_Object, EMACS_INT,
102 EMACS_INT, EMACS_INT, 102 EMACS_INT, EMACS_INT,
103 EMACS_INT, int), 103 EMACS_INT, int),
104 int, int, Lisp_Object *); 104 int, size_t, Lisp_Object *);
105static Lisp_Object subst_char_in_region_unwind (Lisp_Object); 105static Lisp_Object subst_char_in_region_unwind (Lisp_Object);
106static Lisp_Object subst_char_in_region_unwind_1 (Lisp_Object); 106static Lisp_Object subst_char_in_region_unwind_1 (Lisp_Object);
107static void transpose_markers (EMACS_INT, EMACS_INT, EMACS_INT, EMACS_INT, 107static void transpose_markers (EMACS_INT, EMACS_INT, EMACS_INT, EMACS_INT,
@@ -928,18 +928,21 @@ save_excursion_restore (Lisp_Object info)
928 tem1 = BVAR (current_buffer, mark_active); 928 tem1 = BVAR (current_buffer, mark_active);
929 BVAR (current_buffer, mark_active) = tem; 929 BVAR (current_buffer, mark_active) = tem;
930 930
931 if (!NILP (Vrun_hooks)) 931 /* If mark is active now, and either was not active
932 or was at a different place, run the activate hook. */
933 if (! NILP (tem))
932 { 934 {
933 /* If mark is active now, and either was not active 935 if (! EQ (omark, nmark))
934 or was at a different place, run the activate hook. */ 936 {
935 if (! NILP (BVAR (current_buffer, mark_active))) 937 tem = intern ("activate-mark-hook");
936 { 938 Frun_hooks (1, &tem);
937 if (! EQ (omark, nmark)) 939 }
938 call1 (Vrun_hooks, intern ("activate-mark-hook")); 940 }
939 } 941 /* If mark has ceased to be active, run deactivate hook. */
940 /* If mark has ceased to be active, run deactivate hook. */ 942 else if (! NILP (tem1))
941 else if (! NILP (tem1)) 943 {
942 call1 (Vrun_hooks, intern ("deactivate-mark-hook")); 944 tem = intern ("deactivate-mark-hook");
945 Frun_hooks (1, &tem);
943 } 946 }
944 947
945 /* If buffer was visible in a window, and a different window was 948 /* If buffer was visible in a window, and a different window was
@@ -1868,7 +1871,7 @@ Years before 1970 are not guaranteed to work. On some systems,
1868year values as low as 1901 do work. 1871year values as low as 1901 do work.
1869 1872
1870usage: (encode-time SECOND MINUTE HOUR DAY MONTH YEAR &optional ZONE) */) 1873usage: (encode-time SECOND MINUTE HOUR DAY MONTH YEAR &optional ZONE) */)
1871 (int nargs, register Lisp_Object *args) 1874 (size_t nargs, register Lisp_Object *args)
1872{ 1875{
1873 time_t value; 1876 time_t value;
1874 struct tm tm; 1877 struct tm tm;
@@ -2204,9 +2207,9 @@ general_insert_function (void (*insert_func)
2204 void (*insert_from_string_func) 2207 void (*insert_from_string_func)
2205 (Lisp_Object, EMACS_INT, EMACS_INT, 2208 (Lisp_Object, EMACS_INT, EMACS_INT,
2206 EMACS_INT, EMACS_INT, int), 2209 EMACS_INT, EMACS_INT, int),
2207 int inherit, int nargs, Lisp_Object *args) 2210 int inherit, size_t nargs, Lisp_Object *args)
2208{ 2211{
2209 register int argnum; 2212 register size_t argnum;
2210 register Lisp_Object val; 2213 register Lisp_Object val;
2211 2214
2212 for (argnum = 0; argnum < nargs; argnum++) 2215 for (argnum = 0; argnum < nargs; argnum++)
@@ -2223,7 +2226,7 @@ general_insert_function (void (*insert_func)
2223 { 2226 {
2224 str[0] = (ASCII_CHAR_P (XINT (val)) 2227 str[0] = (ASCII_CHAR_P (XINT (val))
2225 ? XINT (val) 2228 ? XINT (val)
2226 : multibyte_char_to_unibyte (XINT (val), Qnil)); 2229 : multibyte_char_to_unibyte (XINT (val)));
2227 len = 1; 2230 len = 1;
2228 } 2231 }
2229 (*insert_func) ((char *) str, len); 2232 (*insert_func) ((char *) str, len);
@@ -2269,7 +2272,7 @@ buffer; to accomplish this, apply `string-as-multibyte' to the string
2269and insert the result. 2272and insert the result.
2270 2273
2271usage: (insert &rest ARGS) */) 2274usage: (insert &rest ARGS) */)
2272 (int nargs, register Lisp_Object *args) 2275 (size_t nargs, register Lisp_Object *args)
2273{ 2276{
2274 general_insert_function (insert, insert_from_string, 0, nargs, args); 2277 general_insert_function (insert, insert_from_string, 0, nargs, args);
2275 return Qnil; 2278 return Qnil;
@@ -2288,7 +2291,7 @@ If the current buffer is unibyte, multibyte strings are converted
2288to unibyte for insertion. 2291to unibyte for insertion.
2289 2292
2290usage: (insert-and-inherit &rest ARGS) */) 2293usage: (insert-and-inherit &rest ARGS) */)
2291 (int nargs, register Lisp_Object *args) 2294 (size_t nargs, register Lisp_Object *args)
2292{ 2295{
2293 general_insert_function (insert_and_inherit, insert_from_string, 1, 2296 general_insert_function (insert_and_inherit, insert_from_string, 1,
2294 nargs, args); 2297 nargs, args);
@@ -2305,7 +2308,7 @@ If the current buffer is unibyte, multibyte strings are converted
2305to unibyte for insertion. 2308to unibyte for insertion.
2306 2309
2307usage: (insert-before-markers &rest ARGS) */) 2310usage: (insert-before-markers &rest ARGS) */)
2308 (int nargs, register Lisp_Object *args) 2311 (size_t nargs, register Lisp_Object *args)
2309{ 2312{
2310 general_insert_function (insert_before_markers, 2313 general_insert_function (insert_before_markers,
2311 insert_from_string_before_markers, 0, 2314 insert_from_string_before_markers, 0,
@@ -2324,7 +2327,7 @@ If the current buffer is unibyte, multibyte strings are converted
2324to unibyte for insertion. 2327to unibyte for insertion.
2325 2328
2326usage: (insert-before-markers-and-inherit &rest ARGS) */) 2329usage: (insert-before-markers-and-inherit &rest ARGS) */)
2327 (int nargs, register Lisp_Object *args) 2330 (size_t nargs, register Lisp_Object *args)
2328{ 2331{
2329 general_insert_function (insert_before_markers_and_inherit, 2332 general_insert_function (insert_before_markers_and_inherit,
2330 insert_from_string_before_markers, 1, 2333 insert_from_string_before_markers, 1,
@@ -3396,7 +3399,7 @@ any existing message; this lets the minibuffer contents show. See
3396also `current-message'. 3399also `current-message'.
3397 3400
3398usage: (message FORMAT-STRING &rest ARGS) */) 3401usage: (message FORMAT-STRING &rest ARGS) */)
3399 (int nargs, Lisp_Object *args) 3402 (size_t nargs, Lisp_Object *args)
3400{ 3403{
3401 if (NILP (args[0]) 3404 if (NILP (args[0])
3402 || (STRINGP (args[0]) 3405 || (STRINGP (args[0])
@@ -3424,7 +3427,7 @@ If the first argument is nil or the empty string, clear any existing
3424message; let the minibuffer contents show. 3427message; let the minibuffer contents show.
3425 3428
3426usage: (message-box FORMAT-STRING &rest ARGS) */) 3429usage: (message-box FORMAT-STRING &rest ARGS) */)
3427 (int nargs, Lisp_Object *args) 3430 (size_t nargs, Lisp_Object *args)
3428{ 3431{
3429 if (NILP (args[0])) 3432 if (NILP (args[0]))
3430 { 3433 {
@@ -3441,12 +3444,12 @@ usage: (message-box FORMAT-STRING &rest ARGS) */)
3441 if (FRAME_WINDOW_P (XFRAME (selected_frame)) 3444 if (FRAME_WINDOW_P (XFRAME (selected_frame))
3442 || FRAME_MSDOS_P (XFRAME (selected_frame))) 3445 || FRAME_MSDOS_P (XFRAME (selected_frame)))
3443 { 3446 {
3444 Lisp_Object pane, menu, obj; 3447 Lisp_Object pane, menu;
3445 struct gcpro gcpro1; 3448 struct gcpro gcpro1;
3446 pane = Fcons (Fcons (build_string ("OK"), Qt), Qnil); 3449 pane = Fcons (Fcons (build_string ("OK"), Qt), Qnil);
3447 GCPRO1 (pane); 3450 GCPRO1 (pane);
3448 menu = Fcons (val, pane); 3451 menu = Fcons (val, pane);
3449 obj = Fx_popup_dialog (Qt, menu, Qt); 3452 Fx_popup_dialog (Qt, menu, Qt);
3450 UNGCPRO; 3453 UNGCPRO;
3451 return val; 3454 return val;
3452 } 3455 }
@@ -3481,7 +3484,7 @@ If the first argument is nil or the empty string, clear any existing
3481message; let the minibuffer contents show. 3484message; let the minibuffer contents show.
3482 3485
3483usage: (message-or-box FORMAT-STRING &rest ARGS) */) 3486usage: (message-or-box FORMAT-STRING &rest ARGS) */)
3484 (int nargs, Lisp_Object *args) 3487 (size_t nargs, Lisp_Object *args)
3485{ 3488{
3486#ifdef HAVE_MENUS 3489#ifdef HAVE_MENUS
3487 if ((NILP (last_nonmenu_event) || CONSP (last_nonmenu_event)) 3490 if ((NILP (last_nonmenu_event) || CONSP (last_nonmenu_event))
@@ -3505,14 +3508,14 @@ First argument is the string to copy.
3505Remaining arguments form a sequence of PROPERTY VALUE pairs for text 3508Remaining arguments form a sequence of PROPERTY VALUE pairs for text
3506properties to add to the result. 3509properties to add to the result.
3507usage: (propertize STRING &rest PROPERTIES) */) 3510usage: (propertize STRING &rest PROPERTIES) */)
3508 (int nargs, Lisp_Object *args) 3511 (size_t nargs, Lisp_Object *args)
3509{ 3512{
3510 Lisp_Object properties, string; 3513 Lisp_Object properties, string;
3511 struct gcpro gcpro1, gcpro2; 3514 struct gcpro gcpro1, gcpro2;
3512 int i; 3515 size_t i;
3513 3516
3514 /* Number of args must be odd. */ 3517 /* Number of args must be odd. */
3515 if ((nargs & 1) == 0 || nargs < 1) 3518 if ((nargs & 1) == 0)
3516 error ("Wrong number of arguments"); 3519 error ("Wrong number of arguments");
3517 3520
3518 properties = string = Qnil; 3521 properties = string = Qnil;
@@ -3587,10 +3590,10 @@ decimal point itself is omitted. For %s and %S, the precision
3587specifier truncates the string to the given width. 3590specifier truncates the string to the given width.
3588 3591
3589usage: (format STRING &rest OBJECTS) */) 3592usage: (format STRING &rest OBJECTS) */)
3590 (int nargs, register Lisp_Object *args) 3593 (size_t nargs, register Lisp_Object *args)
3591{ 3594{
3592 register int n; /* The number of the next arg to substitute */ 3595 register size_t n; /* The number of the next arg to substitute */
3593 register EMACS_INT total; /* An estimate of the final length */ 3596 register size_t total; /* An estimate of the final length */
3594 char *buf, *p; 3597 char *buf, *p;
3595 register char *format, *end, *format_start; 3598 register char *format, *end, *format_start;
3596 int nchars; 3599 int nchars;
@@ -3666,8 +3669,8 @@ usage: (format STRING &rest OBJECTS) */)
3666 3669
3667 /* Allocate the info and discarded tables. */ 3670 /* Allocate the info and discarded tables. */
3668 { 3671 {
3669 int nbytes = (nargs+1) * sizeof *info; 3672 size_t nbytes = (nargs+1) * sizeof *info;
3670 int i; 3673 size_t i;
3671 if (!info) 3674 if (!info)
3672 info = (struct info *) alloca (nbytes); 3675 info = (struct info *) alloca (nbytes);
3673 memset (info, 0, nbytes); 3676 memset (info, 0, nbytes);
diff --git a/src/emacs.c b/src/emacs.c
index 052f22ea622..6bdd2550ed1 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -308,7 +308,7 @@ pthread_t main_thread;
308 308
309 309
310/* Handle bus errors, invalid instruction, etc. */ 310/* Handle bus errors, invalid instruction, etc. */
311SIGTYPE 311void
312fatal_error_signal (int sig) 312fatal_error_signal (int sig)
313{ 313{
314 SIGNAL_THREAD_CHECK (sig); 314 SIGNAL_THREAD_CHECK (sig);
@@ -345,7 +345,7 @@ fatal_error_signal (int sig)
345#ifdef SIGDANGER 345#ifdef SIGDANGER
346 346
347/* Handler for SIGDANGER. */ 347/* Handler for SIGDANGER. */
348SIGTYPE 348void
349memory_warning_signal (sig) 349memory_warning_signal (sig)
350 int sig; 350 int sig;
351{ 351{
@@ -1972,14 +1972,15 @@ all of which are called before Emacs is actually killed. */)
1972 (Lisp_Object arg) 1972 (Lisp_Object arg)
1973{ 1973{
1974 struct gcpro gcpro1; 1974 struct gcpro gcpro1;
1975 Lisp_Object hook;
1975 1976
1976 GCPRO1 (arg); 1977 GCPRO1 (arg);
1977 1978
1978 if (feof (stdin)) 1979 if (feof (stdin))
1979 arg = Qt; 1980 arg = Qt;
1980 1981
1981 if (!NILP (Vrun_hooks)) 1982 hook = intern ("kill-emacs-hook");
1982 call1 (Vrun_hooks, intern ("kill-emacs-hook")); 1983 Frun_hooks (1, &hook);
1983 1984
1984 UNGCPRO; 1985 UNGCPRO;
1985 1986
@@ -2312,6 +2313,7 @@ from the parent process and its tty file descriptors. */)
2312 (void) 2313 (void)
2313{ 2314{
2314 int nfd; 2315 int nfd;
2316 int err = 0;
2315 2317
2316 if (!IS_DAEMON) 2318 if (!IS_DAEMON)
2317 error ("This function can only be called if emacs is run as a daemon"); 2319 error ("This function can only be called if emacs is run as a daemon");
@@ -2324,10 +2326,11 @@ from the parent process and its tty file descriptors. */)
2324 2326
2325 /* Get rid of stdin, stdout and stderr. */ 2327 /* Get rid of stdin, stdout and stderr. */
2326 nfd = open ("/dev/null", O_RDWR); 2328 nfd = open ("/dev/null", O_RDWR);
2327 dup2 (nfd, 0); 2329 err |= nfd < 0;
2328 dup2 (nfd, 1); 2330 err |= dup2 (nfd, 0) < 0;
2329 dup2 (nfd, 2); 2331 err |= dup2 (nfd, 1) < 0;
2330 close (nfd); 2332 err |= dup2 (nfd, 2) < 0;
2333 err |= close (nfd) != 0;
2331 2334
2332 /* Closing the pipe will notify the parent that it can exit. 2335 /* Closing the pipe will notify the parent that it can exit.
2333 FIXME: In case some other process inherited the pipe, closing it here 2336 FIXME: In case some other process inherited the pipe, closing it here
@@ -2336,10 +2339,13 @@ from the parent process and its tty file descriptors. */)
2336 Instead, we should probably close the pipe in start-process and 2339 Instead, we should probably close the pipe in start-process and
2337 call-process to make sure the pipe is never inherited by 2340 call-process to make sure the pipe is never inherited by
2338 subprocesses. */ 2341 subprocesses. */
2339 write (daemon_pipe[1], "\n", 1); 2342 err |= write (daemon_pipe[1], "\n", 1) < 0;
2340 close (daemon_pipe[1]); 2343 err |= close (daemon_pipe[1]) != 0;
2341 /* Set it to an invalid value so we know we've already run this function. */ 2344 /* Set it to an invalid value so we know we've already run this function. */
2342 daemon_pipe[1] = -1; 2345 daemon_pipe[1] = -1;
2346
2347 if (err)
2348 error ("I/O error during daemon initialization");
2343 return Qt; 2349 return Qt;
2344} 2350}
2345 2351
diff --git a/src/eval.c b/src/eval.c
index c22e7d3f571..9f90e6df4b5 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -30,24 +30,28 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
30#include "xterm.h" 30#include "xterm.h"
31#endif 31#endif
32 32
33/* This definition is duplicated in alloc.c and keyboard.c */ 33/* This definition is duplicated in alloc.c and keyboard.c. */
34/* Putting it in lisp.h makes cc bomb out! */ 34/* Putting it in lisp.h makes cc bomb out! */
35 35
36struct backtrace 36struct backtrace
37{ 37{
38 struct backtrace *next; 38 struct backtrace *next;
39 Lisp_Object *function; 39 Lisp_Object *function;
40 Lisp_Object *args; /* Points to vector of args. */ 40 Lisp_Object *args; /* Points to vector of args. */
41 int nargs; /* Length of vector. 41#define NARGS_BITS (BITS_PER_INT - 2)
42 If nargs is UNEVALLED, args points to slot holding 42 /* Let's not use size_t because we want to allow negative values (for
43 list of unevalled args */ 43 UNEVALLED). Also let's steal 2 bits so we save a word (or more for
44 char evalargs; 44 alignment). In any case I doubt Emacs would survive a function call with
45 /* Nonzero means call value of debugger when done with this operation. */ 45 more than 500M arguments. */
46 char debug_on_exit; 46 int nargs : NARGS_BITS; /* Length of vector.
47 If nargs is UNEVALLED, args points
48 to slot holding list of unevalled args. */
49 char evalargs : 1;
50 /* Nonzero means call value of debugger when done with this operation. */
51 char debug_on_exit : 1;
47}; 52};
48 53
49struct backtrace *backtrace_list; 54struct backtrace *backtrace_list;
50
51struct catchtag *catchlist; 55struct catchtag *catchlist;
52 56
53#ifdef DEBUG_GCPRO 57#ifdef DEBUG_GCPRO
@@ -114,7 +118,7 @@ Lisp_Object Vsignaling_function;
114int handling_signal; 118int handling_signal;
115 119
116static Lisp_Object apply_lambda (Lisp_Object fun, Lisp_Object args); 120static Lisp_Object apply_lambda (Lisp_Object fun, Lisp_Object args);
117static Lisp_Object funcall_lambda (Lisp_Object, int, Lisp_Object *); 121static Lisp_Object funcall_lambda (Lisp_Object, size_t, Lisp_Object *);
118static void unwind_to_catch (struct catchtag *, Lisp_Object) NO_RETURN; 122static void unwind_to_catch (struct catchtag *, Lisp_Object) NO_RETURN;
119static int interactive_p (int); 123static int interactive_p (int);
120 124
@@ -148,7 +152,7 @@ init_eval (void)
148 when_entered_debugger = -1; 152 when_entered_debugger = -1;
149} 153}
150 154
151/* unwind-protect function used by call_debugger. */ 155/* Unwind-protect function used by call_debugger. */
152 156
153static Lisp_Object 157static Lisp_Object
154restore_stack_limits (Lisp_Object data) 158restore_stack_limits (Lisp_Object data)
@@ -578,7 +582,7 @@ interactive_p (int exclude_subrs_p)
578 || btp->nargs == UNEVALLED)) 582 || btp->nargs == UNEVALLED))
579 btp = btp->next; 583 btp = btp->next;
580 584
581 /* btp now points at the frame of the innermost function that isn't 585 /* `btp' now points at the frame of the innermost function that isn't
582 a special form, ignoring frames for Finteractive_p and/or 586 a special form, ignoring frames for Finteractive_p and/or
583 Fbytecode at the top. If this frame is for a built-in function 587 Fbytecode at the top. If this frame is for a built-in function
584 (such as load or eval-region) return nil. */ 588 (such as load or eval-region) return nil. */
@@ -586,7 +590,7 @@ interactive_p (int exclude_subrs_p)
586 if (exclude_subrs_p && SUBRP (fun)) 590 if (exclude_subrs_p && SUBRP (fun))
587 return 0; 591 return 0;
588 592
589 /* btp points to the frame of a Lisp function that called interactive-p. 593 /* `btp' points to the frame of a Lisp function that called interactive-p.
590 Return t if that function was called interactively. */ 594 Return t if that function was called interactively. */
591 if (btp && btp->next && EQ (*btp->next->function, Qcall_interactively)) 595 if (btp && btp->next && EQ (*btp->next->function, Qcall_interactively))
592 return 1; 596 return 1;
@@ -1028,17 +1032,17 @@ usage: (let VARLIST BODY...) */)
1028 Lisp_Object *temps, tem, lexenv; 1032 Lisp_Object *temps, tem, lexenv;
1029 register Lisp_Object elt, varlist; 1033 register Lisp_Object elt, varlist;
1030 int count = SPECPDL_INDEX (); 1034 int count = SPECPDL_INDEX ();
1031 register int argnum; 1035 register size_t argnum;
1032 struct gcpro gcpro1, gcpro2; 1036 struct gcpro gcpro1, gcpro2;
1033 USE_SAFE_ALLOCA; 1037 USE_SAFE_ALLOCA;
1034 1038
1035 varlist = Fcar (args); 1039 varlist = Fcar (args);
1036 1040
1037 /* Make space to hold the values to give the bound variables */ 1041 /* Make space to hold the values to give the bound variables. */
1038 elt = Flength (varlist); 1042 elt = Flength (varlist);
1039 SAFE_ALLOCA_LISP (temps, XFASTINT (elt)); 1043 SAFE_ALLOCA_LISP (temps, XFASTINT (elt));
1040 1044
1041 /* Compute the values and store them in `temps' */ 1045 /* Compute the values and store them in `temps'. */
1042 1046
1043 GCPRO2 (args, *temps); 1047 GCPRO2 (args, *temps);
1044 gcpro2.nvars = 0; 1048 gcpro2.nvars = 0;
@@ -1155,7 +1159,7 @@ definitions to shadow the loaded ones for use in file byte-compilation. */)
1155 /* SYM is not mentioned in ENVIRONMENT. 1159 /* SYM is not mentioned in ENVIRONMENT.
1156 Look at its function definition. */ 1160 Look at its function definition. */
1157 if (EQ (def, Qunbound) || !CONSP (def)) 1161 if (EQ (def, Qunbound) || !CONSP (def))
1158 /* Not defined or definition not suitable */ 1162 /* Not defined or definition not suitable. */
1159 break; 1163 break;
1160 if (EQ (XCAR (def), Qautoload)) 1164 if (EQ (XCAR (def), Qautoload))
1161 { 1165 {
@@ -1296,10 +1300,7 @@ unwind_to_catch (struct catchtag *catch, Lisp_Object value)
1296 byte_stack_list = catch->byte_stack; 1300 byte_stack_list = catch->byte_stack;
1297 gcprolist = catch->gcpro; 1301 gcprolist = catch->gcpro;
1298#ifdef DEBUG_GCPRO 1302#ifdef DEBUG_GCPRO
1299 if (gcprolist != 0) 1303 gcpro_level = gcprolist ? gcprolist->level + 1 : gcpro_level = 0;
1300 gcpro_level = gcprolist->level + 1;
1301 else
1302 gcpro_level = 0;
1303#endif 1304#endif
1304 backtrace_list = catch->backlist; 1305 backtrace_list = catch->backlist;
1305 lisp_eval_depth = catch->lisp_eval_depth; 1306 lisp_eval_depth = catch->lisp_eval_depth;
@@ -1594,8 +1595,8 @@ internal_condition_case_2 (Lisp_Object (*bfun) (Lisp_Object, Lisp_Object),
1594 and ARGS as second argument. */ 1595 and ARGS as second argument. */
1595 1596
1596Lisp_Object 1597Lisp_Object
1597internal_condition_case_n (Lisp_Object (*bfun) (int, Lisp_Object*), 1598internal_condition_case_n (Lisp_Object (*bfun) (size_t, Lisp_Object *),
1598 int nargs, 1599 size_t nargs,
1599 Lisp_Object *args, 1600 Lisp_Object *args,
1600 Lisp_Object handlers, 1601 Lisp_Object handlers,
1601 Lisp_Object (*hfun) (Lisp_Object)) 1602 Lisp_Object (*hfun) (Lisp_Object))
@@ -1907,7 +1908,7 @@ maybe_call_debugger (Lisp_Object conditions, Lisp_Object sig, Lisp_Object data)
1907 ? debug_on_quit 1908 ? debug_on_quit
1908 : wants_debugger (Vdebug_on_error, conditions)) 1909 : wants_debugger (Vdebug_on_error, conditions))
1909 && ! skip_debugger (conditions, combined_data) 1910 && ! skip_debugger (conditions, combined_data)
1910 /* rms: what's this for? */ 1911 /* RMS: What's this for? */
1911 && when_entered_debugger < num_nonmacro_input_events) 1912 && when_entered_debugger < num_nonmacro_input_events)
1912 { 1913 {
1913 call_debugger (Fcons (Qerror, Fcons (combined_data, Qnil))); 1914 call_debugger (Fcons (Qerror, Fcons (combined_data, Qnil)));
@@ -1974,7 +1975,7 @@ find_handler_clause (Lisp_Object handlers, Lisp_Object conditions,
1974} 1975}
1975 1976
1976 1977
1977/* dump an error message; called like vprintf */ 1978/* Dump an error message; called like vprintf. */
1978void 1979void
1979verror (const char *m, va_list ap) 1980verror (const char *m, va_list ap)
1980{ 1981{
@@ -2011,7 +2012,7 @@ verror (const char *m, va_list ap)
2011} 2012}
2012 2013
2013 2014
2014/* dump an error message; called like printf */ 2015/* Dump an error message; called like printf. */
2015 2016
2016/* VARARGS 1 */ 2017/* VARARGS 1 */
2017void 2018void
@@ -2109,7 +2110,7 @@ this does nothing and returns nil. */)
2109 CHECK_SYMBOL (function); 2110 CHECK_SYMBOL (function);
2110 CHECK_STRING (file); 2111 CHECK_STRING (file);
2111 2112
2112 /* If function is defined and not as an autoload, don't override */ 2113 /* If function is defined and not as an autoload, don't override. */
2113 if (!EQ (XSYMBOL (function)->function, Qunbound) 2114 if (!EQ (XSYMBOL (function)->function, Qunbound)
2114 && !(CONSP (XSYMBOL (function)->function) 2115 && !(CONSP (XSYMBOL (function)->function)
2115 && EQ (XCAR (XSYMBOL (function)->function), Qautoload))) 2116 && EQ (XCAR (XSYMBOL (function)->function), Qautoload)))
@@ -2269,7 +2270,7 @@ eval_sub (Lisp_Object form)
2269 2270
2270 backtrace.next = backtrace_list; 2271 backtrace.next = backtrace_list;
2271 backtrace_list = &backtrace; 2272 backtrace_list = &backtrace;
2272 backtrace.function = &original_fun; /* This also protects them from gc */ 2273 backtrace.function = &original_fun; /* This also protects them from gc. */
2273 backtrace.args = &original_args; 2274 backtrace.args = &original_args;
2274 backtrace.nargs = UNEVALLED; 2275 backtrace.nargs = UNEVALLED;
2275 backtrace.evalargs = 1; 2276 backtrace.evalargs = 1;
@@ -2279,7 +2280,7 @@ eval_sub (Lisp_Object form)
2279 do_debug_on_call (Qt); 2280 do_debug_on_call (Qt);
2280 2281
2281 /* At this point, only original_fun and original_args 2282 /* At this point, only original_fun and original_args
2282 have values that will be used below */ 2283 have values that will be used below. */
2283 retry: 2284 retry:
2284 2285
2285 /* Optimize for no indirection. */ 2286 /* Optimize for no indirection. */
@@ -2300,8 +2301,9 @@ eval_sub (Lisp_Object form)
2300 2301
2301 CHECK_CONS_LIST (); 2302 CHECK_CONS_LIST ();
2302 2303
2303 if (XINT (numargs) < XSUBR (fun)->min_args || 2304 if (XINT (numargs) < XSUBR (fun)->min_args
2304 (XSUBR (fun)->max_args >= 0 && XSUBR (fun)->max_args < XINT (numargs))) 2305 || (XSUBR (fun)->max_args >= 0
2306 && XSUBR (fun)->max_args < XINT (numargs)))
2305 xsignal2 (Qwrong_number_of_arguments, original_fun, numargs); 2307 xsignal2 (Qwrong_number_of_arguments, original_fun, numargs);
2306 2308
2307 else if (XSUBR (fun)->max_args == UNEVALLED) 2309 else if (XSUBR (fun)->max_args == UNEVALLED)
@@ -2311,9 +2313,9 @@ eval_sub (Lisp_Object form)
2311 } 2313 }
2312 else if (XSUBR (fun)->max_args == MANY) 2314 else if (XSUBR (fun)->max_args == MANY)
2313 { 2315 {
2314 /* Pass a vector of evaluated arguments */ 2316 /* Pass a vector of evaluated arguments. */
2315 Lisp_Object *vals; 2317 Lisp_Object *vals;
2316 register int argnum = 0; 2318 register size_t argnum = 0;
2317 USE_SAFE_ALLOCA; 2319 USE_SAFE_ALLOCA;
2318 2320
2319 SAFE_ALLOCA_LISP (vals, XINT (numargs)); 2321 SAFE_ALLOCA_LISP (vals, XINT (numargs));
@@ -2443,9 +2445,9 @@ DEFUN ("apply", Fapply, Sapply, 2, MANY, 0,
2443Then return the value FUNCTION returns. 2445Then return the value FUNCTION returns.
2444Thus, (apply '+ 1 2 '(3 4)) returns 10. 2446Thus, (apply '+ 1 2 '(3 4)) returns 10.
2445usage: (apply FUNCTION &rest ARGUMENTS) */) 2447usage: (apply FUNCTION &rest ARGUMENTS) */)
2446 (int nargs, Lisp_Object *args) 2448 (size_t nargs, Lisp_Object *args)
2447{ 2449{
2448 register int i, numargs; 2450 register size_t i, numargs;
2449 register Lisp_Object spread_arg; 2451 register Lisp_Object spread_arg;
2450 register Lisp_Object *funcall_args; 2452 register Lisp_Object *funcall_args;
2451 Lisp_Object fun, retval; 2453 Lisp_Object fun, retval;
@@ -2475,7 +2477,7 @@ usage: (apply FUNCTION &rest ARGUMENTS) */)
2475 fun = indirect_function (fun); 2477 fun = indirect_function (fun);
2476 if (EQ (fun, Qunbound)) 2478 if (EQ (fun, Qunbound))
2477 { 2479 {
2478 /* Let funcall get the error */ 2480 /* Let funcall get the error. */
2479 fun = args[0]; 2481 fun = args[0];
2480 goto funcall; 2482 goto funcall;
2481 } 2483 }
@@ -2484,11 +2486,11 @@ usage: (apply FUNCTION &rest ARGUMENTS) */)
2484 { 2486 {
2485 if (numargs < XSUBR (fun)->min_args 2487 if (numargs < XSUBR (fun)->min_args
2486 || (XSUBR (fun)->max_args >= 0 && XSUBR (fun)->max_args < numargs)) 2488 || (XSUBR (fun)->max_args >= 0 && XSUBR (fun)->max_args < numargs))
2487 goto funcall; /* Let funcall get the error */ 2489 goto funcall; /* Let funcall get the error. */
2488 else if (XSUBR (fun)->max_args > numargs) 2490 else if (XSUBR (fun)->max_args >= 0 && XSUBR (fun)->max_args > numargs)
2489 { 2491 {
2490 /* Avoid making funcall cons up a yet another new vector of arguments 2492 /* Avoid making funcall cons up a yet another new vector of arguments
2491 by explicitly supplying nil's for optional values */ 2493 by explicitly supplying nil's for optional values. */
2492 SAFE_ALLOCA_LISP (funcall_args, 1 + XSUBR (fun)->max_args); 2494 SAFE_ALLOCA_LISP (funcall_args, 1 + XSUBR (fun)->max_args);
2493 for (i = numargs; i < XSUBR (fun)->max_args;) 2495 for (i = numargs; i < XSUBR (fun)->max_args;)
2494 funcall_args[++i] = Qnil; 2496 funcall_args[++i] = Qnil;
@@ -2526,9 +2528,12 @@ usage: (apply FUNCTION &rest ARGUMENTS) */)
2526 2528
2527/* Run hook variables in various ways. */ 2529/* Run hook variables in various ways. */
2528 2530
2529enum run_hooks_condition {to_completion, until_success, until_failure}; 2531static Lisp_Object
2530static Lisp_Object run_hook_with_args (int, Lisp_Object *, 2532funcall_nil (size_t nargs, Lisp_Object *args)
2531 enum run_hooks_condition); 2533{
2534 Ffuncall (nargs, args);
2535 return Qnil;
2536}
2532 2537
2533DEFUN ("run-hooks", Frun_hooks, Srun_hooks, 0, MANY, 0, 2538DEFUN ("run-hooks", Frun_hooks, Srun_hooks, 0, MANY, 0,
2534 doc: /* Run each hook in HOOKS. 2539 doc: /* Run each hook in HOOKS.
@@ -2545,15 +2550,15 @@ hook; they should use `run-mode-hooks' instead.
2545Do not use `make-local-variable' to make a hook variable buffer-local. 2550Do not use `make-local-variable' to make a hook variable buffer-local.
2546Instead, use `add-hook' and specify t for the LOCAL argument. 2551Instead, use `add-hook' and specify t for the LOCAL argument.
2547usage: (run-hooks &rest HOOKS) */) 2552usage: (run-hooks &rest HOOKS) */)
2548 (int nargs, Lisp_Object *args) 2553 (size_t nargs, Lisp_Object *args)
2549{ 2554{
2550 Lisp_Object hook[1]; 2555 Lisp_Object hook[1];
2551 register int i; 2556 register size_t i;
2552 2557
2553 for (i = 0; i < nargs; i++) 2558 for (i = 0; i < nargs; i++)
2554 { 2559 {
2555 hook[0] = args[i]; 2560 hook[0] = args[i];
2556 run_hook_with_args (1, hook, to_completion); 2561 run_hook_with_args (1, hook, funcall_nil);
2557 } 2562 }
2558 2563
2559 return Qnil; 2564 return Qnil;
@@ -2574,9 +2579,9 @@ as that may change.
2574Do not use `make-local-variable' to make a hook variable buffer-local. 2579Do not use `make-local-variable' to make a hook variable buffer-local.
2575Instead, use `add-hook' and specify t for the LOCAL argument. 2580Instead, use `add-hook' and specify t for the LOCAL argument.
2576usage: (run-hook-with-args HOOK &rest ARGS) */) 2581usage: (run-hook-with-args HOOK &rest ARGS) */)
2577 (int nargs, Lisp_Object *args) 2582 (size_t nargs, Lisp_Object *args)
2578{ 2583{
2579 return run_hook_with_args (nargs, args, to_completion); 2584 return run_hook_with_args (nargs, args, funcall_nil);
2580} 2585}
2581 2586
2582DEFUN ("run-hook-with-args-until-success", Frun_hook_with_args_until_success, 2587DEFUN ("run-hook-with-args-until-success", Frun_hook_with_args_until_success,
@@ -2594,9 +2599,15 @@ However, if they all return nil, we return nil.
2594Do not use `make-local-variable' to make a hook variable buffer-local. 2599Do not use `make-local-variable' to make a hook variable buffer-local.
2595Instead, use `add-hook' and specify t for the LOCAL argument. 2600Instead, use `add-hook' and specify t for the LOCAL argument.
2596usage: (run-hook-with-args-until-success HOOK &rest ARGS) */) 2601usage: (run-hook-with-args-until-success HOOK &rest ARGS) */)
2597 (int nargs, Lisp_Object *args) 2602 (size_t nargs, Lisp_Object *args)
2598{ 2603{
2599 return run_hook_with_args (nargs, args, until_success); 2604 return run_hook_with_args (nargs, args, Ffuncall);
2605}
2606
2607static Lisp_Object
2608funcall_not (size_t nargs, Lisp_Object *args)
2609{
2610 return NILP (Ffuncall (nargs, args)) ? Qt : Qnil;
2600} 2611}
2601 2612
2602DEFUN ("run-hook-with-args-until-failure", Frun_hook_with_args_until_failure, 2613DEFUN ("run-hook-with-args-until-failure", Frun_hook_with_args_until_failure,
@@ -2613,23 +2624,47 @@ Then we return nil. However, if they all return non-nil, we return non-nil.
2613Do not use `make-local-variable' to make a hook variable buffer-local. 2624Do not use `make-local-variable' to make a hook variable buffer-local.
2614Instead, use `add-hook' and specify t for the LOCAL argument. 2625Instead, use `add-hook' and specify t for the LOCAL argument.
2615usage: (run-hook-with-args-until-failure HOOK &rest ARGS) */) 2626usage: (run-hook-with-args-until-failure HOOK &rest ARGS) */)
2616 (int nargs, Lisp_Object *args) 2627 (size_t nargs, Lisp_Object *args)
2617{ 2628{
2618 return run_hook_with_args (nargs, args, until_failure); 2629 return NILP (run_hook_with_args (nargs, args, funcall_not)) ? Qt : Qnil;
2630}
2631
2632static Lisp_Object
2633run_hook_wrapped_funcall (size_t nargs, Lisp_Object *args)
2634{
2635 Lisp_Object tmp = args[0], ret;
2636 args[0] = args[1];
2637 args[1] = tmp;
2638 ret = Ffuncall (nargs, args);
2639 args[1] = args[0];
2640 args[0] = tmp;
2641 return ret;
2642}
2643
2644DEFUN ("run-hook-wrapped", Frun_hook_wrapped, Srun_hook_wrapped, 2, MANY, 0,
2645 doc: /* Run HOOK, passing each function through WRAP-FUNCTION.
2646I.e. instead of calling each function FUN directly with arguments ARGS,
2647it calls WRAP-FUNCTION with arguments FUN and ARGS.
2648As soon as a call to WRAP-FUNCTION returns non-nil, `run-hook-wrapped'
2649aborts and returns that value.
2650usage: (run-hook-wrapped HOOK WRAP-FUNCTION &rest ARGS) */)
2651 (size_t nargs, Lisp_Object *args)
2652{
2653 return run_hook_with_args (nargs, args, run_hook_wrapped_funcall);
2619} 2654}
2620 2655
2621/* ARGS[0] should be a hook symbol. 2656/* ARGS[0] should be a hook symbol.
2622 Call each of the functions in the hook value, passing each of them 2657 Call each of the functions in the hook value, passing each of them
2623 as arguments all the rest of ARGS (all NARGS - 1 elements). 2658 as arguments all the rest of ARGS (all NARGS - 1 elements).
2624 COND specifies a condition to test after each call 2659 FUNCALL specifies how to call each function on the hook.
2625 to decide whether to stop.
2626 The caller (or its caller, etc) must gcpro all of ARGS, 2660 The caller (or its caller, etc) must gcpro all of ARGS,
2627 except that it isn't necessary to gcpro ARGS[0]. */ 2661 except that it isn't necessary to gcpro ARGS[0]. */
2628 2662
2629static Lisp_Object 2663Lisp_Object
2630run_hook_with_args (int nargs, Lisp_Object *args, enum run_hooks_condition cond) 2664run_hook_with_args (size_t nargs, Lisp_Object *args,
2665 Lisp_Object (*funcall) (size_t nargs, Lisp_Object *args))
2631{ 2666{
2632 Lisp_Object sym, val, ret; 2667 Lisp_Object sym, val, ret = Qnil;
2633 struct gcpro gcpro1, gcpro2, gcpro3; 2668 struct gcpro gcpro1, gcpro2, gcpro3;
2634 2669
2635 /* If we are dying or still initializing, 2670 /* If we are dying or still initializing,
@@ -2639,14 +2674,13 @@ run_hook_with_args (int nargs, Lisp_Object *args, enum run_hooks_condition cond)
2639 2674
2640 sym = args[0]; 2675 sym = args[0];
2641 val = find_symbol_value (sym); 2676 val = find_symbol_value (sym);
2642 ret = (cond == until_failure ? Qt : Qnil);
2643 2677
2644 if (EQ (val, Qunbound) || NILP (val)) 2678 if (EQ (val, Qunbound) || NILP (val))
2645 return ret; 2679 return ret;
2646 else if (!CONSP (val) || EQ (XCAR (val), Qlambda)) 2680 else if (!CONSP (val) || EQ (XCAR (val), Qlambda))
2647 { 2681 {
2648 args[0] = val; 2682 args[0] = val;
2649 return Ffuncall (nargs, args); 2683 return funcall (nargs, args);
2650 } 2684 }
2651 else 2685 else
2652 { 2686 {
@@ -2654,9 +2688,7 @@ run_hook_with_args (int nargs, Lisp_Object *args, enum run_hooks_condition cond)
2654 GCPRO3 (sym, val, global_vals); 2688 GCPRO3 (sym, val, global_vals);
2655 2689
2656 for (; 2690 for (;
2657 CONSP (val) && ((cond == to_completion) 2691 CONSP (val) && NILP (ret);
2658 || (cond == until_success ? NILP (ret)
2659 : !NILP (ret)));
2660 val = XCDR (val)) 2692 val = XCDR (val))
2661 { 2693 {
2662 if (EQ (XCAR (val), Qt)) 2694 if (EQ (XCAR (val), Qt))
@@ -2669,30 +2701,26 @@ run_hook_with_args (int nargs, Lisp_Object *args, enum run_hooks_condition cond)
2669 if (!CONSP (global_vals) || EQ (XCAR (global_vals), Qlambda)) 2701 if (!CONSP (global_vals) || EQ (XCAR (global_vals), Qlambda))
2670 { 2702 {
2671 args[0] = global_vals; 2703 args[0] = global_vals;
2672 ret = Ffuncall (nargs, args); 2704 ret = funcall (nargs, args);
2673 } 2705 }
2674 else 2706 else
2675 { 2707 {
2676 for (; 2708 for (;
2677 (CONSP (global_vals) 2709 CONSP (global_vals) && NILP (ret);
2678 && (cond == to_completion
2679 || (cond == until_success
2680 ? NILP (ret)
2681 : !NILP (ret))));
2682 global_vals = XCDR (global_vals)) 2710 global_vals = XCDR (global_vals))
2683 { 2711 {
2684 args[0] = XCAR (global_vals); 2712 args[0] = XCAR (global_vals);
2685 /* In a global value, t should not occur. If it does, we 2713 /* In a global value, t should not occur. If it does, we
2686 must ignore it to avoid an endless loop. */ 2714 must ignore it to avoid an endless loop. */
2687 if (!EQ (args[0], Qt)) 2715 if (!EQ (args[0], Qt))
2688 ret = Ffuncall (nargs, args); 2716 ret = funcall (nargs, args);
2689 } 2717 }
2690 } 2718 }
2691 } 2719 }
2692 else 2720 else
2693 { 2721 {
2694 args[0] = XCAR (val); 2722 args[0] = XCAR (val);
2695 ret = Ffuncall (nargs, args); 2723 ret = funcall (nargs, args);
2696 } 2724 }
2697 } 2725 }
2698 2726
@@ -2714,7 +2742,7 @@ run_hook_with_args_2 (Lisp_Object hook, Lisp_Object arg1, Lisp_Object arg2)
2714 Frun_hook_with_args (3, temp); 2742 Frun_hook_with_args (3, temp);
2715} 2743}
2716 2744
2717/* Apply fn to arg */ 2745/* Apply fn to arg. */
2718Lisp_Object 2746Lisp_Object
2719apply1 (Lisp_Object fn, Lisp_Object arg) 2747apply1 (Lisp_Object fn, Lisp_Object arg)
2720{ 2748{
@@ -2733,7 +2761,7 @@ apply1 (Lisp_Object fn, Lisp_Object arg)
2733 } 2761 }
2734} 2762}
2735 2763
2736/* Call function fn on no arguments */ 2764/* Call function fn on no arguments. */
2737Lisp_Object 2765Lisp_Object
2738call0 (Lisp_Object fn) 2766call0 (Lisp_Object fn)
2739{ 2767{
@@ -2743,7 +2771,7 @@ call0 (Lisp_Object fn)
2743 RETURN_UNGCPRO (Ffuncall (1, &fn)); 2771 RETURN_UNGCPRO (Ffuncall (1, &fn));
2744} 2772}
2745 2773
2746/* Call function fn with 1 argument arg1 */ 2774/* Call function fn with 1 argument arg1. */
2747/* ARGSUSED */ 2775/* ARGSUSED */
2748Lisp_Object 2776Lisp_Object
2749call1 (Lisp_Object fn, Lisp_Object arg1) 2777call1 (Lisp_Object fn, Lisp_Object arg1)
@@ -2758,7 +2786,7 @@ call1 (Lisp_Object fn, Lisp_Object arg1)
2758 RETURN_UNGCPRO (Ffuncall (2, args)); 2786 RETURN_UNGCPRO (Ffuncall (2, args));
2759} 2787}
2760 2788
2761/* Call function fn with 2 arguments arg1, arg2 */ 2789/* Call function fn with 2 arguments arg1, arg2. */
2762/* ARGSUSED */ 2790/* ARGSUSED */
2763Lisp_Object 2791Lisp_Object
2764call2 (Lisp_Object fn, Lisp_Object arg1, Lisp_Object arg2) 2792call2 (Lisp_Object fn, Lisp_Object arg1, Lisp_Object arg2)
@@ -2773,7 +2801,7 @@ call2 (Lisp_Object fn, Lisp_Object arg1, Lisp_Object arg2)
2773 RETURN_UNGCPRO (Ffuncall (3, args)); 2801 RETURN_UNGCPRO (Ffuncall (3, args));
2774} 2802}
2775 2803
2776/* Call function fn with 3 arguments arg1, arg2, arg3 */ 2804/* Call function fn with 3 arguments arg1, arg2, arg3. */
2777/* ARGSUSED */ 2805/* ARGSUSED */
2778Lisp_Object 2806Lisp_Object
2779call3 (Lisp_Object fn, Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3) 2807call3 (Lisp_Object fn, Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3)
@@ -2789,7 +2817,7 @@ call3 (Lisp_Object fn, Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3)
2789 RETURN_UNGCPRO (Ffuncall (4, args)); 2817 RETURN_UNGCPRO (Ffuncall (4, args));
2790} 2818}
2791 2819
2792/* Call function fn with 4 arguments arg1, arg2, arg3, arg4 */ 2820/* Call function fn with 4 arguments arg1, arg2, arg3, arg4. */
2793/* ARGSUSED */ 2821/* ARGSUSED */
2794Lisp_Object 2822Lisp_Object
2795call4 (Lisp_Object fn, Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3, 2823call4 (Lisp_Object fn, Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3,
@@ -2807,7 +2835,7 @@ call4 (Lisp_Object fn, Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3,
2807 RETURN_UNGCPRO (Ffuncall (5, args)); 2835 RETURN_UNGCPRO (Ffuncall (5, args));
2808} 2836}
2809 2837
2810/* Call function fn with 5 arguments arg1, arg2, arg3, arg4, arg5 */ 2838/* Call function fn with 5 arguments arg1, arg2, arg3, arg4, arg5. */
2811/* ARGSUSED */ 2839/* ARGSUSED */
2812Lisp_Object 2840Lisp_Object
2813call5 (Lisp_Object fn, Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3, 2841call5 (Lisp_Object fn, Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3,
@@ -2826,7 +2854,7 @@ call5 (Lisp_Object fn, Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3,
2826 RETURN_UNGCPRO (Ffuncall (6, args)); 2854 RETURN_UNGCPRO (Ffuncall (6, args));
2827} 2855}
2828 2856
2829/* Call function fn with 6 arguments arg1, arg2, arg3, arg4, arg5, arg6 */ 2857/* Call function fn with 6 arguments arg1, arg2, arg3, arg4, arg5, arg6. */
2830/* ARGSUSED */ 2858/* ARGSUSED */
2831Lisp_Object 2859Lisp_Object
2832call6 (Lisp_Object fn, Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3, 2860call6 (Lisp_Object fn, Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3,
@@ -2846,7 +2874,7 @@ call6 (Lisp_Object fn, Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3,
2846 RETURN_UNGCPRO (Ffuncall (7, args)); 2874 RETURN_UNGCPRO (Ffuncall (7, args));
2847} 2875}
2848 2876
2849/* Call function fn with 7 arguments arg1, arg2, arg3, arg4, arg5, arg6, arg7 */ 2877/* Call function fn with 7 arguments arg1, arg2, arg3, arg4, arg5, arg6, arg7. */
2850/* ARGSUSED */ 2878/* ARGSUSED */
2851Lisp_Object 2879Lisp_Object
2852call7 (Lisp_Object fn, Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3, 2880call7 (Lisp_Object fn, Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3,
@@ -2907,16 +2935,16 @@ DEFUN ("funcall", Ffuncall, Sfuncall, 1, MANY, 0,
2907Return the value that function returns. 2935Return the value that function returns.
2908Thus, (funcall 'cons 'x 'y) returns (x . y). 2936Thus, (funcall 'cons 'x 'y) returns (x . y).
2909usage: (funcall FUNCTION &rest ARGUMENTS) */) 2937usage: (funcall FUNCTION &rest ARGUMENTS) */)
2910 (int nargs, Lisp_Object *args) 2938 (size_t nargs, Lisp_Object *args)
2911{ 2939{
2912 Lisp_Object fun, original_fun; 2940 Lisp_Object fun, original_fun;
2913 Lisp_Object funcar; 2941 Lisp_Object funcar;
2914 int numargs = nargs - 1; 2942 size_t numargs = nargs - 1;
2915 Lisp_Object lisp_numargs; 2943 Lisp_Object lisp_numargs;
2916 Lisp_Object val; 2944 Lisp_Object val;
2917 struct backtrace backtrace; 2945 struct backtrace backtrace;
2918 register Lisp_Object *internal_args; 2946 register Lisp_Object *internal_args;
2919 register int i; 2947 register size_t i;
2920 2948
2921 QUIT; 2949 QUIT;
2922 if ((consing_since_gc > gc_cons_threshold 2950 if ((consing_since_gc > gc_cons_threshold
@@ -3070,21 +3098,21 @@ static Lisp_Object
3070apply_lambda (Lisp_Object fun, Lisp_Object args) 3098apply_lambda (Lisp_Object fun, Lisp_Object args)
3071{ 3099{
3072 Lisp_Object args_left; 3100 Lisp_Object args_left;
3073 Lisp_Object numargs; 3101 size_t numargs;
3074 register Lisp_Object *arg_vector; 3102 register Lisp_Object *arg_vector;
3075 struct gcpro gcpro1, gcpro2, gcpro3; 3103 struct gcpro gcpro1, gcpro2, gcpro3;
3076 register int i; 3104 register size_t i;
3077 register Lisp_Object tem; 3105 register Lisp_Object tem;
3078 USE_SAFE_ALLOCA; 3106 USE_SAFE_ALLOCA;
3079 3107
3080 numargs = Flength (args); 3108 numargs = XINT (Flength (args));
3081 SAFE_ALLOCA_LISP (arg_vector, XINT (numargs)); 3109 SAFE_ALLOCA_LISP (arg_vector, numargs);
3082 args_left = args; 3110 args_left = args;
3083 3111
3084 GCPRO3 (*arg_vector, args_left, fun); 3112 GCPRO3 (*arg_vector, args_left, fun);
3085 gcpro1.nvars = 0; 3113 gcpro1.nvars = 0;
3086 3114
3087 for (i = 0; i < XINT (numargs);) 3115 for (i = 0; i < numargs; )
3088 { 3116 {
3089 tem = Fcar (args_left), args_left = Fcdr (args_left); 3117 tem = Fcar (args_left), args_left = Fcdr (args_left);
3090 tem = eval_sub (tem); 3118 tem = eval_sub (tem);
@@ -3097,7 +3125,7 @@ apply_lambda (Lisp_Object fun, Lisp_Object args)
3097 backtrace_list->args = arg_vector; 3125 backtrace_list->args = arg_vector;
3098 backtrace_list->nargs = i; 3126 backtrace_list->nargs = i;
3099 backtrace_list->evalargs = 0; 3127 backtrace_list->evalargs = 0;
3100 tem = funcall_lambda (fun, XINT (numargs), arg_vector); 3128 tem = funcall_lambda (fun, numargs, arg_vector);
3101 3129
3102 /* Do the debug-on-exit now, while arg_vector still exists. */ 3130 /* Do the debug-on-exit now, while arg_vector still exists. */
3103 if (backtrace_list->debug_on_exit) 3131 if (backtrace_list->debug_on_exit)
@@ -3113,12 +3141,13 @@ apply_lambda (Lisp_Object fun, Lisp_Object args)
3113 FUN must be either a lambda-expression or a compiled-code object. */ 3141 FUN must be either a lambda-expression or a compiled-code object. */
3114 3142
3115static Lisp_Object 3143static Lisp_Object
3116funcall_lambda (Lisp_Object fun, int nargs, 3144funcall_lambda (Lisp_Object fun, size_t nargs,
3117 register Lisp_Object *arg_vector) 3145 register Lisp_Object *arg_vector)
3118{ 3146{
3119 Lisp_Object val, syms_left, next, lexenv; 3147 Lisp_Object val, syms_left, next, lexenv;
3120 int count = SPECPDL_INDEX (); 3148 int count = SPECPDL_INDEX ();
3121 int i, optional, rest; 3149 size_t i;
3150 int optional, rest;
3122 3151
3123 if (CONSP (fun)) 3152 if (CONSP (fun))
3124 { 3153 {
@@ -3270,7 +3299,7 @@ grow_specpdl (void)
3270 specpdl_ptr = specpdl + count; 3299 specpdl_ptr = specpdl + count;
3271} 3300}
3272 3301
3273/* specpdl_ptr->symbol is a field which describes which variable is 3302/* `specpdl_ptr->symbol' is a field which describes which variable is
3274 let-bound, so it can be properly undone when we unbind_to. 3303 let-bound, so it can be properly undone when we unbind_to.
3275 It can have the following two shapes: 3304 It can have the following two shapes:
3276 - SYMBOL : if it's a plain symbol, it means that we have let-bound 3305 - SYMBOL : if it's a plain symbol, it means that we have let-bound
@@ -3500,7 +3529,6 @@ Output stream used is value of `standard-output'. */)
3500 (void) 3529 (void)
3501{ 3530{
3502 register struct backtrace *backlist = backtrace_list; 3531 register struct backtrace *backlist = backtrace_list;
3503 register int i;
3504 Lisp_Object tail; 3532 Lisp_Object tail;
3505 Lisp_Object tem; 3533 Lisp_Object tem;
3506 struct gcpro gcpro1; 3534 struct gcpro gcpro1;
@@ -3523,13 +3551,14 @@ Output stream used is value of `standard-output'. */)
3523 else 3551 else
3524 { 3552 {
3525 tem = *backlist->function; 3553 tem = *backlist->function;
3526 Fprin1 (tem, Qnil); /* This can QUIT */ 3554 Fprin1 (tem, Qnil); /* This can QUIT. */
3527 write_string ("(", -1); 3555 write_string ("(", -1);
3528 if (backlist->nargs == MANY) 3556 if (backlist->nargs == MANY)
3529 { 3557 { /* FIXME: Can this happen? */
3558 int i;
3530 for (tail = *backlist->args, i = 0; 3559 for (tail = *backlist->args, i = 0;
3531 !NILP (tail); 3560 !NILP (tail);
3532 tail = Fcdr (tail), i++) 3561 tail = Fcdr (tail), i = 1)
3533 { 3562 {
3534 if (i) write_string (" ", -1); 3563 if (i) write_string (" ", -1);
3535 Fprin1 (Fcar (tail), Qnil); 3564 Fprin1 (Fcar (tail), Qnil);
@@ -3537,6 +3566,7 @@ Output stream used is value of `standard-output'. */)
3537 } 3566 }
3538 else 3567 else
3539 { 3568 {
3569 size_t i;
3540 for (i = 0; i < backlist->nargs; i++) 3570 for (i = 0; i < backlist->nargs; i++)
3541 { 3571 {
3542 if (i) write_string (" ", -1); 3572 if (i) write_string (" ", -1);
@@ -3566,7 +3596,7 @@ If NFRAMES is more than the number of frames, the value is nil. */)
3566 (Lisp_Object nframes) 3596 (Lisp_Object nframes)
3567{ 3597{
3568 register struct backtrace *backlist = backtrace_list; 3598 register struct backtrace *backlist = backtrace_list;
3569 register int i; 3599 register EMACS_INT i;
3570 Lisp_Object tem; 3600 Lisp_Object tem;
3571 3601
3572 CHECK_NATNUM (nframes); 3602 CHECK_NATNUM (nframes);
@@ -3581,7 +3611,7 @@ If NFRAMES is more than the number of frames, the value is nil. */)
3581 return Fcons (Qnil, Fcons (*backlist->function, *backlist->args)); 3611 return Fcons (Qnil, Fcons (*backlist->function, *backlist->args));
3582 else 3612 else
3583 { 3613 {
3584 if (backlist->nargs == MANY) 3614 if (backlist->nargs == MANY) /* FIXME: Can this happen? */
3585 tem = *backlist->args; 3615 tem = *backlist->args;
3586 else 3616 else
3587 tem = Flist (backlist->nargs, backlist->args); 3617 tem = Flist (backlist->nargs, backlist->args);
@@ -3595,17 +3625,18 @@ void
3595mark_backtrace (void) 3625mark_backtrace (void)
3596{ 3626{
3597 register struct backtrace *backlist; 3627 register struct backtrace *backlist;
3598 register int i; 3628 register size_t i;
3599 3629
3600 for (backlist = backtrace_list; backlist; backlist = backlist->next) 3630 for (backlist = backtrace_list; backlist; backlist = backlist->next)
3601 { 3631 {
3602 mark_object (*backlist->function); 3632 mark_object (*backlist->function);
3603 3633
3604 if (backlist->nargs == UNEVALLED || backlist->nargs == MANY) 3634 if (backlist->nargs == UNEVALLED
3605 i = 0; 3635 || backlist->nargs == MANY) /* FIXME: Can this happen? */
3636 i = 1;
3606 else 3637 else
3607 i = backlist->nargs - 1; 3638 i = backlist->nargs;
3608 for (; i >= 0; i--) 3639 while (i--)
3609 mark_object (backlist->args[i]); 3640 mark_object (backlist->args[i]);
3610 } 3641 }
3611} 3642}
@@ -3820,6 +3851,7 @@ alist of active lexical bindings. */);
3820 defsubr (&Srun_hook_with_args); 3851 defsubr (&Srun_hook_with_args);
3821 defsubr (&Srun_hook_with_args_until_success); 3852 defsubr (&Srun_hook_with_args_until_success);
3822 defsubr (&Srun_hook_with_args_until_failure); 3853 defsubr (&Srun_hook_with_args_until_failure);
3854 defsubr (&Srun_hook_wrapped);
3823 defsubr (&Sfetch_bytecode); 3855 defsubr (&Sfetch_bytecode);
3824 defsubr (&Sbacktrace_debug); 3856 defsubr (&Sbacktrace_debug);
3825 defsubr (&Sbacktrace); 3857 defsubr (&Sbacktrace);
diff --git a/src/fileio.c b/src/fileio.c
index 5d33fb93878..85431dfd5b1 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -1951,9 +1951,10 @@ on the system, we copy the SELinux context of FILE to NEWNAME. */)
1951 owner and group. */ 1951 owner and group. */
1952 if (input_file_statable_p) 1952 if (input_file_statable_p)
1953 { 1953 {
1954 if (! NILP (preserve_uid_gid)) 1954 if (!NILP (preserve_uid_gid) && fchown (ofd, st.st_uid, st.st_gid) != 0)
1955 fchown (ofd, st.st_uid, st.st_gid); 1955 report_file_error ("Doing chown", Fcons (newname, Qnil));
1956 fchmod (ofd, st.st_mode & 07777); 1956 if (fchmod (ofd, st.st_mode & 07777) != 0)
1957 report_file_error ("Doing chmod", Fcons (newname, Qnil));
1957 } 1958 }
1958#endif /* not MSDOS */ 1959#endif /* not MSDOS */
1959 1960
@@ -2358,8 +2359,6 @@ static int
2358check_executable (char *filename) 2359check_executable (char *filename)
2359{ 2360{
2360#ifdef DOS_NT 2361#ifdef DOS_NT
2361 int len = strlen (filename);
2362 char *suffix;
2363 struct stat st; 2362 struct stat st;
2364 if (stat (filename, &st) < 0) 2363 if (stat (filename, &st) < 0)
2365 return 0; 2364 return 0;
@@ -2785,13 +2784,14 @@ as a list ("user", "role", "type", "range"). Has no effect if SELinux
2785is disabled. */) 2784is disabled. */)
2786 (Lisp_Object filename, Lisp_Object context) 2785 (Lisp_Object filename, Lisp_Object context)
2787{ 2786{
2788 Lisp_Object absname, encoded_absname; 2787 Lisp_Object absname;
2789 Lisp_Object handler; 2788 Lisp_Object handler;
2789#if HAVE_LIBSELINUX
2790 Lisp_Object encoded_absname;
2790 Lisp_Object user = CAR_SAFE (context); 2791 Lisp_Object user = CAR_SAFE (context);
2791 Lisp_Object role = CAR_SAFE (CDR_SAFE (context)); 2792 Lisp_Object role = CAR_SAFE (CDR_SAFE (context));
2792 Lisp_Object type = CAR_SAFE (CDR_SAFE (CDR_SAFE (context))); 2793 Lisp_Object type = CAR_SAFE (CDR_SAFE (CDR_SAFE (context)));
2793 Lisp_Object range = CAR_SAFE (CDR_SAFE (CDR_SAFE (CDR_SAFE (context)))); 2794 Lisp_Object range = CAR_SAFE (CDR_SAFE (CDR_SAFE (CDR_SAFE (context))));
2794#if HAVE_LIBSELINUX
2795 security_context_t con; 2795 security_context_t con;
2796 int fail, conlength; 2796 int fail, conlength;
2797 context_t parsed_con; 2797 context_t parsed_con;
@@ -2805,12 +2805,11 @@ is disabled. */)
2805 if (!NILP (handler)) 2805 if (!NILP (handler))
2806 return call3 (handler, Qset_file_selinux_context, absname, context); 2806 return call3 (handler, Qset_file_selinux_context, absname, context);
2807 2807
2808 encoded_absname = ENCODE_FILE (absname);
2809
2810#if HAVE_LIBSELINUX 2808#if HAVE_LIBSELINUX
2811 if (is_selinux_enabled ()) 2809 if (is_selinux_enabled ())
2812 { 2810 {
2813 /* Get current file context. */ 2811 /* Get current file context. */
2812 encoded_absname = ENCODE_FILE (absname);
2814 conlength = lgetfilecon (SSDATA (encoded_absname), &con); 2813 conlength = lgetfilecon (SSDATA (encoded_absname), &con);
2815 if (conlength > 0) 2814 if (conlength > 0)
2816 { 2815 {
@@ -5179,7 +5178,7 @@ A non-nil CURRENT-ONLY argument means save only current buffer. */)
5179 (Lisp_Object no_message, Lisp_Object current_only) 5178 (Lisp_Object no_message, Lisp_Object current_only)
5180{ 5179{
5181 struct buffer *old = current_buffer, *b; 5180 struct buffer *old = current_buffer, *b;
5182 Lisp_Object tail, buf; 5181 Lisp_Object tail, buf, hook;
5183 int auto_saved = 0; 5182 int auto_saved = 0;
5184 int do_handled_files; 5183 int do_handled_files;
5185 Lisp_Object oquit; 5184 Lisp_Object oquit;
@@ -5209,8 +5208,8 @@ A non-nil CURRENT-ONLY argument means save only current buffer. */)
5209 /* No GCPRO needed, because (when it matters) all Lisp_Object variables 5208 /* No GCPRO needed, because (when it matters) all Lisp_Object variables
5210 point to non-strings reached from Vbuffer_alist. */ 5209 point to non-strings reached from Vbuffer_alist. */
5211 5210
5212 if (!NILP (Vrun_hooks)) 5211 hook = intern ("auto-save-hook");
5213 call1 (Vrun_hooks, intern ("auto-save-hook")); 5212 Frun_hooks (1, &hook);
5214 5213
5215 if (STRINGP (Vauto_save_list_file_name)) 5214 if (STRINGP (Vauto_save_list_file_name))
5216 { 5215 {
diff --git a/src/floatfns.c b/src/floatfns.c
index bc03509b757..1232fc0afa1 100644
--- a/src/floatfns.c
+++ b/src/floatfns.c
@@ -103,7 +103,7 @@ extern double logb (double);
103#endif 103#endif
104 104
105#ifdef FLOAT_CATCH_SIGILL 105#ifdef FLOAT_CATCH_SIGILL
106static SIGTYPE float_error (); 106static void float_error ();
107#endif 107#endif
108 108
109/* Nonzero while executing in floating point. 109/* Nonzero while executing in floating point.
@@ -126,7 +126,7 @@ static const char *float_error_fn_name;
126 Handle errors which may result in signals or may set errno. 126 Handle errors which may result in signals or may set errno.
127 127
128 Note that float_error may be declared to return void, so you can't 128 Note that float_error may be declared to return void, so you can't
129 just cast the zero after the colon to (SIGTYPE) to make the types 129 just cast the zero after the colon to (void) to make the types
130 check properly. */ 130 check properly. */
131 131
132#ifdef FLOAT_CHECK_ERRNO 132#ifdef FLOAT_CHECK_ERRNO
@@ -960,7 +960,7 @@ Rounds the value toward zero. */)
960} 960}
961 961
962#ifdef FLOAT_CATCH_SIGILL 962#ifdef FLOAT_CATCH_SIGILL
963static SIGTYPE 963static void
964float_error (signo) 964float_error (signo)
965 int signo; 965 int signo;
966{ 966{
diff --git a/src/fns.c b/src/fns.c
index 9a009c8ab44..bce922859d1 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -348,7 +348,7 @@ Symbols are also allowed; their print names are used instead. */)
348 return i1 < SCHARS (s2) ? Qt : Qnil; 348 return i1 < SCHARS (s2) ? Qt : Qnil;
349} 349}
350 350
351static Lisp_Object concat (int nargs, Lisp_Object *args, 351static Lisp_Object concat (size_t nargs, Lisp_Object *args,
352 enum Lisp_Type target_type, int last_special); 352 enum Lisp_Type target_type, int last_special);
353 353
354/* ARGSUSED */ 354/* ARGSUSED */
@@ -378,7 +378,7 @@ The result is a list whose elements are the elements of all the arguments.
378Each argument may be a list, vector or string. 378Each argument may be a list, vector or string.
379The last argument is not copied, just used as the tail of the new list. 379The last argument is not copied, just used as the tail of the new list.
380usage: (append &rest SEQUENCES) */) 380usage: (append &rest SEQUENCES) */)
381 (int nargs, Lisp_Object *args) 381 (size_t nargs, Lisp_Object *args)
382{ 382{
383 return concat (nargs, args, Lisp_Cons, 1); 383 return concat (nargs, args, Lisp_Cons, 1);
384} 384}
@@ -388,7 +388,7 @@ DEFUN ("concat", Fconcat, Sconcat, 0, MANY, 0,
388The result is a string whose elements are the elements of all the arguments. 388The result is a string whose elements are the elements of all the arguments.
389Each argument may be a string or a list or vector of characters (integers). 389Each argument may be a string or a list or vector of characters (integers).
390usage: (concat &rest SEQUENCES) */) 390usage: (concat &rest SEQUENCES) */)
391 (int nargs, Lisp_Object *args) 391 (size_t nargs, Lisp_Object *args)
392{ 392{
393 return concat (nargs, args, Lisp_String, 0); 393 return concat (nargs, args, Lisp_String, 0);
394} 394}
@@ -398,7 +398,7 @@ DEFUN ("vconcat", Fvconcat, Svconcat, 0, MANY, 0,
398The result is a vector whose elements are the elements of all the arguments. 398The result is a vector whose elements are the elements of all the arguments.
399Each argument may be a list, vector or string. 399Each argument may be a list, vector or string.
400usage: (vconcat &rest SEQUENCES) */) 400usage: (vconcat &rest SEQUENCES) */)
401 (int nargs, Lisp_Object *args) 401 (size_t nargs, Lisp_Object *args)
402{ 402{
403 return concat (nargs, args, Lisp_Vectorlike, 0); 403 return concat (nargs, args, Lisp_Vectorlike, 0);
404} 404}
@@ -446,7 +446,8 @@ struct textprop_rec
446}; 446};
447 447
448static Lisp_Object 448static Lisp_Object
449concat (int nargs, Lisp_Object *args, enum Lisp_Type target_type, int last_special) 449concat (size_t nargs, Lisp_Object *args,
450 enum Lisp_Type target_type, int last_special)
450{ 451{
451 Lisp_Object val; 452 Lisp_Object val;
452 register Lisp_Object tail; 453 register Lisp_Object tail;
@@ -455,7 +456,7 @@ concat (int nargs, Lisp_Object *args, enum Lisp_Type target_type, int last_speci
455 EMACS_INT toindex_byte = 0; 456 EMACS_INT toindex_byte = 0;
456 register EMACS_INT result_len; 457 register EMACS_INT result_len;
457 register EMACS_INT result_len_byte; 458 register EMACS_INT result_len_byte;
458 register int argnum; 459 register size_t argnum;
459 Lisp_Object last_tail; 460 Lisp_Object last_tail;
460 Lisp_Object prev; 461 Lisp_Object prev;
461 int some_multibyte; 462 int some_multibyte;
@@ -2232,9 +2233,9 @@ DEFUN ("nconc", Fnconc, Snconc, 0, MANY, 0,
2232 doc: /* Concatenate any number of lists by altering them. 2233 doc: /* Concatenate any number of lists by altering them.
2233Only the last argument is not altered, and need not be a list. 2234Only the last argument is not altered, and need not be a list.
2234usage: (nconc &rest LISTS) */) 2235usage: (nconc &rest LISTS) */)
2235 (int nargs, Lisp_Object *args) 2236 (size_t nargs, Lisp_Object *args)
2236{ 2237{
2237 register int argnum; 2238 register size_t argnum;
2238 register Lisp_Object tail, tem, val; 2239 register Lisp_Object tail, tem, val;
2239 2240
2240 val = tail = Qnil; 2241 val = tail = Qnil;
@@ -2763,7 +2764,7 @@ DEFUN ("widget-apply", Fwidget_apply, Swidget_apply, 2, MANY, 0,
2763 doc: /* Apply the value of WIDGET's PROPERTY to the widget itself. 2764 doc: /* Apply the value of WIDGET's PROPERTY to the widget itself.
2764ARGS are passed as extra arguments to the function. 2765ARGS are passed as extra arguments to the function.
2765usage: (widget-apply WIDGET PROPERTY &rest ARGS) */) 2766usage: (widget-apply WIDGET PROPERTY &rest ARGS) */)
2766 (int nargs, Lisp_Object *args) 2767 (size_t nargs, Lisp_Object *args)
2767{ 2768{
2768 /* This function can GC. */ 2769 /* This function can GC. */
2769 Lisp_Object newargs[3]; 2770 Lisp_Object newargs[3];
@@ -3367,7 +3368,7 @@ Lisp_Object Qhash_table_test, Qkey_or_value, Qkey_and_value;
3367/* Function prototypes. */ 3368/* Function prototypes. */
3368 3369
3369static struct Lisp_Hash_Table *check_hash_table (Lisp_Object); 3370static struct Lisp_Hash_Table *check_hash_table (Lisp_Object);
3370static int get_key_arg (Lisp_Object, int, Lisp_Object *, char *); 3371static size_t get_key_arg (Lisp_Object, size_t, Lisp_Object *, char *);
3371static void maybe_resize_hash_table (struct Lisp_Hash_Table *); 3372static void maybe_resize_hash_table (struct Lisp_Hash_Table *);
3372static int cmpfn_eql (struct Lisp_Hash_Table *, Lisp_Object, unsigned, 3373static int cmpfn_eql (struct Lisp_Hash_Table *, Lisp_Object, unsigned,
3373 Lisp_Object, unsigned); 3374 Lisp_Object, unsigned);
@@ -3422,27 +3423,23 @@ next_almost_prime (int n)
3422/* Find KEY in ARGS which has size NARGS. Don't consider indices for 3423/* Find KEY in ARGS which has size NARGS. Don't consider indices for
3423 which USED[I] is non-zero. If found at index I in ARGS, set 3424 which USED[I] is non-zero. If found at index I in ARGS, set
3424 USED[I] and USED[I + 1] to 1, and return I + 1. Otherwise return 3425 USED[I] and USED[I + 1] to 1, and return I + 1. Otherwise return
3425 -1. This function is used to extract a keyword/argument pair from 3426 0. This function is used to extract a keyword/argument pair from
3426 a DEFUN parameter list. */ 3427 a DEFUN parameter list. */
3427 3428
3428static int 3429static size_t
3429get_key_arg (Lisp_Object key, int nargs, Lisp_Object *args, char *used) 3430get_key_arg (Lisp_Object key, size_t nargs, Lisp_Object *args, char *used)
3430{ 3431{
3431 int i; 3432 size_t i;
3432
3433 for (i = 0; i < nargs - 1; ++i)
3434 if (!used[i] && EQ (args[i], key))
3435 break;
3436 3433
3437 if (i >= nargs - 1) 3434 for (i = 1; i < nargs; i++)
3438 i = -1; 3435 if (!used[i - 1] && EQ (args[i - 1], key))
3439 else 3436 {
3440 { 3437 used[i - 1] = 1;
3441 used[i++] = 1; 3438 used[i] = 1;
3442 used[i] = 1; 3439 return i;
3443 } 3440 }
3444 3441
3445 return i; 3442 return 0;
3446} 3443}
3447 3444
3448 3445
@@ -4290,12 +4287,12 @@ WEAK. WEAK t is equivalent to `key-and-value'. Default value of WEAK
4290is nil. 4287is nil.
4291 4288
4292usage: (make-hash-table &rest KEYWORD-ARGS) */) 4289usage: (make-hash-table &rest KEYWORD-ARGS) */)
4293 (int nargs, Lisp_Object *args) 4290 (size_t nargs, Lisp_Object *args)
4294{ 4291{
4295 Lisp_Object test, size, rehash_size, rehash_threshold, weak; 4292 Lisp_Object test, size, rehash_size, rehash_threshold, weak;
4296 Lisp_Object user_test, user_hash; 4293 Lisp_Object user_test, user_hash;
4297 char *used; 4294 char *used;
4298 int i; 4295 size_t i;
4299 4296
4300 /* The vector `used' is used to keep track of arguments that 4297 /* The vector `used' is used to keep track of arguments that
4301 have been consumed. */ 4298 have been consumed. */
@@ -4304,7 +4301,7 @@ usage: (make-hash-table &rest KEYWORD-ARGS) */)
4304 4301
4305 /* See if there's a `:test TEST' among the arguments. */ 4302 /* See if there's a `:test TEST' among the arguments. */
4306 i = get_key_arg (QCtest, nargs, args, used); 4303 i = get_key_arg (QCtest, nargs, args, used);
4307 test = i < 0 ? Qeql : args[i]; 4304 test = i ? args[i] : Qeql;
4308 if (!EQ (test, Qeq) && !EQ (test, Qeql) && !EQ (test, Qequal)) 4305 if (!EQ (test, Qeq) && !EQ (test, Qeql) && !EQ (test, Qequal))
4309 { 4306 {
4310 /* See if it is a user-defined test. */ 4307 /* See if it is a user-defined test. */
@@ -4321,7 +4318,7 @@ usage: (make-hash-table &rest KEYWORD-ARGS) */)
4321 4318
4322 /* See if there's a `:size SIZE' argument. */ 4319 /* See if there's a `:size SIZE' argument. */
4323 i = get_key_arg (QCsize, nargs, args, used); 4320 i = get_key_arg (QCsize, nargs, args, used);
4324 size = i < 0 ? Qnil : args[i]; 4321 size = i ? args[i] : Qnil;
4325 if (NILP (size)) 4322 if (NILP (size))
4326 size = make_number (DEFAULT_HASH_SIZE); 4323 size = make_number (DEFAULT_HASH_SIZE);
4327 else if (!INTEGERP (size) || XINT (size) < 0) 4324 else if (!INTEGERP (size) || XINT (size) < 0)
@@ -4329,7 +4326,7 @@ usage: (make-hash-table &rest KEYWORD-ARGS) */)
4329 4326
4330 /* Look for `:rehash-size SIZE'. */ 4327 /* Look for `:rehash-size SIZE'. */
4331 i = get_key_arg (QCrehash_size, nargs, args, used); 4328 i = get_key_arg (QCrehash_size, nargs, args, used);
4332 rehash_size = i < 0 ? make_float (DEFAULT_REHASH_SIZE) : args[i]; 4329 rehash_size = i ? args[i] : make_float (DEFAULT_REHASH_SIZE);
4333 if (!NUMBERP (rehash_size) 4330 if (!NUMBERP (rehash_size)
4334 || (INTEGERP (rehash_size) && XINT (rehash_size) <= 0) 4331 || (INTEGERP (rehash_size) && XINT (rehash_size) <= 0)
4335 || XFLOATINT (rehash_size) <= 1.0) 4332 || XFLOATINT (rehash_size) <= 1.0)
@@ -4337,7 +4334,7 @@ usage: (make-hash-table &rest KEYWORD-ARGS) */)
4337 4334
4338 /* Look for `:rehash-threshold THRESHOLD'. */ 4335 /* Look for `:rehash-threshold THRESHOLD'. */
4339 i = get_key_arg (QCrehash_threshold, nargs, args, used); 4336 i = get_key_arg (QCrehash_threshold, nargs, args, used);
4340 rehash_threshold = i < 0 ? make_float (DEFAULT_REHASH_THRESHOLD) : args[i]; 4337 rehash_threshold = i ? args[i] : make_float (DEFAULT_REHASH_THRESHOLD);
4341 if (!FLOATP (rehash_threshold) 4338 if (!FLOATP (rehash_threshold)
4342 || XFLOATINT (rehash_threshold) <= 0.0 4339 || XFLOATINT (rehash_threshold) <= 0.0
4343 || XFLOATINT (rehash_threshold) > 1.0) 4340 || XFLOATINT (rehash_threshold) > 1.0)
@@ -4345,7 +4342,7 @@ usage: (make-hash-table &rest KEYWORD-ARGS) */)
4345 4342
4346 /* Look for `:weakness WEAK'. */ 4343 /* Look for `:weakness WEAK'. */
4347 i = get_key_arg (QCweakness, nargs, args, used); 4344 i = get_key_arg (QCweakness, nargs, args, used);
4348 weak = i < 0 ? Qnil : args[i]; 4345 weak = i ? args[i] : Qnil;
4349 if (EQ (weak, Qt)) 4346 if (EQ (weak, Qt))
4350 weak = Qkey_and_value; 4347 weak = Qkey_and_value;
4351 if (!NILP (weak) 4348 if (!NILP (weak)
diff --git a/src/font.c b/src/font.c
index 9e8b7029c22..6b2e2f2712d 100644
--- a/src/font.c
+++ b/src/font.c
@@ -3831,10 +3831,10 @@ be an OpenType font, and whose GPOS table of `thai' script's default
3831language system must contain `mark' feature. 3831language system must contain `mark' feature.
3832 3832
3833usage: (font-spec ARGS...) */) 3833usage: (font-spec ARGS...) */)
3834 (int nargs, Lisp_Object *args) 3834 (size_t nargs, Lisp_Object *args)
3835{ 3835{
3836 Lisp_Object spec = font_make_spec (); 3836 Lisp_Object spec = font_make_spec ();
3837 int i; 3837 size_t i;
3838 3838
3839 for (i = 0; i < nargs; i += 2) 3839 for (i = 0; i < nargs; i += 2)
3840 { 3840 {
diff --git a/src/frame.c b/src/frame.c
index 05938f3e1f0..1b6d36092ae 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -890,7 +890,7 @@ to that frame. */)
890{ 890{
891 /* Preserve prefix arg that the command loop just cleared. */ 891 /* Preserve prefix arg that the command loop just cleared. */
892 KVAR (current_kboard, Vprefix_arg) = Vcurrent_prefix_arg; 892 KVAR (current_kboard, Vprefix_arg) = Vcurrent_prefix_arg;
893 call1 (Vrun_hooks, Qmouse_leave_buffer_hook); 893 Frun_hooks (1, &Qmouse_leave_buffer_hook);
894 return do_switch_frame (event, 0, 0, Qnil); 894 return do_switch_frame (event, 0, 0, Qnil);
895} 895}
896 896
@@ -2529,7 +2529,7 @@ use is not recommended. Explicitly check for a frame-parameter instead. */)
2529 } 2529 }
2530 2530
2531 /* Now process them in reverse of specified order. */ 2531 /* Now process them in reverse of specified order. */
2532 for (i--; i >= 0; i--) 2532 while (--i >= 0)
2533 { 2533 {
2534 prop = parms[i]; 2534 prop = parms[i];
2535 val = values[i]; 2535 val = values[i];
@@ -2902,7 +2902,7 @@ x_set_frame_parameters (FRAME_PTR f, Lisp_Object alist)
2902 /* Record in these vectors all the parms specified. */ 2902 /* Record in these vectors all the parms specified. */
2903 Lisp_Object *parms; 2903 Lisp_Object *parms;
2904 Lisp_Object *values; 2904 Lisp_Object *values;
2905 int i, p; 2905 size_t i, p;
2906 int left_no_change = 0, top_no_change = 0; 2906 int left_no_change = 0, top_no_change = 0;
2907 int icon_left_no_change = 0, icon_top_no_change = 0; 2907 int icon_left_no_change = 0, icon_top_no_change = 0;
2908 int size_changed = 0; 2908 int size_changed = 0;
@@ -2975,7 +2975,7 @@ x_set_frame_parameters (FRAME_PTR f, Lisp_Object alist)
2975 } 2975 }
2976 2976
2977 /* Now process them in reverse of specified order. */ 2977 /* Now process them in reverse of specified order. */
2978 for (i--; i >= 0; i--) 2978 while (i-- != 0)
2979 { 2979 {
2980 Lisp_Object prop, val; 2980 Lisp_Object prop, val;
2981 2981
@@ -3713,8 +3713,7 @@ validate_x_resource_name (void)
3713 return; 3713 return;
3714 3714
3715 /* If name is entirely invalid, or nearly so, use `emacs'. */ 3715 /* If name is entirely invalid, or nearly so, use `emacs'. */
3716 if (good_count == 0 3716 if (good_count < 2)
3717 || (good_count == 1 && bad_count > 0))
3718 { 3717 {
3719 Vx_resource_name = build_string ("emacs"); 3718 Vx_resource_name = build_string ("emacs");
3720 return; 3719 return;
diff --git a/src/ftfont.c b/src/ftfont.c
index db6b29421dc..ad01149106e 100644
--- a/src/ftfont.c
+++ b/src/ftfont.c
@@ -168,11 +168,11 @@ get_adstyle_property (FcPattern *p)
168 for (end = str; *end && *end != ' '; end++); 168 for (end = str; *end && *end != ' '; end++);
169 if (*end) 169 if (*end)
170 { 170 {
171 char *p = alloca (end - str + 1); 171 char *newstr = alloca (end - str + 1);
172 memcpy (p, str, end - str); 172 memcpy (newstr, str, end - str);
173 p[end - str] = '\0'; 173 newstr[end - str] = '\0';
174 end = p + (end - str); 174 end = newstr + (end - str);
175 str = p; 175 str = newstr;
176 } 176 }
177 if (xstrcasecmp (str, "Regular") == 0 177 if (xstrcasecmp (str, "Regular") == 0
178 || xstrcasecmp (str, "Bold") == 0 178 || xstrcasecmp (str, "Bold") == 0
@@ -190,18 +190,18 @@ ftfont_pattern_entity (FcPattern *p, Lisp_Object extra)
190{ 190{
191 Lisp_Object key, cache, entity; 191 Lisp_Object key, cache, entity;
192 char *file, *str; 192 char *file, *str;
193 int index; 193 int idx;
194 int numeric; 194 int numeric;
195 double dbl; 195 double dbl;
196 FcBool b; 196 FcBool b;
197 197
198 if (FcPatternGetString (p, FC_FILE, 0, (FcChar8 **) &file) != FcResultMatch) 198 if (FcPatternGetString (p, FC_FILE, 0, (FcChar8 **) &file) != FcResultMatch)
199 return Qnil; 199 return Qnil;
200 if (FcPatternGetInteger (p, FC_INDEX, 0, &index) != FcResultMatch) 200 if (FcPatternGetInteger (p, FC_INDEX, 0, &idx) != FcResultMatch)
201 return Qnil; 201 return Qnil;
202 202
203 key = Fcons (make_unibyte_string ((char *) file, strlen ((char *) file)), 203 key = Fcons (make_unibyte_string ((char *) file, strlen ((char *) file)),
204 make_number (index)); 204 make_number (idx));
205 cache = ftfont_lookup_cache (key, FTFONT_CACHE_FOR_ENTITY); 205 cache = ftfont_lookup_cache (key, FTFONT_CACHE_FOR_ENTITY);
206 entity = XCAR (cache); 206 entity = XCAR (cache);
207 if (! NILP (entity)) 207 if (! NILP (entity))
@@ -265,7 +265,7 @@ ftfont_pattern_entity (FcPattern *p, Lisp_Object extra)
265 265
266 ASET (entity, FONT_ADSTYLE_INDEX, get_adstyle_property (p)); 266 ASET (entity, FONT_ADSTYLE_INDEX, get_adstyle_property (p));
267 if ((ft_library || FT_Init_FreeType (&ft_library) == 0) 267 if ((ft_library || FT_Init_FreeType (&ft_library) == 0)
268 && FT_New_Face (ft_library, file, index, &ft_face) == 0) 268 && FT_New_Face (ft_library, file, idx, &ft_face) == 0)
269 { 269 {
270 BDF_PropertyRec rec; 270 BDF_PropertyRec rec;
271 271
@@ -311,8 +311,9 @@ ftfont_resolve_generic_family (Lisp_Object family, FcPattern *pattern)
311 if (FcPatternGetLangSet (pattern, FC_LANG, 0, &langset) != FcResultMatch) 311 if (FcPatternGetLangSet (pattern, FC_LANG, 0, &langset) != FcResultMatch)
312 { 312 {
313 /* This is to avoid the effect of locale. */ 313 /* This is to avoid the effect of locale. */
314 static const FcChar8 lang[] = "en";
314 langset = FcLangSetCreate (); 315 langset = FcLangSetCreate ();
315 FcLangSetAdd (langset, "en"); 316 FcLangSetAdd (langset, lang);
316 FcPatternAddLangSet (pattern, FC_LANG, langset); 317 FcPatternAddLangSet (pattern, FC_LANG, langset);
317 FcLangSetDestroy (langset); 318 FcLangSetDestroy (langset);
318 } 319 }
@@ -393,14 +394,14 @@ ftfont_lookup_cache (Lisp_Object key, enum ftfont_cache_for cache_for)
393 ? ! cache_data->ft_face : ! cache_data->fc_charset) 394 ? ! cache_data->ft_face : ! cache_data->fc_charset)
394 { 395 {
395 char *filename = SSDATA (XCAR (key)); 396 char *filename = SSDATA (XCAR (key));
396 int index = XINT (XCDR (key)); 397 int idx = XINT (XCDR (key));
397 398
398 if (cache_for == FTFONT_CACHE_FOR_FACE) 399 if (cache_for == FTFONT_CACHE_FOR_FACE)
399 { 400 {
400 if (! ft_library 401 if (! ft_library
401 && FT_Init_FreeType (&ft_library) != 0) 402 && FT_Init_FreeType (&ft_library) != 0)
402 return Qnil; 403 return Qnil;
403 if (FT_New_Face (ft_library, filename, index, &cache_data->ft_face) 404 if (FT_New_Face (ft_library, filename, idx, &cache_data->ft_face)
404 != 0) 405 != 0)
405 return Qnil; 406 return Qnil;
406 } 407 }
@@ -412,7 +413,7 @@ ftfont_lookup_cache (Lisp_Object key, enum ftfont_cache_for cache_for)
412 FcCharSet *charset = NULL; 413 FcCharSet *charset = NULL;
413 414
414 pat = FcPatternBuild (0, FC_FILE, FcTypeString, (FcChar8 *) filename, 415 pat = FcPatternBuild (0, FC_FILE, FcTypeString, (FcChar8 *) filename,
415 FC_INDEX, FcTypeInteger, index, NULL); 416 FC_INDEX, FcTypeInteger, idx, NULL);
416 if (! pat) 417 if (! pat)
417 goto finish; 418 goto finish;
418 objset = FcObjectSetBuild (FC_CHARSET, FC_STYLE, NULL); 419 objset = FcObjectSetBuild (FC_CHARSET, FC_STYLE, NULL);
@@ -490,8 +491,12 @@ static int ftfont_get_bitmap (struct font *, unsigned,
490 struct font_bitmap *, int); 491 struct font_bitmap *, int);
491static int ftfont_anchor_point (struct font *, unsigned, int, 492static int ftfont_anchor_point (struct font *, unsigned, int,
492 int *, int *); 493 int *, int *);
494#ifdef HAVE_LIBOTF
493static Lisp_Object ftfont_otf_capability (struct font *); 495static Lisp_Object ftfont_otf_capability (struct font *);
496# ifdef HAVE_M17N_FLT
494static Lisp_Object ftfont_shape (Lisp_Object); 497static Lisp_Object ftfont_shape (Lisp_Object);
498# endif
499#endif
495 500
496#ifdef HAVE_OTF_GET_VARIATION_GLYPHS 501#ifdef HAVE_OTF_GET_VARIATION_GLYPHS
497static int ftfont_variation_glyphs (struct font *, int c, 502static int ftfont_variation_glyphs (struct font *, int c,
@@ -618,6 +623,7 @@ struct OpenTypeSpec
618 (P)[4] = '\0'; \ 623 (P)[4] = '\0'; \
619 } while (0) 624 } while (0)
620 625
626#ifdef HAVE_LIBOTF
621#define OTF_TAG_SYM(SYM, TAG) \ 627#define OTF_TAG_SYM(SYM, TAG) \
622 do { \ 628 do { \
623 char str[5]; \ 629 char str[5]; \
@@ -625,6 +631,7 @@ struct OpenTypeSpec
625 OTF_TAG_STR (TAG, str); \ 631 OTF_TAG_STR (TAG, str); \
626 (SYM) = font_intern_prop (str, 4, 1); \ 632 (SYM) = font_intern_prop (str, 4, 1); \
627 } while (0) 633 } while (0)
634#endif
628 635
629 636
630static struct OpenTypeSpec * 637static struct OpenTypeSpec *
@@ -864,7 +871,6 @@ ftfont_list (Lisp_Object frame, Lisp_Object spec)
864 FcObjectSet *objset = NULL; 871 FcObjectSet *objset = NULL;
865 FcCharSet *charset; 872 FcCharSet *charset;
866 Lisp_Object chars = Qnil; 873 Lisp_Object chars = Qnil;
867 FcResult result;
868 char otlayout[15]; /* For "otlayout:XXXX" */ 874 char otlayout[15]; /* For "otlayout:XXXX" */
869 struct OpenTypeSpec *otspec = NULL; 875 struct OpenTypeSpec *otspec = NULL;
870 int spacing = -1; 876 int spacing = -1;
@@ -1153,7 +1159,7 @@ ftfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size)
1153 FT_Face ft_face; 1159 FT_Face ft_face;
1154 FT_Size ft_size; 1160 FT_Size ft_size;
1155 FT_UInt size; 1161 FT_UInt size;
1156 Lisp_Object val, filename, index, cache, font_object; 1162 Lisp_Object val, filename, idx, cache, font_object;
1157 int scalable; 1163 int scalable;
1158 int spacing; 1164 int spacing;
1159 char name[256]; 1165 char name[256];
@@ -1168,7 +1174,7 @@ ftfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size)
1168 if (NILP (cache)) 1174 if (NILP (cache))
1169 return Qnil; 1175 return Qnil;
1170 filename = XCAR (val); 1176 filename = XCAR (val);
1171 index = XCDR (val); 1177 idx = XCDR (val);
1172 val = XCDR (cache); 1178 val = XCDR (cache);
1173 cache_data = XSAVE_VALUE (XCDR (cache))->pointer; 1179 cache_data = XSAVE_VALUE (XCDR (cache))->pointer;
1174 ft_face = cache_data->ft_face; 1180 ft_face = cache_data->ft_face;
@@ -1210,7 +1216,7 @@ ftfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size)
1210 font = XFONT_OBJECT (font_object); 1216 font = XFONT_OBJECT (font_object);
1211 ftfont_info = (struct ftfont_info *) font; 1217 ftfont_info = (struct ftfont_info *) font;
1212 ftfont_info->ft_size = ft_face->size; 1218 ftfont_info->ft_size = ft_face->size;
1213 ftfont_info->index = XINT (index); 1219 ftfont_info->index = XINT (idx);
1214#ifdef HAVE_LIBOTF 1220#ifdef HAVE_LIBOTF
1215 ftfont_info->maybe_otf = ft_face->face_flags & FT_FACE_FLAG_SFNT; 1221 ftfont_info->maybe_otf = ft_face->face_flags & FT_FACE_FLAG_SFNT;
1216 ftfont_info->otf = NULL; 1222 ftfont_info->otf = NULL;
@@ -1455,7 +1461,8 @@ ftfont_get_bitmap (struct font *font, unsigned int code, struct font_bitmap *bit
1455} 1461}
1456 1462
1457static int 1463static int
1458ftfont_anchor_point (struct font *font, unsigned int code, int index, int *x, int *y) 1464ftfont_anchor_point (struct font *font, unsigned int code, int idx,
1465 int *x, int *y)
1459{ 1466{
1460 struct ftfont_info *ftfont_info = (struct ftfont_info *) font; 1467 struct ftfont_info *ftfont_info = (struct ftfont_info *) font;
1461 FT_Face ft_face = ftfont_info->ft_size->face; 1468 FT_Face ft_face = ftfont_info->ft_size->face;
@@ -1466,10 +1473,10 @@ ftfont_anchor_point (struct font *font, unsigned int code, int index, int *x, in
1466 return -1; 1473 return -1;
1467 if (ft_face->glyph->format != FT_GLYPH_FORMAT_OUTLINE) 1474 if (ft_face->glyph->format != FT_GLYPH_FORMAT_OUTLINE)
1468 return -1; 1475 return -1;
1469 if (index >= ft_face->glyph->outline.n_points) 1476 if (idx >= ft_face->glyph->outline.n_points)
1470 return -1; 1477 return -1;
1471 *x = ft_face->glyph->outline.points[index].x; 1478 *x = ft_face->glyph->outline.points[idx].x;
1472 *y = ft_face->glyph->outline.points[index].y; 1479 *y = ft_face->glyph->outline.points[idx].y;
1473 return 0; 1480 return 0;
1474} 1481}
1475 1482
diff --git a/src/gtkutil.c b/src/gtkutil.c
index 754f61e366d..4e5ecce76c7 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -1555,7 +1555,7 @@ static gboolean
1555xg_maybe_add_timer (gpointer data) 1555xg_maybe_add_timer (gpointer data)
1556{ 1556{
1557 struct xg_dialog_data *dd = (struct xg_dialog_data *) data; 1557 struct xg_dialog_data *dd = (struct xg_dialog_data *) data;
1558 EMACS_TIME next_time = timer_check (1); 1558 EMACS_TIME next_time = timer_check ();
1559 long secs = EMACS_SECS (next_time); 1559 long secs = EMACS_SECS (next_time);
1560 long usecs = EMACS_USECS (next_time); 1560 long usecs = EMACS_USECS (next_time);
1561 1561
diff --git a/src/image.c b/src/image.c
index 91308c540b5..b37ba398d83 100644
--- a/src/image.c
+++ b/src/image.c
@@ -4483,7 +4483,6 @@ static void
4483XPutPixel (XImagePtr ximg, int x, int y, COLORREF color) 4483XPutPixel (XImagePtr ximg, int x, int y, COLORREF color)
4484{ 4484{
4485 int width = ximg->info.bmiHeader.biWidth; 4485 int width = ximg->info.bmiHeader.biWidth;
4486 int height = ximg->info.bmiHeader.biHeight;
4487 unsigned char * pixel; 4486 unsigned char * pixel;
4488 4487
4489 /* True color images. */ 4488 /* True color images. */
@@ -6752,7 +6751,7 @@ tiff_load (struct frame *f, struct image *img)
6752 TIFF *tiff; 6751 TIFF *tiff;
6753 int width, height, x, y, count; 6752 int width, height, x, y, count;
6754 uint32 *buf; 6753 uint32 *buf;
6755 int rc, rc2; 6754 int rc;
6756 XImagePtr ximg; 6755 XImagePtr ximg;
6757 tiff_memory_source memsrc; 6756 tiff_memory_source memsrc;
6758 Lisp_Object image; 6757 Lisp_Object image;
@@ -6840,8 +6839,8 @@ tiff_load (struct frame *f, struct image *img)
6840 rc = fn_TIFFReadRGBAImage (tiff, width, height, buf, 0); 6839 rc = fn_TIFFReadRGBAImage (tiff, width, height, buf, 0);
6841 6840
6842 /* Count the number of images in the file. */ 6841 /* Count the number of images in the file. */
6843 for (count = 1, rc2 = 1; rc2; count++) 6842 for (count = 1; fn_TIFFSetDirectory (tiff, count); count++)
6844 rc2 = fn_TIFFSetDirectory (tiff, count); 6843 continue;
6845 6844
6846 if (count > 1) 6845 if (count > 1)
6847 img->data.lisp_val = Fcons (Qcount, 6846 img->data.lisp_val = Fcons (Qcount,
diff --git a/src/insdel.c b/src/insdel.c
index ad3460f9a64..4bdcb4bc0b7 100644
--- a/src/insdel.c
+++ b/src/insdel.c
@@ -41,8 +41,6 @@ static void insert_from_buffer_1 (struct buffer *buf,
41 int inherit); 41 int inherit);
42static void gap_left (EMACS_INT charpos, EMACS_INT bytepos, int newgap); 42static void gap_left (EMACS_INT charpos, EMACS_INT bytepos, int newgap);
43static void gap_right (EMACS_INT charpos, EMACS_INT bytepos); 43static void gap_right (EMACS_INT charpos, EMACS_INT bytepos);
44static void adjust_markers_gap_motion (EMACS_INT from, EMACS_INT to,
45 EMACS_INT amount);
46static void adjust_markers_for_insert (EMACS_INT from, EMACS_INT from_byte, 44static void adjust_markers_for_insert (EMACS_INT from, EMACS_INT from_byte,
47 EMACS_INT to, EMACS_INT to_byte, 45 EMACS_INT to, EMACS_INT to_byte,
48 int before_markers); 46 int before_markers);
@@ -162,10 +160,9 @@ gap_left (EMACS_INT charpos, EMACS_INT bytepos, int newgap)
162 memmove (to, from, i); 160 memmove (to, from, i);
163 } 161 }
164 162
165 /* Adjust markers, and buffer data structure, to put the gap at BYTEPOS. 163 /* Adjust buffer data structure, to put the gap at BYTEPOS.
166 BYTEPOS is where the loop above stopped, which may be what was specified 164 BYTEPOS is where the loop above stopped, which may be what
167 or may be where a quit was detected. */ 165 was specified or may be where a quit was detected. */
168 adjust_markers_gap_motion (bytepos, GPT_BYTE, GAP_SIZE);
169 GPT_BYTE = bytepos; 166 GPT_BYTE = bytepos;
170 GPT = charpos; 167 GPT = charpos;
171 if (bytepos < charpos) 168 if (bytepos < charpos)
@@ -217,8 +214,6 @@ gap_right (EMACS_INT charpos, EMACS_INT bytepos)
217 from += i, to += i; 214 from += i, to += i;
218 } 215 }
219 216
220 adjust_markers_gap_motion (GPT_BYTE + GAP_SIZE, bytepos + GAP_SIZE,
221 - GAP_SIZE);
222 GPT = charpos; 217 GPT = charpos;
223 GPT_BYTE = bytepos; 218 GPT_BYTE = bytepos;
224 if (bytepos < charpos) 219 if (bytepos < charpos)
@@ -227,67 +222,6 @@ gap_right (EMACS_INT charpos, EMACS_INT bytepos)
227 QUIT; 222 QUIT;
228} 223}
229 224
230/* Add AMOUNT to the byte position of every marker in the current buffer
231 whose current byte position is between FROM (exclusive) and TO (inclusive).
232
233 Also, any markers past the outside of that interval, in the direction
234 of adjustment, are first moved back to the near end of the interval
235 and then adjusted by AMOUNT.
236
237 When the latter adjustment is done, if AMOUNT is negative,
238 we record the adjustment for undo. (This case happens only for
239 deletion.)
240
241 The markers' character positions are not altered,
242 because gap motion does not affect character positions. */
243
244int adjust_markers_test;
245
246static void
247adjust_markers_gap_motion (EMACS_INT from, EMACS_INT to, EMACS_INT amount)
248{
249 /* Now that a marker has a bytepos, not counting the gap,
250 nothing needs to be done here. */
251#if 0
252 Lisp_Object marker;
253 register struct Lisp_Marker *m;
254 register EMACS_INT mpos;
255
256 marker = BUF_MARKERS (current_buffer);
257
258 while (!NILP (marker))
259 {
260 m = XMARKER (marker);
261 mpos = m->bytepos;
262 if (amount > 0)
263 {
264 if (mpos > to && mpos < to + amount)
265 {
266 if (adjust_markers_test)
267 abort ();
268 mpos = to + amount;
269 }
270 }
271 else
272 {
273 /* Here's the case where a marker is inside text being deleted.
274 AMOUNT can be negative for gap motion, too,
275 but then this range contains no markers. */
276 if (mpos > from + amount && mpos <= from)
277 {
278 if (adjust_markers_test)
279 abort ();
280 mpos = from + amount;
281 }
282 }
283 if (mpos > from && mpos <= to)
284 mpos += amount;
285 m->bufpos = mpos;
286 marker = m->chain;
287 }
288#endif
289}
290
291/* Adjust all markers for a deletion 225/* Adjust all markers for a deletion
292 whose range in bytes is FROM_BYTE to TO_BYTE. 226 whose range in bytes is FROM_BYTE to TO_BYTE.
293 The range in charpos is FROM to TO. 227 The range in charpos is FROM to TO.
@@ -2137,14 +2071,14 @@ signal_before_change (EMACS_INT start_int, EMACS_INT end_int,
2137 2071
2138 specbind (Qinhibit_modification_hooks, Qt); 2072 specbind (Qinhibit_modification_hooks, Qt);
2139 2073
2140 /* If buffer is unmodified, run a special hook for that case. */ 2074 /* If buffer is unmodified, run a special hook for that case. The
2075 check for Vfirst_change_hook is just a minor optimization. */
2141 if (SAVE_MODIFF >= MODIFF 2076 if (SAVE_MODIFF >= MODIFF
2142 && !NILP (Vfirst_change_hook) 2077 && !NILP (Vfirst_change_hook))
2143 && !NILP (Vrun_hooks))
2144 { 2078 {
2145 PRESERVE_VALUE; 2079 PRESERVE_VALUE;
2146 PRESERVE_START_END; 2080 PRESERVE_START_END;
2147 call1 (Vrun_hooks, Qfirst_change_hook); 2081 Frun_hooks (1, &Qfirst_change_hook);
2148 } 2082 }
2149 2083
2150 /* Now run the before-change-functions if any. */ 2084 /* Now run the before-change-functions if any. */
diff --git a/src/intervals.c b/src/intervals.c
index 12b2789cc77..351677ad27e 100644
--- a/src/intervals.c
+++ b/src/intervals.c
@@ -586,7 +586,7 @@ split_interval_left (INTERVAL interval, EMACS_INT offset)
586 Don't use this function on an interval which is the child 586 Don't use this function on an interval which is the child
587 of another interval! */ 587 of another interval! */
588 588
589int 589static int
590interval_start_pos (INTERVAL source) 590interval_start_pos (INTERVAL source)
591{ 591{
592 Lisp_Object parent; 592 Lisp_Object parent;
@@ -2559,4 +2559,3 @@ set_intervals_multibyte (int multi_flag)
2559 set_intervals_multibyte_1 (BUF_INTERVALS (current_buffer), multi_flag, 2559 set_intervals_multibyte_1 (BUF_INTERVALS (current_buffer), multi_flag,
2560 BEG, BEG_BYTE, Z, Z_BYTE); 2560 BEG, BEG_BYTE, Z, Z_BYTE);
2561} 2561}
2562
diff --git a/src/intervals.h b/src/intervals.h
index f6c1c002ce0..d7c34012e1f 100644
--- a/src/intervals.h
+++ b/src/intervals.h
@@ -161,8 +161,13 @@ struct interval
161 (INTERVAL_HAS_PARENT (i) ? INTERVAL_PARENT (i) : 0) 161 (INTERVAL_HAS_PARENT (i) ? INTERVAL_PARENT (i) : 0)
162 162
163/* Abort if interval I's size is negative. */ 163/* Abort if interval I's size is negative. */
164#define CHECK_TOTAL_LENGTH(i) \ 164#define CHECK_TOTAL_LENGTH(i) \
165 if ((int) (i)->total_length < 0) abort (); else 165 do \
166 { \
167 if ((int) (i)->total_length < 0) \
168 abort (); \
169 } \
170 while (0)
166 171
167/* Reset this interval to its vanilla, or no-property state. */ 172/* Reset this interval to its vanilla, or no-property state. */
168#define RESET_INTERVAL(i) \ 173#define RESET_INTERVAL(i) \
@@ -339,4 +344,3 @@ extern Lisp_Object get_pos_property (Lisp_Object pos, Lisp_Object prop,
339extern void syms_of_textprop (void); 344extern void syms_of_textprop (void);
340 345
341#include "composite.h" 346#include "composite.h"
342
diff --git a/src/keyboard.c b/src/keyboard.c
index 63e7573fbe9..d307250b868 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -201,8 +201,8 @@ Lisp_Object unread_switch_frame;
201/* Last size recorded for a current buffer which is not a minibuffer. */ 201/* Last size recorded for a current buffer which is not a minibuffer. */
202static EMACS_INT last_non_minibuf_size; 202static EMACS_INT last_non_minibuf_size;
203 203
204/* Total number of times read_char has returned. */ 204/* Total number of times read_char has returned, modulo SIZE_MAX + 1. */
205int num_input_events; 205size_t num_input_events;
206 206
207/* Value of num_nonmacro_input_events as of last auto save. */ 207/* Value of num_nonmacro_input_events as of last auto save. */
208 208
@@ -254,7 +254,6 @@ Lisp_Object Qecho_area_clear_hook;
254/* Hooks to run before and after each command. */ 254/* Hooks to run before and after each command. */
255Lisp_Object Qpre_command_hook; 255Lisp_Object Qpre_command_hook;
256Lisp_Object Qpost_command_hook; 256Lisp_Object Qpost_command_hook;
257Lisp_Object Qcommand_hook_internal;
258 257
259Lisp_Object Qdeferred_action_function; 258Lisp_Object Qdeferred_action_function;
260 259
@@ -351,7 +350,7 @@ Lisp_Object Qmenu_bar;
351Lisp_Object recursive_edit_unwind (Lisp_Object buffer), command_loop (void); 350Lisp_Object recursive_edit_unwind (Lisp_Object buffer), command_loop (void);
352Lisp_Object Fthis_command_keys (void); 351Lisp_Object Fthis_command_keys (void);
353Lisp_Object Qextended_command_history; 352Lisp_Object Qextended_command_history;
354EMACS_TIME timer_check (int do_it_now); 353EMACS_TIME timer_check (void);
355 354
356static void record_menu_key (Lisp_Object c); 355static void record_menu_key (Lisp_Object c);
357static int echo_length (void); 356static int echo_length (void);
@@ -434,15 +433,15 @@ static void restore_getcjmp (jmp_buf);
434static Lisp_Object apply_modifiers (int, Lisp_Object); 433static Lisp_Object apply_modifiers (int, Lisp_Object);
435static void clear_event (struct input_event *); 434static void clear_event (struct input_event *);
436static Lisp_Object restore_kboard_configuration (Lisp_Object); 435static Lisp_Object restore_kboard_configuration (Lisp_Object);
437static SIGTYPE interrupt_signal (int signalnum); 436static void interrupt_signal (int signalnum);
438#ifdef SIGIO 437#ifdef SIGIO
439static SIGTYPE input_available_signal (int signo); 438static void input_available_signal (int signo);
440#endif 439#endif
441static void handle_interrupt (void); 440static void handle_interrupt (void);
442static void timer_start_idle (void); 441static void timer_start_idle (void);
443static void timer_stop_idle (void); 442static void timer_stop_idle (void);
444static void timer_resume_idle (void); 443static void timer_resume_idle (void);
445static SIGTYPE handle_user_signal (int); 444static void handle_user_signal (int);
446static char *find_user_signal_name (int); 445static char *find_user_signal_name (int);
447static int store_user_signal_events (void); 446static int store_user_signal_events (void);
448 447
@@ -1270,7 +1269,7 @@ some_mouse_moved (void)
1270/* This is the actual command reading loop, 1269/* This is the actual command reading loop,
1271 sans error-handling encapsulation. */ 1270 sans error-handling encapsulation. */
1272 1271
1273static int read_key_sequence (Lisp_Object *, int, Lisp_Object, 1272static int read_key_sequence (Lisp_Object *, size_t, Lisp_Object,
1274 int, int, int); 1273 int, int, int);
1275void safe_run_hooks (Lisp_Object); 1274void safe_run_hooks (Lisp_Object);
1276static void adjust_point_for_property (EMACS_INT, int); 1275static void adjust_point_for_property (EMACS_INT, int);
@@ -1492,10 +1491,7 @@ command_loop_1 (void)
1492 1491
1493 Vthis_command = cmd; 1492 Vthis_command = cmd;
1494 real_this_command = cmd; 1493 real_this_command = cmd;
1495 /* Note that the value cell will never directly contain nil 1494 safe_run_hooks (Qpre_command_hook);
1496 if the symbol is a local variable. */
1497 if (!NILP (Vpre_command_hook) && !NILP (Vrun_hooks))
1498 safe_run_hooks (Qpre_command_hook);
1499 1495
1500 already_adjusted = 0; 1496 already_adjusted = 0;
1501 1497
@@ -1541,18 +1537,14 @@ command_loop_1 (void)
1541 } 1537 }
1542 KVAR (current_kboard, Vlast_prefix_arg) = Vcurrent_prefix_arg; 1538 KVAR (current_kboard, Vlast_prefix_arg) = Vcurrent_prefix_arg;
1543 1539
1544 /* Note that the value cell will never directly contain nil 1540 safe_run_hooks (Qpost_command_hook);
1545 if the symbol is a local variable. */
1546 if (!NILP (Vpost_command_hook) && !NILP (Vrun_hooks))
1547 safe_run_hooks (Qpost_command_hook);
1548 1541
1549 /* If displaying a message, resize the echo area window to fit 1542 /* If displaying a message, resize the echo area window to fit
1550 that message's size exactly. */ 1543 that message's size exactly. */
1551 if (!NILP (echo_area_buffer[0])) 1544 if (!NILP (echo_area_buffer[0]))
1552 resize_echo_area_exactly (); 1545 resize_echo_area_exactly ();
1553 1546
1554 if (!NILP (Vdeferred_action_list)) 1547 safe_run_hooks (Qdeferred_action_function);
1555 safe_run_hooks (Qdeferred_action_function);
1556 1548
1557 /* If there is a prefix argument, 1549 /* If there is a prefix argument,
1558 1) We don't want Vlast_command to be ``universal-argument'' 1550 1) We don't want Vlast_command to be ``universal-argument''
@@ -1621,7 +1613,10 @@ command_loop_1 (void)
1621 } 1613 }
1622 1614
1623 if (current_buffer != prev_buffer || MODIFF != prev_modiff) 1615 if (current_buffer != prev_buffer || MODIFF != prev_modiff)
1624 call1 (Vrun_hooks, intern ("activate-mark-hook")); 1616 {
1617 Lisp_Object hook = intern ("activate-mark-hook");
1618 Frun_hooks (1, &hook);
1619 }
1625 } 1620 }
1626 1621
1627 Vsaved_region_selection = Qnil; 1622 Vsaved_region_selection = Qnil;
@@ -1819,22 +1814,63 @@ adjust_point_for_property (EMACS_INT last_pt, int modified)
1819static Lisp_Object 1814static Lisp_Object
1820safe_run_hooks_1 (void) 1815safe_run_hooks_1 (void)
1821{ 1816{
1822 if (NILP (Vrun_hooks)) 1817 eassert (CONSP (Vinhibit_quit));
1823 return Qnil; 1818 return call0 (XCDR (Vinhibit_quit));
1824 return call1 (Vrun_hooks, Vinhibit_quit);
1825} 1819}
1826 1820
1827/* Subroutine for safe_run_hooks: handle an error by clearing out the hook. */ 1821/* Subroutine for safe_run_hooks: handle an error by clearing out the function
1822 from the hook. */
1823
1824static Lisp_Object
1825safe_run_hooks_error (Lisp_Object error_data)
1826{
1827 Lisp_Object hook
1828 = CONSP (Vinhibit_quit) ? XCAR (Vinhibit_quit) : Vinhibit_quit;
1829 Lisp_Object fun = CONSP (Vinhibit_quit) ? XCDR (Vinhibit_quit) : Qnil;
1830 Lisp_Object args[4];
1831 args[0] = build_string ("Error in %s (%s): %s");
1832 args[1] = hook;
1833 args[2] = fun;
1834 args[3] = error_data;
1835 Fmessage (4, args);
1836 if (SYMBOLP (hook))
1837 {
1838 Lisp_Object val;
1839 int found = 0;
1840 Lisp_Object newval = Qnil;
1841 for (val = find_symbol_value (hook); CONSP (val); val = XCDR (val))
1842 if (EQ (fun, XCAR (val)))
1843 found = 1;
1844 else
1845 newval = Fcons (XCAR (val), newval);
1846 if (found)
1847 return Fset (hook, Fnreverse (newval));
1848 /* Not found in the local part of the hook. Let's look at the global
1849 part. */
1850 newval = Qnil;
1851 for (val = (NILP (Fdefault_boundp (hook)) ? Qnil
1852 : Fdefault_value (hook));
1853 CONSP (val); val = XCDR (val))
1854 if (EQ (fun, XCAR (val)))
1855 found = 1;
1856 else
1857 newval = Fcons (XCAR (val), newval);
1858 if (found)
1859 return Fset_default (hook, Fnreverse (newval));
1860 }
1861 return Qnil;
1862}
1828 1863
1829static Lisp_Object 1864static Lisp_Object
1830safe_run_hooks_error (Lisp_Object data) 1865safe_run_hook_funcall (size_t nargs, Lisp_Object *args)
1831{ 1866{
1832 Lisp_Object args[3]; 1867 eassert (nargs == 1);
1833 args[0] = build_string ("Error in %s: %s"); 1868 if (CONSP (Vinhibit_quit))
1834 args[1] = Vinhibit_quit; 1869 XSETCDR (Vinhibit_quit, args[0]);
1835 args[2] = data; 1870 else
1836 Fmessage (3, args); 1871 Vinhibit_quit = Fcons (Vinhibit_quit, args[0]);
1837 return Fset (Vinhibit_quit, Qnil); 1872
1873 return internal_condition_case (safe_run_hooks_1, Qt, safe_run_hooks_error);
1838} 1874}
1839 1875
1840/* If we get an error while running the hook, cause the hook variable 1876/* If we get an error while running the hook, cause the hook variable
@@ -1844,10 +1880,13 @@ safe_run_hooks_error (Lisp_Object data)
1844void 1880void
1845safe_run_hooks (Lisp_Object hook) 1881safe_run_hooks (Lisp_Object hook)
1846{ 1882{
1883 /* FIXME: our `internal_condition_case' does not provide any way to pass data
1884 to its body or to its handlers other than via globals such as
1885 dynamically-bound variables ;-) */
1847 int count = SPECPDL_INDEX (); 1886 int count = SPECPDL_INDEX ();
1848 specbind (Qinhibit_quit, hook); 1887 specbind (Qinhibit_quit, hook);
1849 1888
1850 internal_condition_case (safe_run_hooks_1, Qt, safe_run_hooks_error); 1889 run_hook_with_args (1, &hook, safe_run_hook_funcall);
1851 1890
1852 unbind_to (count, Qnil); 1891 unbind_to (count, Qnil);
1853} 1892}
@@ -2074,16 +2113,12 @@ make_ctrl_char (int c)
2074 the `display' property). POS is the position in that string under 2113 the `display' property). POS is the position in that string under
2075 the mouse. 2114 the mouse.
2076 2115
2077 OK_TO_OVERWRITE_KEYSTROKE_ECHO non-zero means it's okay if the help
2078 echo overwrites a keystroke echo currently displayed in the echo
2079 area.
2080
2081 Note: this function may only be called with HELP nil or a string 2116 Note: this function may only be called with HELP nil or a string
2082 from X code running asynchronously. */ 2117 from X code running asynchronously. */
2083 2118
2084void 2119void
2085show_help_echo (Lisp_Object help, Lisp_Object window, Lisp_Object object, 2120show_help_echo (Lisp_Object help, Lisp_Object window, Lisp_Object object,
2086 Lisp_Object pos, int ok_to_overwrite_keystroke_echo) 2121 Lisp_Object pos)
2087{ 2122{
2088 if (!NILP (help) && !STRINGP (help)) 2123 if (!NILP (help) && !STRINGP (help))
2089 { 2124 {
@@ -3013,7 +3048,7 @@ read_char (int commandflag, int nmaps, Lisp_Object *maps, Lisp_Object prev_event
3013 htem = Fcdr (htem); 3048 htem = Fcdr (htem);
3014 position = Fcar (htem); 3049 position = Fcar (htem);
3015 3050
3016 show_help_echo (help, window, object, position, 0); 3051 show_help_echo (help, window, object, position);
3017 3052
3018 /* We stopped being idle for this event; undo that. */ 3053 /* We stopped being idle for this event; undo that. */
3019 if (!end_time) 3054 if (!end_time)
@@ -3315,7 +3350,7 @@ static int
3315readable_events (int flags) 3350readable_events (int flags)
3316{ 3351{
3317 if (flags & READABLE_EVENTS_DO_TIMERS_NOW) 3352 if (flags & READABLE_EVENTS_DO_TIMERS_NOW)
3318 timer_check (1); 3353 timer_check ();
3319 3354
3320 /* If the buffer contains only FOCUS_IN_EVENT events, and 3355 /* If the buffer contains only FOCUS_IN_EVENT events, and
3321 READABLE_EVENTS_FILTER_EVENTS is set, report it as empty. */ 3356 READABLE_EVENTS_FILTER_EVENTS is set, report it as empty. */
@@ -4389,14 +4424,10 @@ timer_check_2 (void)
4389 Returns the time to wait until the next timer fires. 4424 Returns the time to wait until the next timer fires.
4390 If no timer is active, return -1. 4425 If no timer is active, return -1.
4391 4426
4392 As long as any timer is ripe, we run it. 4427 As long as any timer is ripe, we run it. */
4393
4394 DO_IT_NOW is now ignored. It used to mean that we should
4395 run the timer directly instead of queueing a timer-event.
4396 Now we always run timers directly. */
4397 4428
4398EMACS_TIME 4429EMACS_TIME
4399timer_check (int do_it_now) 4430timer_check (void)
4400{ 4431{
4401 EMACS_TIME nexttime; 4432 EMACS_TIME nexttime;
4402 4433
@@ -5405,7 +5436,6 @@ make_lispy_event (struct input_event *event)
5405 && (event->modifiers & down_modifier)) 5436 && (event->modifiers & down_modifier))
5406 { 5437 {
5407 Lisp_Object items, item; 5438 Lisp_Object items, item;
5408 int hpos;
5409 int i; 5439 int i;
5410 5440
5411 /* Find the menu bar item under `column'. */ 5441 /* Find the menu bar item under `column'. */
@@ -5974,10 +6004,10 @@ make_lispy_switch_frame (Lisp_Object frame)
5974 This doesn't use any caches. */ 6004 This doesn't use any caches. */
5975 6005
5976static int 6006static int
5977parse_modifiers_uncached (Lisp_Object symbol, int *modifier_end) 6007parse_modifiers_uncached (Lisp_Object symbol, EMACS_INT *modifier_end)
5978{ 6008{
5979 Lisp_Object name; 6009 Lisp_Object name;
5980 int i; 6010 EMACS_INT i;
5981 int modifiers; 6011 int modifiers;
5982 6012
5983 CHECK_SYMBOL (symbol); 6013 CHECK_SYMBOL (symbol);
@@ -5987,7 +6017,7 @@ parse_modifiers_uncached (Lisp_Object symbol, int *modifier_end)
5987 6017
5988 for (i = 0; i+2 <= SBYTES (name); ) 6018 for (i = 0; i+2 <= SBYTES (name); )
5989 { 6019 {
5990 int this_mod_end = 0; 6020 EMACS_INT this_mod_end = 0;
5991 int this_mod = 0; 6021 int this_mod = 0;
5992 6022
5993 /* See if the name continues with a modifier word. 6023 /* See if the name continues with a modifier word.
@@ -6184,7 +6214,7 @@ parse_modifiers (Lisp_Object symbol)
6184 return elements; 6214 return elements;
6185 else 6215 else
6186 { 6216 {
6187 int end; 6217 EMACS_INT end;
6188 int modifiers = parse_modifiers_uncached (symbol, &end); 6218 int modifiers = parse_modifiers_uncached (symbol, &end);
6189 Lisp_Object unmodified; 6219 Lisp_Object unmodified;
6190 Lisp_Object mask; 6220 Lisp_Object mask;
@@ -7097,7 +7127,7 @@ process_pending_signals (void)
7097#ifdef SIGIO /* for entire page */ 7127#ifdef SIGIO /* for entire page */
7098/* Note SIGIO has been undef'd if FIONREAD is missing. */ 7128/* Note SIGIO has been undef'd if FIONREAD is missing. */
7099 7129
7100static SIGTYPE 7130static void
7101input_available_signal (int signo) 7131input_available_signal (int signo)
7102{ 7132{
7103 /* Must preserve main program's value of errno. */ 7133 /* Must preserve main program's value of errno. */
@@ -7175,7 +7205,7 @@ add_user_signal (int sig, const char *name)
7175 signal (sig, handle_user_signal); 7205 signal (sig, handle_user_signal);
7176} 7206}
7177 7207
7178static SIGTYPE 7208static void
7179handle_user_signal (int sig) 7209handle_user_signal (int sig)
7180{ 7210{
7181 int old_errno = errno; 7211 int old_errno = errno;
@@ -8769,7 +8799,7 @@ access_keymap_keyremap (Lisp_Object map, Lisp_Object key, Lisp_Object prompt,
8769 The return value is non-zero if the remapping actually took place. */ 8799 The return value is non-zero if the remapping actually took place. */
8770 8800
8771static int 8801static int
8772keyremap_step (Lisp_Object *keybuf, int bufsize, volatile keyremap *fkey, 8802keyremap_step (Lisp_Object *keybuf, size_t bufsize, volatile keyremap *fkey,
8773 int input, int doit, int *diff, Lisp_Object prompt) 8803 int input, int doit, int *diff, Lisp_Object prompt)
8774{ 8804{
8775 Lisp_Object next, key; 8805 Lisp_Object next, key;
@@ -8862,7 +8892,7 @@ keyremap_step (Lisp_Object *keybuf, int bufsize, volatile keyremap *fkey,
8862 from the selected window's buffer. */ 8892 from the selected window's buffer. */
8863 8893
8864static int 8894static int
8865read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt, 8895read_key_sequence (Lisp_Object *keybuf, size_t bufsize, Lisp_Object prompt,
8866 int dont_downcase_last, int can_return_switch_frame, 8896 int dont_downcase_last, int can_return_switch_frame,
8867 int fix_current_buffer) 8897 int fix_current_buffer)
8868{ 8898{
@@ -9380,80 +9410,84 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
9380 last_real_key_start = t - 1; 9410 last_real_key_start = t - 1;
9381 } 9411 }
9382 9412
9383 /* Key sequences beginning with mouse clicks are 9413 if (last_real_key_start == 0)
9384 read using the keymaps in the buffer clicked on,
9385 not the current buffer. If we're at the
9386 beginning of a key sequence, switch buffers. */
9387 if (last_real_key_start == 0
9388 && WINDOWP (window)
9389 && BUFFERP (XWINDOW (window)->buffer)
9390 && XBUFFER (XWINDOW (window)->buffer) != current_buffer)
9391 { 9414 {
9392 XVECTOR (raw_keybuf)->contents[raw_keybuf_count++] = key; 9415 /* Key sequences beginning with mouse clicks are
9393 keybuf[t] = key; 9416 read using the keymaps in the buffer clicked on,
9394 mock_input = t + 1; 9417 not the current buffer. If we're at the
9395 9418 beginning of a key sequence, switch buffers. */
9396 /* Arrange to go back to the original buffer once we're 9419 if (WINDOWP (window)
9397 done reading the key sequence. Note that we can't 9420 && BUFFERP (XWINDOW (window)->buffer)
9398 use save_excursion_{save,restore} here, because they 9421 && XBUFFER (XWINDOW (window)->buffer) != current_buffer)
9399 save point as well as the current buffer; we don't 9422 {
9400 want to save point, because redisplay may change it, 9423 XVECTOR (raw_keybuf)->contents[raw_keybuf_count++] = key;
9401 to accommodate a Fset_window_start or something. We 9424 keybuf[t] = key;
9402 don't want to do this at the top of the function, 9425 mock_input = t + 1;
9403 because we may get input from a subprocess which 9426
9404 wants to change the selected window and stuff (say, 9427 /* Arrange to go back to the original buffer once we're
9405 emacsclient). */ 9428 done reading the key sequence. Note that we can't
9406 record_unwind_protect (Fset_buffer, Fcurrent_buffer ()); 9429 use save_excursion_{save,restore} here, because they
9407 9430 save point as well as the current buffer; we don't
9408 if (! FRAME_LIVE_P (XFRAME (selected_frame))) 9431 want to save point, because redisplay may change it,
9409 Fkill_emacs (Qnil); 9432 to accommodate a Fset_window_start or something. We
9410 set_buffer_internal (XBUFFER (XWINDOW (window)->buffer)); 9433 don't want to do this at the top of the function,
9411 orig_local_map = get_local_map (PT, current_buffer, 9434 because we may get input from a subprocess which
9412 Qlocal_map); 9435 wants to change the selected window and stuff (say,
9413 orig_keymap = get_local_map (PT, current_buffer, Qkeymap); 9436 emacsclient). */
9414 goto replay_sequence; 9437 record_unwind_protect (Fset_buffer, Fcurrent_buffer ());
9415 } 9438
9439 if (! FRAME_LIVE_P (XFRAME (selected_frame)))
9440 Fkill_emacs (Qnil);
9441 set_buffer_internal (XBUFFER (XWINDOW (window)->buffer));
9442 orig_local_map = get_local_map (PT, current_buffer,
9443 Qlocal_map);
9444 orig_keymap = get_local_map (PT, current_buffer,
9445 Qkeymap);
9446 goto replay_sequence;
9447 }
9416 9448
9417 /* For a mouse click, get the local text-property keymap 9449 /* For a mouse click, get the local text-property keymap
9418 of the place clicked on, rather than point. */ 9450 of the place clicked on, rather than point. */
9419 if (last_real_key_start == 0 9451 if (CONSP (XCDR (key))
9420 && CONSP (XCDR (key)) 9452 && ! localized_local_map)
9421 && ! localized_local_map) 9453 {
9422 { 9454 Lisp_Object map_here, start, pos;
9423 Lisp_Object map_here, start, pos;
9424 9455
9425 localized_local_map = 1; 9456 localized_local_map = 1;
9426 start = EVENT_START (key); 9457 start = EVENT_START (key);
9427 9458
9428 if (CONSP (start) && POSN_INBUFFER_P (start)) 9459 if (CONSP (start) && POSN_INBUFFER_P (start))
9429 {
9430 pos = POSN_BUFFER_POSN (start);
9431 if (INTEGERP (pos)
9432 && XINT (pos) >= BEGV
9433 && XINT (pos) <= ZV)
9434 { 9460 {
9435 map_here = get_local_map (XINT (pos), 9461 pos = POSN_BUFFER_POSN (start);
9436 current_buffer, Qlocal_map); 9462 if (INTEGERP (pos)
9437 if (!EQ (map_here, orig_local_map)) 9463 && XINT (pos) >= BEGV
9464 && XINT (pos) <= ZV)
9438 { 9465 {
9439 orig_local_map = map_here; 9466 map_here = get_local_map (XINT (pos),
9440 ++localized_local_map; 9467 current_buffer,
9441 } 9468 Qlocal_map);
9469 if (!EQ (map_here, orig_local_map))
9470 {
9471 orig_local_map = map_here;
9472 ++localized_local_map;
9473 }
9442 9474
9443 map_here = get_local_map (XINT (pos), 9475 map_here = get_local_map (XINT (pos),
9444 current_buffer, Qkeymap); 9476 current_buffer,
9445 if (!EQ (map_here, orig_keymap)) 9477 Qkeymap);
9446 { 9478 if (!EQ (map_here, orig_keymap))
9447 orig_keymap = map_here; 9479 {
9448 ++localized_local_map; 9480 orig_keymap = map_here;
9449 } 9481 ++localized_local_map;
9482 }
9450 9483
9451 if (localized_local_map > 1) 9484 if (localized_local_map > 1)
9452 { 9485 {
9453 keybuf[t] = key; 9486 keybuf[t] = key;
9454 mock_input = t + 1; 9487 mock_input = t + 1;
9455 9488
9456 goto replay_sequence; 9489 goto replay_sequence;
9490 }
9457 } 9491 }
9458 } 9492 }
9459 } 9493 }
@@ -10135,11 +10169,11 @@ a special event, so ignore the prefix argument and don't clear it. */)
10135 if (SYMBOLP (cmd)) 10169 if (SYMBOLP (cmd))
10136 { 10170 {
10137 tem = Fget (cmd, Qdisabled); 10171 tem = Fget (cmd, Qdisabled);
10138 if (!NILP (tem) && !NILP (Vrun_hooks)) 10172 if (!NILP (tem))
10139 { 10173 {
10140 tem = Fsymbol_value (Qdisabled_command_function); 10174 tem = Fsymbol_value (Qdisabled_command_function);
10141 if (!NILP (tem)) 10175 if (!NILP (tem))
10142 return call1 (Vrun_hooks, Qdisabled_command_function); 10176 return Frun_hooks (1, &Qdisabled_command_function);
10143 } 10177 }
10144 } 10178 }
10145 10179
@@ -10312,9 +10346,9 @@ give to the command you invoke, if it asks for an argument. */)
10312 sprintf (newmessage, "You can run the command `%s' with %s", 10346 sprintf (newmessage, "You can run the command `%s' with %s",
10313 SDATA (SYMBOL_NAME (function)), 10347 SDATA (SYMBOL_NAME (function)),
10314 SDATA (binding)); 10348 SDATA (binding));
10315 message2_nolog (newmessage, 10349 message2 (newmessage,
10316 strlen (newmessage), 10350 strlen (newmessage),
10317 STRING_MULTIBYTE (binding)); 10351 STRING_MULTIBYTE (binding));
10318 if (NUMBERP (Vsuggest_key_bindings)) 10352 if (NUMBERP (Vsuggest_key_bindings))
10319 waited = sit_for (Vsuggest_key_bindings, 0, 2); 10353 waited = sit_for (Vsuggest_key_bindings, 0, 2);
10320 else 10354 else
@@ -10623,6 +10657,7 @@ On such systems, Emacs starts a subshell instead of suspending. */)
10623 int old_height, old_width; 10657 int old_height, old_width;
10624 int width, height; 10658 int width, height;
10625 struct gcpro gcpro1; 10659 struct gcpro gcpro1;
10660 Lisp_Object hook;
10626 10661
10627 if (tty_list && tty_list->next) 10662 if (tty_list && tty_list->next)
10628 error ("There are other tty frames open; close them before suspending Emacs"); 10663 error ("There are other tty frames open; close them before suspending Emacs");
@@ -10631,8 +10666,8 @@ On such systems, Emacs starts a subshell instead of suspending. */)
10631 CHECK_STRING (stuffstring); 10666 CHECK_STRING (stuffstring);
10632 10667
10633 /* Run the functions in suspend-hook. */ 10668 /* Run the functions in suspend-hook. */
10634 if (!NILP (Vrun_hooks)) 10669 hook = intern ("suspend-hook");
10635 call1 (Vrun_hooks, intern ("suspend-hook")); 10670 Frun_hooks (1, &hook);
10636 10671
10637 GCPRO1 (stuffstring); 10672 GCPRO1 (stuffstring);
10638 get_tty_size (fileno (CURTTY ()->input), &old_width, &old_height); 10673 get_tty_size (fileno (CURTTY ()->input), &old_width, &old_height);
@@ -10656,8 +10691,8 @@ On such systems, Emacs starts a subshell instead of suspending. */)
10656 change_frame_size (SELECTED_FRAME (), height, width, 0, 0, 0); 10691 change_frame_size (SELECTED_FRAME (), height, width, 0, 0, 0);
10657 10692
10658 /* Run suspend-resume-hook. */ 10693 /* Run suspend-resume-hook. */
10659 if (!NILP (Vrun_hooks)) 10694 hook = intern ("suspend-resume-hook");
10660 call1 (Vrun_hooks, intern ("suspend-resume-hook")); 10695 Frun_hooks (1, &hook);
10661 10696
10662 UNGCPRO; 10697 UNGCPRO;
10663 return Qnil; 10698 return Qnil;
@@ -10732,7 +10767,7 @@ clear_waiting_for_input (void)
10732 SIGINT was generated by C-g, so we call handle_interrupt. 10767 SIGINT was generated by C-g, so we call handle_interrupt.
10733 Otherwise, the handler kills Emacs. */ 10768 Otherwise, the handler kills Emacs. */
10734 10769
10735static SIGTYPE 10770static void
10736interrupt_signal (int signalnum) /* If we don't have an argument, some */ 10771interrupt_signal (int signalnum) /* If we don't have an argument, some */
10737 /* compilers complain in signal calls. */ 10772 /* compilers complain in signal calls. */
10738{ 10773{
@@ -11458,9 +11493,6 @@ syms_of_keyboard (void)
11458 Qdeferred_action_function = intern_c_string ("deferred-action-function"); 11493 Qdeferred_action_function = intern_c_string ("deferred-action-function");
11459 staticpro (&Qdeferred_action_function); 11494 staticpro (&Qdeferred_action_function);
11460 11495
11461 Qcommand_hook_internal = intern_c_string ("command-hook-internal");
11462 staticpro (&Qcommand_hook_internal);
11463
11464 Qfunction_key = intern_c_string ("function-key"); 11496 Qfunction_key = intern_c_string ("function-key");
11465 staticpro (&Qfunction_key); 11497 staticpro (&Qfunction_key);
11466 Qmouse_click = intern_c_string ("mouse-click"); 11498 Qmouse_click = intern_c_string ("mouse-click");
@@ -11580,12 +11612,12 @@ syms_of_keyboard (void)
11580 last_point_position_window = Qnil; 11612 last_point_position_window = Qnil;
11581 11613
11582 { 11614 {
11583 const struct event_head *p; 11615 int i;
11616 int len = sizeof (head_table) / sizeof (head_table[0]);
11584 11617
11585 for (p = head_table; 11618 for (i = 0; i < len; i++)
11586 p < head_table + (sizeof (head_table) / sizeof (head_table[0]));
11587 p++)
11588 { 11619 {
11620 const struct event_head *p = &head_table[i];
11589 *p->var = intern_c_string (p->name); 11621 *p->var = intern_c_string (p->name);
11590 staticpro (p->var); 11622 staticpro (p->var);
11591 Fput (*p->var, Qevent_kind, *p->kind); 11623 Fput (*p->var, Qevent_kind, *p->kind);
@@ -11928,22 +11960,18 @@ Buffer modification stores t in this variable. */);
11928 Qdeactivate_mark = intern_c_string ("deactivate-mark"); 11960 Qdeactivate_mark = intern_c_string ("deactivate-mark");
11929 staticpro (&Qdeactivate_mark); 11961 staticpro (&Qdeactivate_mark);
11930 11962
11931 DEFVAR_LISP ("command-hook-internal", Vcommand_hook_internal,
11932 doc: /* Temporary storage of `pre-command-hook' or `post-command-hook'. */);
11933 Vcommand_hook_internal = Qnil;
11934
11935 DEFVAR_LISP ("pre-command-hook", Vpre_command_hook, 11963 DEFVAR_LISP ("pre-command-hook", Vpre_command_hook,
11936 doc: /* Normal hook run before each command is executed. 11964 doc: /* Normal hook run before each command is executed.
11937If an unhandled error happens in running this hook, 11965If an unhandled error happens in running this hook,
11938the hook value is set to nil, since otherwise the error 11966the function in which the error occurred is unconditionally removed, since
11939might happen repeatedly and make Emacs nonfunctional. */); 11967otherwise the error might happen repeatedly and make Emacs nonfunctional. */);
11940 Vpre_command_hook = Qnil; 11968 Vpre_command_hook = Qnil;
11941 11969
11942 DEFVAR_LISP ("post-command-hook", Vpost_command_hook, 11970 DEFVAR_LISP ("post-command-hook", Vpost_command_hook,
11943 doc: /* Normal hook run after each command is executed. 11971 doc: /* Normal hook run after each command is executed.
11944If an unhandled error happens in running this hook, 11972If an unhandled error happens in running this hook,
11945the hook value is set to nil, since otherwise the error 11973the function in which the error occurred is unconditionally removed, since
11946might happen repeatedly and make Emacs nonfunctional. */); 11974otherwise the error might happen repeatedly and make Emacs nonfunctional. */);
11947 Vpost_command_hook = Qnil; 11975 Vpost_command_hook = Qnil;
11948 11976
11949#if 0 11977#if 0
diff --git a/src/keyboard.h b/src/keyboard.h
index 00745a09140..72bb821b2eb 100644
--- a/src/keyboard.h
+++ b/src/keyboard.h
@@ -194,8 +194,8 @@ extern KBOARD *all_kboards;
194/* Nonzero in the single-kboard state, 0 in the any-kboard state. */ 194/* Nonzero in the single-kboard state, 0 in the any-kboard state. */
195extern int single_kboard; 195extern int single_kboard;
196 196
197/* Total number of times read_char has returned. */ 197/* Total number of times read_char has returned, modulo SIZE_MAX + 1. */
198extern int num_input_events; 198extern size_t num_input_events;
199 199
200/* Nonzero means polling for input is temporarily suppressed. */ 200/* Nonzero means polling for input is temporarily suppressed. */
201extern int poll_suppress_count; 201extern int poll_suppress_count;
@@ -485,7 +485,7 @@ extern void push_frame_kboard (struct frame *);
485extern void pop_kboard (void); 485extern void pop_kboard (void);
486extern void temporarily_switch_to_single_kboard (struct frame *); 486extern void temporarily_switch_to_single_kboard (struct frame *);
487extern void record_asynch_buffer_change (void); 487extern void record_asynch_buffer_change (void);
488extern SIGTYPE input_poll_signal (int); 488extern void input_poll_signal (int);
489extern void start_polling (void); 489extern void start_polling (void);
490extern void stop_polling (void); 490extern void stop_polling (void);
491extern void set_poll_suppress_count (int); 491extern void set_poll_suppress_count (int);
@@ -507,7 +507,7 @@ extern void kbd_buffer_store_event_hold (struct input_event *,
507extern void kbd_buffer_unget_event (struct input_event *); 507extern void kbd_buffer_unget_event (struct input_event *);
508extern void poll_for_input_1 (void); 508extern void poll_for_input_1 (void);
509extern void show_help_echo (Lisp_Object, Lisp_Object, Lisp_Object, 509extern void show_help_echo (Lisp_Object, Lisp_Object, Lisp_Object,
510 Lisp_Object, int); 510 Lisp_Object);
511extern void gen_help_event (Lisp_Object, Lisp_Object, Lisp_Object, 511extern void gen_help_event (Lisp_Object, Lisp_Object, Lisp_Object,
512 Lisp_Object, EMACS_INT); 512 Lisp_Object, EMACS_INT);
513extern void kbd_buffer_store_help_event (Lisp_Object, Lisp_Object); 513extern void kbd_buffer_store_help_event (Lisp_Object, Lisp_Object);
@@ -517,7 +517,7 @@ extern void add_user_signal (int, const char *);
517 517
518extern int tty_read_avail_input (struct terminal *, int, 518extern int tty_read_avail_input (struct terminal *, int,
519 struct input_event *); 519 struct input_event *);
520extern EMACS_TIME timer_check (int); 520extern EMACS_TIME timer_check (void);
521extern void mark_kboards (void); 521extern void mark_kboards (void);
522 522
523#ifdef WINDOWSNT 523#ifdef WINDOWSNT
diff --git a/src/keymap.c b/src/keymap.c
index 06968a0d944..10000b935aa 100644
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -81,8 +81,7 @@ static void describe_map (Lisp_Object, Lisp_Object,
81 int, Lisp_Object, Lisp_Object*, int, int); 81 int, Lisp_Object, Lisp_Object*, int, int);
82static void describe_vector (Lisp_Object, Lisp_Object, Lisp_Object, 82static void describe_vector (Lisp_Object, Lisp_Object, Lisp_Object,
83 void (*) (Lisp_Object, Lisp_Object), int, 83 void (*) (Lisp_Object, Lisp_Object), int,
84 Lisp_Object, Lisp_Object, int *, 84 Lisp_Object, Lisp_Object, int, int);
85 int, int, int);
86static void silly_event_symbol_error (Lisp_Object); 85static void silly_event_symbol_error (Lisp_Object);
87static Lisp_Object get_keyelt (Lisp_Object, int); 86static Lisp_Object get_keyelt (Lisp_Object, int);
88 87
@@ -2388,7 +2387,7 @@ push_key_description (register unsigned int c, register char *p, int force_multi
2388 /* Now we are sure that C is a valid character code. */ 2387 /* Now we are sure that C is a valid character code. */
2389 if (NILP (BVAR (current_buffer, enable_multibyte_characters)) 2388 if (NILP (BVAR (current_buffer, enable_multibyte_characters))
2390 && ! force_multibyte) 2389 && ! force_multibyte)
2391 *p++ = multibyte_char_to_unibyte (c, Qnil); 2390 *p++ = multibyte_char_to_unibyte (c);
2392 else 2391 else
2393 p += CHAR_STRING (c, (unsigned char *) p); 2392 p += CHAR_STRING (c, (unsigned char *) p);
2394 } 2393 }
@@ -3353,7 +3352,7 @@ describe_map (Lisp_Object map, Lisp_Object prefix,
3353 || CHAR_TABLE_P (XCAR (tail))) 3352 || CHAR_TABLE_P (XCAR (tail)))
3354 describe_vector (XCAR (tail), 3353 describe_vector (XCAR (tail),
3355 prefix, Qnil, elt_describer, partial, shadow, map, 3354 prefix, Qnil, elt_describer, partial, shadow, map,
3356 (int *)0, 0, 1, mention_shadow); 3355 1, mention_shadow);
3357 else if (CONSP (XCAR (tail))) 3356 else if (CONSP (XCAR (tail)))
3358 { 3357 {
3359 int this_shadowed = 0; 3358 int this_shadowed = 0;
@@ -3506,7 +3505,7 @@ DESCRIBER is the output function used; nil means use `princ'. */)
3506 specbind (Qstandard_output, Fcurrent_buffer ()); 3505 specbind (Qstandard_output, Fcurrent_buffer ());
3507 CHECK_VECTOR_OR_CHAR_TABLE (vector); 3506 CHECK_VECTOR_OR_CHAR_TABLE (vector);
3508 describe_vector (vector, Qnil, describer, describe_vector_princ, 0, 3507 describe_vector (vector, Qnil, describer, describe_vector_princ, 0,
3509 Qnil, Qnil, (int *)0, 0, 0, 0); 3508 Qnil, Qnil, 0, 0);
3510 3509
3511 return unbind_to (count, Qnil); 3510 return unbind_to (count, Qnil);
3512} 3511}
@@ -3539,9 +3538,6 @@ DESCRIBER is the output function used; nil means use `princ'. */)
3539 3538
3540 ARGS is simply passed as the second argument to ELT_DESCRIBER. 3539 ARGS is simply passed as the second argument to ELT_DESCRIBER.
3541 3540
3542 INDICES and CHAR_TABLE_DEPTH are ignored. They will be removed in
3543 the near future.
3544
3545 KEYMAP_P is 1 if vector is known to be a keymap, so map ESC to M-. 3541 KEYMAP_P is 1 if vector is known to be a keymap, so map ESC to M-.
3546 3542
3547 ARGS is simply passed as the second argument to ELT_DESCRIBER. */ 3543 ARGS is simply passed as the second argument to ELT_DESCRIBER. */
@@ -3550,8 +3546,7 @@ static void
3550describe_vector (Lisp_Object vector, Lisp_Object prefix, Lisp_Object args, 3546describe_vector (Lisp_Object vector, Lisp_Object prefix, Lisp_Object args,
3551 void (*elt_describer) (Lisp_Object, Lisp_Object), 3547 void (*elt_describer) (Lisp_Object, Lisp_Object),
3552 int partial, Lisp_Object shadow, Lisp_Object entire_map, 3548 int partial, Lisp_Object shadow, Lisp_Object entire_map,
3553 int *indices, int char_table_depth, int keymap_p, 3549 int keymap_p, int mention_shadow)
3554 int mention_shadow)
3555{ 3550{
3556 Lisp_Object definition; 3551 Lisp_Object definition;
3557 Lisp_Object tem2; 3552 Lisp_Object tem2;
diff --git a/src/lisp.h b/src/lisp.h
index 9cbaf24cacf..bd70dcebbdb 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -964,7 +964,7 @@ struct Lisp_Subr
964 Lisp_Object (*a7) (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object); 964 Lisp_Object (*a7) (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object);
965 Lisp_Object (*a8) (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object); 965 Lisp_Object (*a8) (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object);
966 Lisp_Object (*aUNEVALLED) (Lisp_Object args); 966 Lisp_Object (*aUNEVALLED) (Lisp_Object args);
967 Lisp_Object (*aMANY) (int, Lisp_Object *); 967 Lisp_Object (*aMANY) (size_t, Lisp_Object *);
968 } function; 968 } function;
969 short min_args, max_args; 969 short min_args, max_args;
970 const char *symbol_name; 970 const char *symbol_name;
@@ -1814,7 +1814,7 @@ typedef struct {
1814 1814
1815/* Note that the weird token-substitution semantics of ANSI C makes 1815/* Note that the weird token-substitution semantics of ANSI C makes
1816 this work for MANY and UNEVALLED. */ 1816 this work for MANY and UNEVALLED. */
1817#define DEFUN_ARGS_MANY (int, Lisp_Object *) 1817#define DEFUN_ARGS_MANY (size_t, Lisp_Object *)
1818#define DEFUN_ARGS_UNEVALLED (Lisp_Object) 1818#define DEFUN_ARGS_UNEVALLED (Lisp_Object)
1819#define DEFUN_ARGS_0 (void) 1819#define DEFUN_ARGS_0 (void)
1820#define DEFUN_ARGS_1 (Lisp_Object) 1820#define DEFUN_ARGS_1 (Lisp_Object)
@@ -2084,7 +2084,7 @@ struct gcpro
2084 volatile Lisp_Object *var; 2084 volatile Lisp_Object *var;
2085 2085
2086 /* Number of consecutive protected variables. */ 2086 /* Number of consecutive protected variables. */
2087 int nvars; 2087 size_t nvars;
2088 2088
2089#ifdef DEBUG_GCPRO 2089#ifdef DEBUG_GCPRO
2090 int level; 2090 int level;
@@ -2283,7 +2283,7 @@ void staticpro (Lisp_Object *);
2283struct window; 2283struct window;
2284struct frame; 2284struct frame;
2285 2285
2286/* Defined in data.c */ 2286/* Defined in data.c. */
2287extern Lisp_Object Qnil, Qt, Qquote, Qlambda, Qsubr, Qunbound; 2287extern Lisp_Object Qnil, Qt, Qquote, Qlambda, Qsubr, Qunbound;
2288extern Lisp_Object Qerror_conditions, Qerror_message, Qtop_level; 2288extern Lisp_Object Qerror_conditions, Qerror_message, Qtop_level;
2289extern Lisp_Object Qerror, Qquit, Qwrong_type_argument, Qargs_out_of_range; 2289extern Lisp_Object Qerror, Qquit, Qwrong_type_argument, Qargs_out_of_range;
@@ -2408,7 +2408,7 @@ EXFUN (Fchar_width, 1);
2408EXFUN (Fstring, MANY); 2408EXFUN (Fstring, MANY);
2409extern EMACS_INT chars_in_text (const unsigned char *, EMACS_INT); 2409extern EMACS_INT chars_in_text (const unsigned char *, EMACS_INT);
2410extern EMACS_INT multibyte_chars_in_text (const unsigned char *, EMACS_INT); 2410extern EMACS_INT multibyte_chars_in_text (const unsigned char *, EMACS_INT);
2411extern int multibyte_char_to_unibyte (int, Lisp_Object); 2411extern int multibyte_char_to_unibyte (int);
2412extern int multibyte_char_to_unibyte_safe (int); 2412extern int multibyte_char_to_unibyte_safe (int);
2413extern void init_character_once (void); 2413extern void init_character_once (void);
2414extern void syms_of_character (void); 2414extern void syms_of_character (void);
@@ -2817,7 +2817,7 @@ extern void init_obarray (void);
2817extern void init_lread (void); 2817extern void init_lread (void);
2818extern void syms_of_lread (void); 2818extern void syms_of_lread (void);
2819 2819
2820/* Defined in eval.c */ 2820/* Defined in eval.c. */
2821extern Lisp_Object Qautoload, Qexit, Qinteractive, Qcommandp, Qdefun, Qmacro; 2821extern Lisp_Object Qautoload, Qexit, Qinteractive, Qcommandp, Qdefun, Qmacro;
2822extern Lisp_Object Qinhibit_quit, Qclosure; 2822extern Lisp_Object Qinhibit_quit, Qclosure;
2823extern Lisp_Object Vautoload_queue; 2823extern Lisp_Object Vautoload_queue;
@@ -2835,6 +2835,9 @@ EXFUN (Frun_hooks, MANY);
2835EXFUN (Frun_hook_with_args, MANY); 2835EXFUN (Frun_hook_with_args, MANY);
2836EXFUN (Frun_hook_with_args_until_failure, MANY); 2836EXFUN (Frun_hook_with_args_until_failure, MANY);
2837extern void run_hook_with_args_2 (Lisp_Object, Lisp_Object, Lisp_Object); 2837extern void run_hook_with_args_2 (Lisp_Object, Lisp_Object, Lisp_Object);
2838extern Lisp_Object run_hook_with_args (size_t nargs, Lisp_Object *args,
2839 Lisp_Object (*funcall)
2840 (size_t nargs, Lisp_Object *args));
2838EXFUN (Fprogn, UNEVALLED); 2841EXFUN (Fprogn, UNEVALLED);
2839EXFUN (Finteractive_p, 0); 2842EXFUN (Finteractive_p, 0);
2840EXFUN (Fthrow, 2) NO_RETURN; 2843EXFUN (Fthrow, 2) NO_RETURN;
@@ -2867,7 +2870,7 @@ extern Lisp_Object internal_lisp_condition_case (Lisp_Object, Lisp_Object, Lisp_
2867extern Lisp_Object internal_condition_case (Lisp_Object (*) (void), Lisp_Object, Lisp_Object (*) (Lisp_Object)); 2870extern Lisp_Object internal_condition_case (Lisp_Object (*) (void), Lisp_Object, Lisp_Object (*) (Lisp_Object));
2868extern Lisp_Object internal_condition_case_1 (Lisp_Object (*) (Lisp_Object), Lisp_Object, Lisp_Object, Lisp_Object (*) (Lisp_Object)); 2871extern Lisp_Object internal_condition_case_1 (Lisp_Object (*) (Lisp_Object), Lisp_Object, Lisp_Object, Lisp_Object (*) (Lisp_Object));
2869extern Lisp_Object internal_condition_case_2 (Lisp_Object (*) (Lisp_Object, Lisp_Object), Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object (*) (Lisp_Object)); 2872extern Lisp_Object internal_condition_case_2 (Lisp_Object (*) (Lisp_Object, Lisp_Object), Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object (*) (Lisp_Object));
2870extern Lisp_Object internal_condition_case_n (Lisp_Object (*) (int, Lisp_Object *), int, Lisp_Object *, Lisp_Object, Lisp_Object (*) (Lisp_Object)); 2873extern Lisp_Object internal_condition_case_n (Lisp_Object (*) (size_t, Lisp_Object *), size_t, Lisp_Object *, Lisp_Object, Lisp_Object (*) (Lisp_Object));
2871extern void specbind (Lisp_Object, Lisp_Object); 2874extern void specbind (Lisp_Object, Lisp_Object);
2872extern void record_unwind_protect (Lisp_Object (*) (Lisp_Object), Lisp_Object); 2875extern void record_unwind_protect (Lisp_Object (*) (Lisp_Object), Lisp_Object);
2873extern Lisp_Object unbind_to (int, Lisp_Object); 2876extern Lisp_Object unbind_to (int, Lisp_Object);
@@ -2877,7 +2880,7 @@ extern void do_autoload (Lisp_Object, Lisp_Object);
2877extern Lisp_Object un_autoload (Lisp_Object); 2880extern Lisp_Object un_autoload (Lisp_Object);
2878EXFUN (Ffetch_bytecode, 1); 2881EXFUN (Ffetch_bytecode, 1);
2879extern void init_eval_once (void); 2882extern void init_eval_once (void);
2880extern Lisp_Object safe_call (int, Lisp_Object *); 2883extern Lisp_Object safe_call (size_t, Lisp_Object *);
2881extern Lisp_Object safe_call1 (Lisp_Object, Lisp_Object); 2884extern Lisp_Object safe_call1 (Lisp_Object, Lisp_Object);
2882extern Lisp_Object safe_call2 (Lisp_Object, Lisp_Object, Lisp_Object); 2885extern Lisp_Object safe_call2 (Lisp_Object, Lisp_Object, Lisp_Object);
2883extern void init_eval (void); 2886extern void init_eval (void);
@@ -3188,7 +3191,7 @@ extern Lisp_Object decode_env_path (const char *, const char *);
3188extern Lisp_Object empty_unibyte_string, empty_multibyte_string; 3191extern Lisp_Object empty_unibyte_string, empty_multibyte_string;
3189extern Lisp_Object Qfile_name_handler_alist; 3192extern Lisp_Object Qfile_name_handler_alist;
3190extern void (*fatal_error_signal_hook) (void); 3193extern void (*fatal_error_signal_hook) (void);
3191extern SIGTYPE fatal_error_signal (int); 3194extern void fatal_error_signal (int);
3192EXFUN (Fkill_emacs, 1) NO_RETURN; 3195EXFUN (Fkill_emacs, 1) NO_RETURN;
3193#if HAVE_SETLOCALE 3196#if HAVE_SETLOCALE
3194void fixup_locale (void); 3197void fixup_locale (void);
@@ -3240,7 +3243,11 @@ extern void syms_of_process (void);
3240extern void setup_process_coding_systems (Lisp_Object); 3243extern void setup_process_coding_systems (Lisp_Object);
3241 3244
3242EXFUN (Fcall_process, MANY); 3245EXFUN (Fcall_process, MANY);
3243extern int child_setup (int, int, int, char **, int, Lisp_Object); 3246extern int child_setup (int, int, int, char **, int, Lisp_Object)
3247#ifndef DOS_NT
3248 NO_RETURN
3249#endif
3250 ;
3244extern void init_callproc_1 (void); 3251extern void init_callproc_1 (void);
3245extern void init_callproc (void); 3252extern void init_callproc (void);
3246extern void set_initial_environment (void); 3253extern void set_initial_environment (void);
@@ -3607,7 +3614,7 @@ extern Lisp_Object safe_alloca_unwind (Lisp_Object);
3607 else \ 3614 else \
3608 { \ 3615 { \
3609 buf = (type) xmalloc (size); \ 3616 buf = (type) xmalloc (size); \
3610 sa_must_free++; \ 3617 sa_must_free = 1; \
3611 record_unwind_protect (safe_alloca_unwind, \ 3618 record_unwind_protect (safe_alloca_unwind, \
3612 make_save_value (buf, 0)); \ 3619 make_save_value (buf, 0)); \
3613 } \ 3620 } \
@@ -3637,7 +3644,7 @@ extern Lisp_Object safe_alloca_unwind (Lisp_Object);
3637 buf = (Lisp_Object *) xmalloc (size_); \ 3644 buf = (Lisp_Object *) xmalloc (size_); \
3638 arg_ = make_save_value (buf, nelt); \ 3645 arg_ = make_save_value (buf, nelt); \
3639 XSAVE_VALUE (arg_)->dogc = 1; \ 3646 XSAVE_VALUE (arg_)->dogc = 1; \
3640 sa_must_free++; \ 3647 sa_must_free = 1; \
3641 record_unwind_protect (safe_alloca_unwind, arg_); \ 3648 record_unwind_protect (safe_alloca_unwind, arg_); \
3642 } \ 3649 } \
3643 } while (0) 3650 } while (0)
diff --git a/src/menu.c b/src/menu.c
index 851f1ac804b..a9098deed7e 100644
--- a/src/menu.c
+++ b/src/menu.c
@@ -662,13 +662,12 @@ digest_single_submenu (int start, int end, int top_level_items)
662 else if (EQ (XVECTOR (menu_items)->contents[i], Qt)) 662 else if (EQ (XVECTOR (menu_items)->contents[i], Qt))
663 { 663 {
664 /* Create a new pane. */ 664 /* Create a new pane. */
665 Lisp_Object pane_name, prefix; 665 Lisp_Object pane_name;
666 const char *pane_string; 666 const char *pane_string;
667 667
668 panes_seen++; 668 panes_seen++;
669 669
670 pane_name = XVECTOR (menu_items)->contents[i + MENU_ITEMS_PANE_NAME]; 670 pane_name = XVECTOR (menu_items)->contents[i + MENU_ITEMS_PANE_NAME];
671 prefix = XVECTOR (menu_items)->contents[i + MENU_ITEMS_PANE_PREFIX];
672 671
673#ifdef HAVE_NTGUI 672#ifdef HAVE_NTGUI
674 if (STRINGP (pane_name)) 673 if (STRINGP (pane_name))
diff --git a/src/minibuf.c b/src/minibuf.c
index 986765ae6fb..4adf665f8f4 100644
--- a/src/minibuf.c
+++ b/src/minibuf.c
@@ -649,12 +649,7 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt,
649 if (STRINGP (input_method) && !NILP (Ffboundp (Qactivate_input_method))) 649 if (STRINGP (input_method) && !NILP (Ffboundp (Qactivate_input_method)))
650 call1 (Qactivate_input_method, input_method); 650 call1 (Qactivate_input_method, input_method);
651 651
652 /* Run our hook, but not if it is empty. 652 Frun_hooks (1, &Qminibuffer_setup_hook);
653 (run-hooks would do nothing if it is empty,
654 but it's important to save time here in the usual case.) */
655 if (!NILP (Vminibuffer_setup_hook) && !EQ (Vminibuffer_setup_hook, Qunbound)
656 && !NILP (Vrun_hooks))
657 call1 (Vrun_hooks, Qminibuffer_setup_hook);
658 653
659 /* Don't allow the user to undo past this point. */ 654 /* Don't allow the user to undo past this point. */
660 BVAR (current_buffer, undo_list) = Qnil; 655 BVAR (current_buffer, undo_list) = Qnil;
@@ -806,10 +801,7 @@ get_minibuffer (int depth)
806static Lisp_Object 801static Lisp_Object
807run_exit_minibuf_hook (Lisp_Object data) 802run_exit_minibuf_hook (Lisp_Object data)
808{ 803{
809 if (!NILP (Vminibuffer_exit_hook) && !EQ (Vminibuffer_exit_hook, Qunbound) 804 safe_run_hooks (Qminibuffer_exit_hook);
810 && !NILP (Vrun_hooks))
811 safe_run_hooks (Qminibuffer_exit_hook);
812
813 return Qnil; 805 return Qnil;
814} 806}
815 807
diff --git a/src/nsmenu.m b/src/nsmenu.m
index e8d4a256906..623c933ce8e 100644
--- a/src/nsmenu.m
+++ b/src/nsmenu.m
@@ -1705,7 +1705,6 @@ void process_dialog (id window, Lisp_Object list)
1705- (Lisp_Object)runDialogAt: (NSPoint)p 1705- (Lisp_Object)runDialogAt: (NSPoint)p
1706{ 1706{
1707 NSInteger ret; 1707 NSInteger ret;
1708 extern EMACS_TIME timer_check (int do_it_now); /* TODO: add to a header */
1709 1708
1710 /* initiate a session that will be ended by pop_down_menu */ 1709 /* initiate a session that will be ended by pop_down_menu */
1711 popupSession = [NSApp beginModalSessionForWindow: self]; 1710 popupSession = [NSApp beginModalSessionForWindow: self];
@@ -1715,7 +1714,7 @@ void process_dialog (id window, Lisp_Object list)
1715 { 1714 {
1716 /* Run this for timers.el, indep of atimers; might not return. 1715 /* Run this for timers.el, indep of atimers; might not return.
1717 TODO: use return value to avoid calling every iteration. */ 1716 TODO: use return value to avoid calling every iteration. */
1718 timer_check (1); 1717 timer_check ();
1719 [NSThread sleepUntilDate: [NSDate dateWithTimeIntervalSinceNow: 0.1]]; 1718 [NSThread sleepUntilDate: [NSDate dateWithTimeIntervalSinceNow: 0.1]];
1720 } 1719 }
1721 1720
diff --git a/src/nsterm.m b/src/nsterm.m
index c7cd411c614..91f0cbba585 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -170,6 +170,7 @@ BOOL ns_in_resize = NO;
170static BOOL ns_fake_keydown = NO; 170static BOOL ns_fake_keydown = NO;
171int ns_tmp_flags; /* FIXME */ 171int ns_tmp_flags; /* FIXME */
172struct nsfont_info *ns_tmp_font; /* FIXME */ 172struct nsfont_info *ns_tmp_font; /* FIXME */
173static BOOL ns_menu_bar_is_hidden = NO;
173/*static int debug_lock = 0; */ 174/*static int debug_lock = 0; */
174 175
175/* event loop */ 176/* event loop */
@@ -505,6 +506,118 @@ ns_resize_handle_rect (NSWindow *window)
505} 506}
506 507
507 508
509//
510// Window constraining
511// -------------------
512//
513// To ensure that the windows are not placed under the menu bar, they
514// are typically moved by the call-back constrainFrameRect. However,
515// by overriding it, it's possible to inhibit this, leaving the window
516// in it's original position.
517//
518// It's possible to hide the menu bar. However, technically, it's only
519// possible to hide it when the application is active. To ensure that
520// this work properly, the menu bar and window constraining are
521// deferred until the application becomes active.
522//
523// Even though it's not possible to manually move a window above the
524// top of the screen, it is allowed if it's done programmatically,
525// when the menu is hidden. This allows the editable area to cover the
526// full screen height.
527//
528// Test cases
529// ----------
530//
531// Use the following extra files:
532//
533// init.el:
534// ;; Hide menu and place frame slightly above the top of the screen.
535// (setq ns-auto-hide-menu-bar t)
536// (set-frame-position (selected-frame) 0 -20)
537//
538// Test 1:
539//
540// emacs -Q -l init.el
541//
542// Result: No menu bar, and the title bar should be above the screen.
543//
544// Test 2:
545//
546// emacs -Q
547//
548// Result: Menu bar visible, frame placed immediately below the menu.
549//
550
551static void
552ns_constrain_all_frames (void)
553{
554 Lisp_Object tail, frame;
555
556 FOR_EACH_FRAME (tail, frame)
557 {
558 struct frame *f = XFRAME (frame);
559 if (FRAME_NS_P (f))
560 {
561 NSView *view = FRAME_NS_VIEW (f);
562 /* This no-op will trigger the default window placing
563 * constriant system. */
564 f->output_data.ns->dont_constrain = 0;
565 [[view window] setFrameOrigin:[[view window] frame].origin];
566 }
567 }
568}
569
570
571/* True, if the menu bar should be hidden. */
572
573static BOOL
574ns_menu_bar_should_be_hidden (void)
575{
576 return !NILP (ns_auto_hide_menu_bar)
577 && [NSApp respondsToSelector:@selector(setPresentationOptions:)];
578}
579
580
581/* Show or hide the menu bar, based on user setting. */
582
583static void
584ns_update_auto_hide_menu_bar (void)
585{
586 BLOCK_INPUT;
587
588 NSTRACE (ns_update_auto_hide_menu_bar);
589
590 if (NSApp != nil
591 && [NSApp isActive]
592 && [NSApp respondsToSelector:@selector(setPresentationOptions:)])
593 {
594 // Note, "setPresentationOptions" triggers an error unless the
595 // application is active.
596 BOOL menu_bar_should_be_hidden = ns_menu_bar_should_be_hidden ();
597
598 if (menu_bar_should_be_hidden != ns_menu_bar_is_hidden)
599 {
600 NSApplicationPresentationOptions options
601 = NSApplicationPresentationAutoHideDock;
602
603 if (menu_bar_should_be_hidden)
604 options |= NSApplicationPresentationAutoHideMenuBar;
605
606 [NSApp setPresentationOptions: options];
607
608 ns_menu_bar_is_hidden = menu_bar_should_be_hidden;
609
610 if (!ns_menu_bar_is_hidden)
611 {
612 ns_constrain_all_frames ();
613 }
614 }
615 }
616
617 UNBLOCK_INPUT;
618}
619
620
508static void 621static void
509ns_update_begin (struct frame *f) 622ns_update_begin (struct frame *f)
510/* -------------------------------------------------------------------------- 623/* --------------------------------------------------------------------------
@@ -515,6 +628,8 @@ ns_update_begin (struct frame *f)
515 NSView *view = FRAME_NS_VIEW (f); 628 NSView *view = FRAME_NS_VIEW (f);
516 NSTRACE (ns_update_begin); 629 NSTRACE (ns_update_begin);
517 630
631 ns_update_auto_hide_menu_bar ();
632
518 ns_updating_frame = f; 633 ns_updating_frame = f;
519 [view lockFocus]; 634 [view lockFocus];
520 635
@@ -4205,7 +4320,13 @@ ns_term_shutdown (int sig)
4205} 4320}
4206- (void)applicationDidBecomeActive: (NSNotification *)notification 4321- (void)applicationDidBecomeActive: (NSNotification *)notification
4207{ 4322{
4323 NSTRACE (applicationDidBecomeActive);
4324
4208 //ns_app_active=YES; 4325 //ns_app_active=YES;
4326
4327 ns_update_auto_hide_menu_bar ();
4328 // No constrining takes place when the application is not active.
4329 ns_constrain_all_frames ();
4209} 4330}
4210- (void)applicationDidResignActive: (NSNotification *)notification 4331- (void)applicationDidResignActive: (NSNotification *)notification
4211{ 4332{
@@ -5689,7 +5810,10 @@ ns_term_shutdown (int sig)
5689 /* When making the frame visible for the first time, we want to 5810 /* When making the frame visible for the first time, we want to
5690 constrain. Other times not. */ 5811 constrain. Other times not. */
5691 struct frame *f = ((EmacsView *)[self delegate])->emacsframe; 5812 struct frame *f = ((EmacsView *)[self delegate])->emacsframe;
5692 if (f->output_data.ns->dont_constrain) 5813 NSTRACE (constrainFrameRect);
5814
5815 if (f->output_data.ns->dont_constrain
5816 || ns_menu_bar_should_be_hidden ())
5693 return frameRect; 5817 return frameRect;
5694 5818
5695 f->output_data.ns->dont_constrain = 1; 5819 f->output_data.ns->dont_constrain = 1;
@@ -6361,6 +6485,11 @@ allowing it to be used at a lower level for accented character entry.");
6361 staticpro (&last_mouse_motion_frame); 6485 staticpro (&last_mouse_motion_frame);
6362 last_mouse_motion_frame = Qnil; 6486 last_mouse_motion_frame = Qnil;
6363 6487
6488 DEFVAR_LISP ("ns-auto-hide-menu-bar", ns_auto_hide_menu_bar,
6489 doc: /* Non-nil means that the menu bar is hidden, but appears when the mouse is near.
6490Only works on OSX 10.6 or later. */);
6491 ns_auto_hide_menu_bar = Qnil;
6492
6364 /* TODO: move to common code */ 6493 /* TODO: move to common code */
6365 DEFVAR_LISP ("x-toolkit-scroll-bars", Vx_toolkit_scroll_bars, 6494 DEFVAR_LISP ("x-toolkit-scroll-bars", Vx_toolkit_scroll_bars,
6366 doc: /* If not nil, Emacs uses toolkit scroll bars. */); 6495 doc: /* If not nil, Emacs uses toolkit scroll bars. */);
diff --git a/src/print.c b/src/print.c
index b8266422473..17a896bba8d 100644
--- a/src/print.c
+++ b/src/print.c
@@ -273,7 +273,7 @@ printchar (unsigned int ch, Lisp_Object fun)
273 273
274static void 274static void
275strout (const char *ptr, EMACS_INT size, EMACS_INT size_byte, 275strout (const char *ptr, EMACS_INT size, EMACS_INT size_byte,
276 Lisp_Object printcharfun, int multibyte) 276 Lisp_Object printcharfun)
277{ 277{
278 if (size < 0) 278 if (size < 0)
279 size_byte = size = strlen (ptr); 279 size_byte = size = strlen (ptr);
@@ -406,16 +406,13 @@ print_string (Lisp_Object string, Lisp_Object printcharfun)
406 SAFE_ALLOCA (buffer, char *, nbytes); 406 SAFE_ALLOCA (buffer, char *, nbytes);
407 memcpy (buffer, SDATA (string), nbytes); 407 memcpy (buffer, SDATA (string), nbytes);
408 408
409 strout (buffer, chars, SBYTES (string), 409 strout (buffer, chars, SBYTES (string), printcharfun);
410 printcharfun, STRING_MULTIBYTE (string));
411 410
412 SAFE_FREE (); 411 SAFE_FREE ();
413 } 412 }
414 else 413 else
415 /* No need to copy, since output to print_buffer can't GC. */ 414 /* No need to copy, since output to print_buffer can't GC. */
416 strout (SSDATA (string), 415 strout (SSDATA (string), chars, SBYTES (string), printcharfun);
417 chars, SBYTES (string),
418 printcharfun, STRING_MULTIBYTE (string));
419 } 416 }
420 else 417 else
421 { 418 {
@@ -472,7 +469,7 @@ write_string (const char *data, int size)
472 printcharfun = Vstandard_output; 469 printcharfun = Vstandard_output;
473 470
474 PRINTPREPARE; 471 PRINTPREPARE;
475 strout (data, size, size, printcharfun, 0); 472 strout (data, size, size, printcharfun);
476 PRINTFINISH; 473 PRINTFINISH;
477} 474}
478 475
@@ -486,7 +483,7 @@ write_string_1 (const char *data, int size, Lisp_Object printcharfun)
486 PRINTDECLARE; 483 PRINTDECLARE;
487 484
488 PRINTPREPARE; 485 PRINTPREPARE;
489 strout (data, size, size, printcharfun, 0); 486 strout (data, size, size, printcharfun);
490 PRINTFINISH; 487 PRINTFINISH;
491} 488}
492 489
@@ -1351,7 +1348,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
1351 if (EQ (obj, being_printed[i])) 1348 if (EQ (obj, being_printed[i]))
1352 { 1349 {
1353 sprintf (buf, "#%d", i); 1350 sprintf (buf, "#%d", i);
1354 strout (buf, -1, -1, printcharfun, 0); 1351 strout (buf, -1, -1, printcharfun);
1355 return; 1352 return;
1356 } 1353 }
1357 being_printed[print_depth] = obj; 1354 being_printed[print_depth] = obj;
@@ -1367,7 +1364,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
1367 { /* Add a prefix #n= if OBJ has not yet been printed; 1364 { /* Add a prefix #n= if OBJ has not yet been printed;
1368 that is, its status field is nil. */ 1365 that is, its status field is nil. */
1369 sprintf (buf, "#%d=", -n); 1366 sprintf (buf, "#%d=", -n);
1370 strout (buf, -1, -1, printcharfun, 0); 1367 strout (buf, -1, -1, printcharfun);
1371 /* OBJ is going to be printed. Remember that fact. */ 1368 /* OBJ is going to be printed. Remember that fact. */
1372 Fputhash (obj, make_number (- n), Vprint_number_table); 1369 Fputhash (obj, make_number (- n), Vprint_number_table);
1373 } 1370 }
@@ -1375,7 +1372,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
1375 { 1372 {
1376 /* Just print #n# if OBJ has already been printed. */ 1373 /* Just print #n# if OBJ has already been printed. */
1377 sprintf (buf, "#%d#", n); 1374 sprintf (buf, "#%d#", n);
1378 strout (buf, -1, -1, printcharfun, 0); 1375 strout (buf, -1, -1, printcharfun);
1379 return; 1376 return;
1380 } 1377 }
1381 } 1378 }
@@ -1393,7 +1390,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
1393 sprintf (buf, "%ld", (long) XINT (obj)); 1390 sprintf (buf, "%ld", (long) XINT (obj));
1394 else 1391 else
1395 abort (); 1392 abort ();
1396 strout (buf, -1, -1, printcharfun, 0); 1393 strout (buf, -1, -1, printcharfun);
1397 break; 1394 break;
1398 1395
1399 case Lisp_Float: 1396 case Lisp_Float:
@@ -1401,7 +1398,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
1401 char pigbuf[FLOAT_TO_STRING_BUFSIZE]; 1398 char pigbuf[FLOAT_TO_STRING_BUFSIZE];
1402 1399
1403 float_to_string (pigbuf, XFLOAT_DATA (obj)); 1400 float_to_string (pigbuf, XFLOAT_DATA (obj));
1404 strout (pigbuf, -1, -1, printcharfun, 0); 1401 strout (pigbuf, -1, -1, printcharfun);
1405 } 1402 }
1406 break; 1403 break;
1407 1404
@@ -1479,7 +1476,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
1479 sprintf (outbuf, "\\x%04x", c); 1476 sprintf (outbuf, "\\x%04x", c);
1480 need_nonhex = 1; 1477 need_nonhex = 1;
1481 } 1478 }
1482 strout (outbuf, -1, -1, printcharfun, 0); 1479 strout (outbuf, -1, -1, printcharfun);
1483 } 1480 }
1484 else if (! multibyte 1481 else if (! multibyte
1485 && SINGLE_BYTE_CHAR_P (c) && ! ASCII_BYTE_P (c) 1482 && SINGLE_BYTE_CHAR_P (c) && ! ASCII_BYTE_P (c)
@@ -1491,7 +1488,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
1491 using octal escapes. */ 1488 using octal escapes. */
1492 char outbuf[5]; 1489 char outbuf[5];
1493 sprintf (outbuf, "\\%03o", c); 1490 sprintf (outbuf, "\\%03o", c);
1494 strout (outbuf, -1, -1, printcharfun, 0); 1491 strout (outbuf, -1, -1, printcharfun);
1495 } 1492 }
1496 else 1493 else
1497 { 1494 {
@@ -1504,7 +1501,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
1504 if ((c >= 'a' && c <= 'f') 1501 if ((c >= 'a' && c <= 'f')
1505 || (c >= 'A' && c <= 'F') 1502 || (c >= 'A' && c <= 'F')
1506 || (c >= '0' && c <= '9')) 1503 || (c >= '0' && c <= '9'))
1507 strout ("\\ ", -1, -1, printcharfun, 0); 1504 strout ("\\ ", -1, -1, printcharfun);
1508 } 1505 }
1509 1506
1510 if (c == '\"' || c == '\\') 1507 if (c == '\"' || c == '\\')
@@ -1592,7 +1589,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
1592 /* If deeper than spec'd depth, print placeholder. */ 1589 /* If deeper than spec'd depth, print placeholder. */
1593 if (INTEGERP (Vprint_level) 1590 if (INTEGERP (Vprint_level)
1594 && print_depth > XINT (Vprint_level)) 1591 && print_depth > XINT (Vprint_level))
1595 strout ("...", -1, -1, printcharfun, 0); 1592 strout ("...", -1, -1, printcharfun);
1596 else if (print_quoted && CONSP (XCDR (obj)) && NILP (XCDR (XCDR (obj))) 1593 else if (print_quoted && CONSP (XCDR (obj)) && NILP (XCDR (XCDR (obj)))
1597 && (EQ (XCAR (obj), Qquote))) 1594 && (EQ (XCAR (obj), Qquote)))
1598 { 1595 {
@@ -1652,7 +1649,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
1652 if (i != 0 && EQ (obj, halftail)) 1649 if (i != 0 && EQ (obj, halftail))
1653 { 1650 {
1654 sprintf (buf, " . #%d", i / 2); 1651 sprintf (buf, " . #%d", i / 2);
1655 strout (buf, -1, -1, printcharfun, 0); 1652 strout (buf, -1, -1, printcharfun);
1656 goto end_of_list; 1653 goto end_of_list;
1657 } 1654 }
1658 } 1655 }
@@ -1664,7 +1661,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
1664 Lisp_Object num = Fgethash (obj, Vprint_number_table, Qnil); 1661 Lisp_Object num = Fgethash (obj, Vprint_number_table, Qnil);
1665 if (INTEGERP (num)) 1662 if (INTEGERP (num))
1666 { 1663 {
1667 strout (" . ", 3, 3, printcharfun, 0); 1664 strout (" . ", 3, 3, printcharfun);
1668 print_object (obj, printcharfun, escapeflag); 1665 print_object (obj, printcharfun, escapeflag);
1669 goto end_of_list; 1666 goto end_of_list;
1670 } 1667 }
@@ -1676,7 +1673,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
1676 1673
1677 if (print_length && i > print_length) 1674 if (print_length && i > print_length)
1678 { 1675 {
1679 strout ("...", 3, 3, printcharfun, 0); 1676 strout ("...", 3, 3, printcharfun);
1680 goto end_of_list; 1677 goto end_of_list;
1681 } 1678 }
1682 1679
@@ -1691,7 +1688,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
1691 /* OBJ non-nil here means it's the end of a dotted list. */ 1688 /* OBJ non-nil here means it's the end of a dotted list. */
1692 if (!NILP (obj)) 1689 if (!NILP (obj))
1693 { 1690 {
1694 strout (" . ", 3, 3, printcharfun, 0); 1691 strout (" . ", 3, 3, printcharfun);
1695 print_object (obj, printcharfun, escapeflag); 1692 print_object (obj, printcharfun, escapeflag);
1696 } 1693 }
1697 1694
@@ -1705,7 +1702,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
1705 { 1702 {
1706 if (escapeflag) 1703 if (escapeflag)
1707 { 1704 {
1708 strout ("#<process ", -1, -1, printcharfun, 0); 1705 strout ("#<process ", -1, -1, printcharfun);
1709 print_string (XPROCESS (obj)->name, printcharfun); 1706 print_string (XPROCESS (obj)->name, printcharfun);
1710 PRINTCHAR ('>'); 1707 PRINTCHAR ('>');
1711 } 1708 }
@@ -1726,7 +1723,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
1726 PRINTCHAR ('#'); 1723 PRINTCHAR ('#');
1727 PRINTCHAR ('&'); 1724 PRINTCHAR ('&');
1728 sprintf (buf, "%ld", (long) XBOOL_VECTOR (obj)->size); 1725 sprintf (buf, "%ld", (long) XBOOL_VECTOR (obj)->size);
1729 strout (buf, -1, -1, printcharfun, 0); 1726 strout (buf, -1, -1, printcharfun);
1730 PRINTCHAR ('\"'); 1727 PRINTCHAR ('\"');
1731 1728
1732 /* Don't print more characters than the specified maximum. 1729 /* Don't print more characters than the specified maximum.
@@ -1771,18 +1768,18 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
1771 } 1768 }
1772 else if (SUBRP (obj)) 1769 else if (SUBRP (obj))
1773 { 1770 {
1774 strout ("#<subr ", -1, -1, printcharfun, 0); 1771 strout ("#<subr ", -1, -1, printcharfun);
1775 strout (XSUBR (obj)->symbol_name, -1, -1, printcharfun, 0); 1772 strout (XSUBR (obj)->symbol_name, -1, -1, printcharfun);
1776 PRINTCHAR ('>'); 1773 PRINTCHAR ('>');
1777 } 1774 }
1778 else if (WINDOWP (obj)) 1775 else if (WINDOWP (obj))
1779 { 1776 {
1780 strout ("#<window ", -1, -1, printcharfun, 0); 1777 strout ("#<window ", -1, -1, printcharfun);
1781 sprintf (buf, "%ld", (long) XFASTINT (XWINDOW (obj)->sequence_number)); 1778 sprintf (buf, "%ld", (long) XFASTINT (XWINDOW (obj)->sequence_number));
1782 strout (buf, -1, -1, printcharfun, 0); 1779 strout (buf, -1, -1, printcharfun);
1783 if (!NILP (XWINDOW (obj)->buffer)) 1780 if (!NILP (XWINDOW (obj)->buffer))
1784 { 1781 {
1785 strout (" on ", -1, -1, printcharfun, 0); 1782 strout (" on ", -1, -1, printcharfun);
1786 print_string (BVAR (XBUFFER (XWINDOW (obj)->buffer), name), printcharfun); 1783 print_string (BVAR (XBUFFER (XWINDOW (obj)->buffer), name), printcharfun);
1787 } 1784 }
1788 PRINTCHAR ('>'); 1785 PRINTCHAR ('>');
@@ -1790,13 +1787,13 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
1790 else if (TERMINALP (obj)) 1787 else if (TERMINALP (obj))
1791 { 1788 {
1792 struct terminal *t = XTERMINAL (obj); 1789 struct terminal *t = XTERMINAL (obj);
1793 strout ("#<terminal ", -1, -1, printcharfun, 0); 1790 strout ("#<terminal ", -1, -1, printcharfun);
1794 sprintf (buf, "%d", t->id); 1791 sprintf (buf, "%d", t->id);
1795 strout (buf, -1, -1, printcharfun, 0); 1792 strout (buf, -1, -1, printcharfun);
1796 if (t->name) 1793 if (t->name)
1797 { 1794 {
1798 strout (" on ", -1, -1, printcharfun, 0); 1795 strout (" on ", -1, -1, printcharfun);
1799 strout (t->name, -1, -1, printcharfun, 0); 1796 strout (t->name, -1, -1, printcharfun);
1800 } 1797 }
1801 PRINTCHAR ('>'); 1798 PRINTCHAR ('>');
1802 } 1799 }
@@ -1806,21 +1803,21 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
1806 int i; 1803 int i;
1807 EMACS_INT real_size, size; 1804 EMACS_INT real_size, size;
1808#if 0 1805#if 0
1809 strout ("#<hash-table", -1, -1, printcharfun, 0); 1806 strout ("#<hash-table", -1, -1, printcharfun);
1810 if (SYMBOLP (h->test)) 1807 if (SYMBOLP (h->test))
1811 { 1808 {
1812 PRINTCHAR (' '); 1809 PRINTCHAR (' ');
1813 PRINTCHAR ('\''); 1810 PRINTCHAR ('\'');
1814 strout (SDATA (SYMBOL_NAME (h->test)), -1, -1, printcharfun, 0); 1811 strout (SDATA (SYMBOL_NAME (h->test)), -1, -1, printcharfun);
1815 PRINTCHAR (' '); 1812 PRINTCHAR (' ');
1816 strout (SDATA (SYMBOL_NAME (h->weak)), -1, -1, printcharfun, 0); 1813 strout (SDATA (SYMBOL_NAME (h->weak)), -1, -1, printcharfun);
1817 PRINTCHAR (' '); 1814 PRINTCHAR (' ');
1818 sprintf (buf, "%ld/%ld", (long) h->count, 1815 sprintf (buf, "%ld/%ld", (long) h->count,
1819 (long) XVECTOR (h->next)->size); 1816 (long) XVECTOR (h->next)->size);
1820 strout (buf, -1, -1, printcharfun, 0); 1817 strout (buf, -1, -1, printcharfun);
1821 } 1818 }
1822 sprintf (buf, " 0x%lx", (unsigned long) h); 1819 sprintf (buf, " 0x%lx", (unsigned long) h);
1823 strout (buf, -1, -1, printcharfun, 0); 1820 strout (buf, -1, -1, printcharfun);
1824 PRINTCHAR ('>'); 1821 PRINTCHAR ('>');
1825#endif 1822#endif
1826 /* Implement a readable output, e.g.: 1823 /* Implement a readable output, e.g.:
@@ -1828,33 +1825,33 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
1828 /* Always print the size. */ 1825 /* Always print the size. */
1829 sprintf (buf, "#s(hash-table size %ld", 1826 sprintf (buf, "#s(hash-table size %ld",
1830 (long) XVECTOR (h->next)->size); 1827 (long) XVECTOR (h->next)->size);
1831 strout (buf, -1, -1, printcharfun, 0); 1828 strout (buf, -1, -1, printcharfun);
1832 1829
1833 if (!NILP (h->test)) 1830 if (!NILP (h->test))
1834 { 1831 {
1835 strout (" test ", -1, -1, printcharfun, 0); 1832 strout (" test ", -1, -1, printcharfun);
1836 print_object (h->test, printcharfun, escapeflag); 1833 print_object (h->test, printcharfun, escapeflag);
1837 } 1834 }
1838 1835
1839 if (!NILP (h->weak)) 1836 if (!NILP (h->weak))
1840 { 1837 {
1841 strout (" weakness ", -1, -1, printcharfun, 0); 1838 strout (" weakness ", -1, -1, printcharfun);
1842 print_object (h->weak, printcharfun, escapeflag); 1839 print_object (h->weak, printcharfun, escapeflag);
1843 } 1840 }
1844 1841
1845 if (!NILP (h->rehash_size)) 1842 if (!NILP (h->rehash_size))
1846 { 1843 {
1847 strout (" rehash-size ", -1, -1, printcharfun, 0); 1844 strout (" rehash-size ", -1, -1, printcharfun);
1848 print_object (h->rehash_size, printcharfun, escapeflag); 1845 print_object (h->rehash_size, printcharfun, escapeflag);
1849 } 1846 }
1850 1847
1851 if (!NILP (h->rehash_threshold)) 1848 if (!NILP (h->rehash_threshold))
1852 { 1849 {
1853 strout (" rehash-threshold ", -1, -1, printcharfun, 0); 1850 strout (" rehash-threshold ", -1, -1, printcharfun);
1854 print_object (h->rehash_threshold, printcharfun, escapeflag); 1851 print_object (h->rehash_threshold, printcharfun, escapeflag);
1855 } 1852 }
1856 1853
1857 strout (" data ", -1, -1, printcharfun, 0); 1854 strout (" data ", -1, -1, printcharfun);
1858 1855
1859 /* Print the data here as a plist. */ 1856 /* Print the data here as a plist. */
1860 real_size = HASH_TABLE_SIZE (h); 1857 real_size = HASH_TABLE_SIZE (h);
@@ -1876,7 +1873,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
1876 } 1873 }
1877 1874
1878 if (size < real_size) 1875 if (size < real_size)
1879 strout (" ...", 4, 4, printcharfun, 0); 1876 strout (" ...", 4, 4, printcharfun);
1880 1877
1881 PRINTCHAR (')'); 1878 PRINTCHAR (')');
1882 PRINTCHAR (')'); 1879 PRINTCHAR (')');
@@ -1885,10 +1882,10 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
1885 else if (BUFFERP (obj)) 1882 else if (BUFFERP (obj))
1886 { 1883 {
1887 if (NILP (BVAR (XBUFFER (obj), name))) 1884 if (NILP (BVAR (XBUFFER (obj), name)))
1888 strout ("#<killed buffer>", -1, -1, printcharfun, 0); 1885 strout ("#<killed buffer>", -1, -1, printcharfun);
1889 else if (escapeflag) 1886 else if (escapeflag)
1890 { 1887 {
1891 strout ("#<buffer ", -1, -1, printcharfun, 0); 1888 strout ("#<buffer ", -1, -1, printcharfun);
1892 print_string (BVAR (XBUFFER (obj), name), printcharfun); 1889 print_string (BVAR (XBUFFER (obj), name), printcharfun);
1893 PRINTCHAR ('>'); 1890 PRINTCHAR ('>');
1894 } 1891 }
@@ -1897,16 +1894,16 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
1897 } 1894 }
1898 else if (WINDOW_CONFIGURATIONP (obj)) 1895 else if (WINDOW_CONFIGURATIONP (obj))
1899 { 1896 {
1900 strout ("#<window-configuration>", -1, -1, printcharfun, 0); 1897 strout ("#<window-configuration>", -1, -1, printcharfun);
1901 } 1898 }
1902 else if (FRAMEP (obj)) 1899 else if (FRAMEP (obj))
1903 { 1900 {
1904 strout ((FRAME_LIVE_P (XFRAME (obj)) 1901 strout ((FRAME_LIVE_P (XFRAME (obj))
1905 ? "#<frame " : "#<dead frame "), 1902 ? "#<frame " : "#<dead frame "),
1906 -1, -1, printcharfun, 0); 1903 -1, -1, printcharfun);
1907 print_string (XFRAME (obj)->name, printcharfun); 1904 print_string (XFRAME (obj)->name, printcharfun);
1908 sprintf (buf, " 0x%lx", (unsigned long) (XFRAME (obj))); 1905 sprintf (buf, " 0x%lx", (unsigned long) (XFRAME (obj)));
1909 strout (buf, -1, -1, printcharfun, 0); 1906 strout (buf, -1, -1, printcharfun);
1910 PRINTCHAR ('>'); 1907 PRINTCHAR ('>');
1911 } 1908 }
1912 else if (FONTP (obj)) 1909 else if (FONTP (obj))
@@ -1916,9 +1913,9 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
1916 if (! FONT_OBJECT_P (obj)) 1913 if (! FONT_OBJECT_P (obj))
1917 { 1914 {
1918 if (FONT_SPEC_P (obj)) 1915 if (FONT_SPEC_P (obj))
1919 strout ("#<font-spec", -1, -1, printcharfun, 0); 1916 strout ("#<font-spec", -1, -1, printcharfun);
1920 else 1917 else
1921 strout ("#<font-entity", -1, -1, printcharfun, 0); 1918 strout ("#<font-entity", -1, -1, printcharfun);
1922 for (i = 0; i < FONT_SPEC_MAX; i++) 1919 for (i = 0; i < FONT_SPEC_MAX; i++)
1923 { 1920 {
1924 PRINTCHAR (' '); 1921 PRINTCHAR (' ');
@@ -1931,7 +1928,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
1931 } 1928 }
1932 else 1929 else
1933 { 1930 {
1934 strout ("#<font-object ", -1, -1, printcharfun, 0); 1931 strout ("#<font-object ", -1, -1, printcharfun);
1935 print_object (AREF (obj, FONT_NAME_INDEX), printcharfun, 1932 print_object (AREF (obj, FONT_NAME_INDEX), printcharfun,
1936 escapeflag); 1933 escapeflag);
1937 } 1934 }
@@ -1984,7 +1981,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
1984 print_object (tem, printcharfun, escapeflag); 1981 print_object (tem, printcharfun, escapeflag);
1985 } 1982 }
1986 if (size < real_size) 1983 if (size < real_size)
1987 strout (" ...", 4, 4, printcharfun, 0); 1984 strout (" ...", 4, 4, printcharfun);
1988 } 1985 }
1989 PRINTCHAR (']'); 1986 PRINTCHAR (']');
1990 } 1987 }
@@ -1994,32 +1991,32 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
1994 switch (XMISCTYPE (obj)) 1991 switch (XMISCTYPE (obj))
1995 { 1992 {
1996 case Lisp_Misc_Marker: 1993 case Lisp_Misc_Marker:
1997 strout ("#<marker ", -1, -1, printcharfun, 0); 1994 strout ("#<marker ", -1, -1, printcharfun);
1998 /* Do you think this is necessary? */ 1995 /* Do you think this is necessary? */
1999 if (XMARKER (obj)->insertion_type != 0) 1996 if (XMARKER (obj)->insertion_type != 0)
2000 strout ("(moves after insertion) ", -1, -1, printcharfun, 0); 1997 strout ("(moves after insertion) ", -1, -1, printcharfun);
2001 if (! XMARKER (obj)->buffer) 1998 if (! XMARKER (obj)->buffer)
2002 strout ("in no buffer", -1, -1, printcharfun, 0); 1999 strout ("in no buffer", -1, -1, printcharfun);
2003 else 2000 else
2004 { 2001 {
2005 sprintf (buf, "at %ld", (long)marker_position (obj)); 2002 sprintf (buf, "at %ld", (long)marker_position (obj));
2006 strout (buf, -1, -1, printcharfun, 0); 2003 strout (buf, -1, -1, printcharfun);
2007 strout (" in ", -1, -1, printcharfun, 0); 2004 strout (" in ", -1, -1, printcharfun);
2008 print_string (BVAR (XMARKER (obj)->buffer, name), printcharfun); 2005 print_string (BVAR (XMARKER (obj)->buffer, name), printcharfun);
2009 } 2006 }
2010 PRINTCHAR ('>'); 2007 PRINTCHAR ('>');
2011 break; 2008 break;
2012 2009
2013 case Lisp_Misc_Overlay: 2010 case Lisp_Misc_Overlay:
2014 strout ("#<overlay ", -1, -1, printcharfun, 0); 2011 strout ("#<overlay ", -1, -1, printcharfun);
2015 if (! XMARKER (OVERLAY_START (obj))->buffer) 2012 if (! XMARKER (OVERLAY_START (obj))->buffer)
2016 strout ("in no buffer", -1, -1, printcharfun, 0); 2013 strout ("in no buffer", -1, -1, printcharfun);
2017 else 2014 else
2018 { 2015 {
2019 sprintf (buf, "from %ld to %ld in ", 2016 sprintf (buf, "from %ld to %ld in ",
2020 (long)marker_position (OVERLAY_START (obj)), 2017 (long)marker_position (OVERLAY_START (obj)),
2021 (long)marker_position (OVERLAY_END (obj))); 2018 (long)marker_position (OVERLAY_END (obj)));
2022 strout (buf, -1, -1, printcharfun, 0); 2019 strout (buf, -1, -1, printcharfun);
2023 print_string (BVAR (XMARKER (OVERLAY_START (obj))->buffer, name), 2020 print_string (BVAR (XMARKER (OVERLAY_START (obj))->buffer, name),
2024 printcharfun); 2021 printcharfun);
2025 } 2022 }
@@ -2029,15 +2026,15 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
2029 /* Remaining cases shouldn't happen in normal usage, but let's print 2026 /* Remaining cases shouldn't happen in normal usage, but let's print
2030 them anyway for the benefit of the debugger. */ 2027 them anyway for the benefit of the debugger. */
2031 case Lisp_Misc_Free: 2028 case Lisp_Misc_Free:
2032 strout ("#<misc free cell>", -1, -1, printcharfun, 0); 2029 strout ("#<misc free cell>", -1, -1, printcharfun);
2033 break; 2030 break;
2034 2031
2035 case Lisp_Misc_Save_Value: 2032 case Lisp_Misc_Save_Value:
2036 strout ("#<save_value ", -1, -1, printcharfun, 0); 2033 strout ("#<save_value ", -1, -1, printcharfun);
2037 sprintf(buf, "ptr=0x%08lx int=%d", 2034 sprintf(buf, "ptr=0x%08lx int=%d",
2038 (unsigned long) XSAVE_VALUE (obj)->pointer, 2035 (unsigned long) XSAVE_VALUE (obj)->pointer,
2039 XSAVE_VALUE (obj)->integer); 2036 XSAVE_VALUE (obj)->integer);
2040 strout (buf, -1, -1, printcharfun, 0); 2037 strout (buf, -1, -1, printcharfun);
2041 PRINTCHAR ('>'); 2038 PRINTCHAR ('>');
2042 break; 2039 break;
2043 2040
@@ -2051,16 +2048,16 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
2051 { 2048 {
2052 /* We're in trouble if this happens! 2049 /* We're in trouble if this happens!
2053 Probably should just abort () */ 2050 Probably should just abort () */
2054 strout ("#<EMACS BUG: INVALID DATATYPE ", -1, -1, printcharfun, 0); 2051 strout ("#<EMACS BUG: INVALID DATATYPE ", -1, -1, printcharfun);
2055 if (MISCP (obj)) 2052 if (MISCP (obj))
2056 sprintf (buf, "(MISC 0x%04x)", (int) XMISCTYPE (obj)); 2053 sprintf (buf, "(MISC 0x%04x)", (int) XMISCTYPE (obj));
2057 else if (VECTORLIKEP (obj)) 2054 else if (VECTORLIKEP (obj))
2058 sprintf (buf, "(PVEC 0x%08x)", (int) XVECTOR (obj)->size); 2055 sprintf (buf, "(PVEC 0x%08x)", (int) XVECTOR (obj)->size);
2059 else 2056 else
2060 sprintf (buf, "(0x%02x)", (int) XTYPE (obj)); 2057 sprintf (buf, "(0x%02x)", (int) XTYPE (obj));
2061 strout (buf, -1, -1, printcharfun, 0); 2058 strout (buf, -1, -1, printcharfun);
2062 strout (" Save your buffers immediately and please report this bug>", 2059 strout (" Save your buffers immediately and please report this bug>",
2063 -1, -1, printcharfun, 0); 2060 -1, -1, printcharfun);
2064 } 2061 }
2065 } 2062 }
2066 2063
diff --git a/src/process.c b/src/process.c
index c9b420ab2ae..1abfbd3f2a4 100644
--- a/src/process.c
+++ b/src/process.c
@@ -159,9 +159,6 @@ extern Lisp_Object QCfilter;
159#define SERIALCONN_P(p) (EQ (XPROCESS (p)->type, Qserial)) 159#define SERIALCONN_P(p) (EQ (XPROCESS (p)->type, Qserial))
160#define SERIALCONN1_P(p) (EQ ((p)->type, Qserial)) 160#define SERIALCONN1_P(p) (EQ ((p)->type, Qserial))
161 161
162/* Define first descriptor number available for subprocesses. */
163#define FIRST_PROC_DESC 3
164
165#ifndef HAVE_H_ERRNO 162#ifndef HAVE_H_ERRNO
166extern int h_errno; 163extern int h_errno;
167#endif 164#endif
@@ -278,10 +275,6 @@ static SELECT_TYPE connect_wait_mask;
278 275
279/* Number of bits set in connect_wait_mask. */ 276/* Number of bits set in connect_wait_mask. */
280static int num_pending_connects; 277static int num_pending_connects;
281
282#define IF_NON_BLOCKING_CONNECT(s) s
283#else /* NON_BLOCKING_CONNECT */
284#define IF_NON_BLOCKING_CONNECT(s)
285#endif /* NON_BLOCKING_CONNECT */ 278#endif /* NON_BLOCKING_CONNECT */
286 279
287/* The largest descriptor currently in use for a process object. */ 280/* The largest descriptor currently in use for a process object. */
@@ -1250,8 +1243,8 @@ Returns nil if format of ADDRESS is invalid. */)
1250static Lisp_Object 1243static Lisp_Object
1251list_processes_1 (Lisp_Object query_only) 1244list_processes_1 (Lisp_Object query_only)
1252{ 1245{
1253 register Lisp_Object tail, tem; 1246 register Lisp_Object tail;
1254 Lisp_Object proc, minspace, tem1; 1247 Lisp_Object proc, minspace;
1255 register struct Lisp_Process *p; 1248 register struct Lisp_Process *p;
1256 char tembuf[300]; 1249 char tembuf[300];
1257 int w_proc, w_buffer, w_tty; 1250 int w_proc, w_buffer, w_tty;
@@ -1453,10 +1446,10 @@ list_processes_1 (Lisp_Object query_only)
1453 } 1446 }
1454 else 1447 else
1455 { 1448 {
1456 tem = p->command; 1449 Lisp_Object tem = p->command;
1457 while (1) 1450 while (1)
1458 { 1451 {
1459 tem1 = Fcar (tem); 1452 Lisp_Object tem1 = Fcar (tem);
1460 if (NILP (tem1)) 1453 if (NILP (tem1))
1461 break; 1454 break;
1462 Finsert (1, &tem1); 1455 Finsert (1, &tem1);
@@ -1519,11 +1512,11 @@ the command through a shell and redirect one of them using the shell
1519syntax. 1512syntax.
1520 1513
1521usage: (start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS) */) 1514usage: (start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS) */)
1522 (int nargs, register Lisp_Object *args) 1515 (size_t nargs, register Lisp_Object *args)
1523{ 1516{
1524 Lisp_Object buffer, name, program, proc, current_dir, tem; 1517 Lisp_Object buffer, name, program, proc, current_dir, tem;
1525 register unsigned char **new_argv; 1518 register unsigned char **new_argv;
1526 register int i; 1519 register size_t i;
1527 int count = SPECPDL_INDEX (); 1520 int count = SPECPDL_INDEX ();
1528 1521
1529 buffer = args[1]; 1522 buffer = args[1];
@@ -1729,7 +1722,7 @@ usage: (start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS) */)
1729 new_argv = (unsigned char **) alloca ((nargs - 1) * sizeof (char *)); 1722 new_argv = (unsigned char **) alloca ((nargs - 1) * sizeof (char *));
1730 new_argv[nargs - 2] = 0; 1723 new_argv[nargs - 2] = 0;
1731 1724
1732 for (i = nargs - 3; i >= 0; i--) 1725 for (i = nargs - 2; i-- != 0; )
1733 { 1726 {
1734 new_argv[i] = SDATA (XCAR (tem)); 1727 new_argv[i] = SDATA (XCAR (tem));
1735 tem = XCDR (tem); 1728 tem = XCDR (tem);
@@ -1919,8 +1912,7 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir)
1919 /* child_setup must clobber environ on systems with true vfork. 1912 /* child_setup must clobber environ on systems with true vfork.
1920 Protect it from permanent change. */ 1913 Protect it from permanent change. */
1921 char **save_environ = environ; 1914 char **save_environ = environ;
1922 1915 volatile Lisp_Object encoded_current_dir = ENCODE_FILE (current_dir);
1923 current_dir = ENCODE_FILE (current_dir);
1924 1916
1925#ifndef WINDOWSNT 1917#ifndef WINDOWSNT
1926 pid = vfork (); 1918 pid = vfork ();
@@ -2061,13 +2053,13 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir)
2061 child_setup_tty (xforkout); 2053 child_setup_tty (xforkout);
2062#ifdef WINDOWSNT 2054#ifdef WINDOWSNT
2063 pid = child_setup (xforkin, xforkout, xforkout, 2055 pid = child_setup (xforkin, xforkout, xforkout,
2064 new_argv, 1, current_dir); 2056 new_argv, 1, encoded_current_dir);
2065#else /* not WINDOWSNT */ 2057#else /* not WINDOWSNT */
2066#ifdef FD_CLOEXEC 2058#ifdef FD_CLOEXEC
2067 emacs_close (wait_child_setup[0]); 2059 emacs_close (wait_child_setup[0]);
2068#endif 2060#endif
2069 child_setup (xforkin, xforkout, xforkout, 2061 child_setup (xforkin, xforkout, xforkout,
2070 new_argv, 1, current_dir); 2062 new_argv, 1, encoded_current_dir);
2071#endif /* not WINDOWSNT */ 2063#endif /* not WINDOWSNT */
2072 } 2064 }
2073 environ = save_environ; 2065 environ = save_environ;
@@ -2689,7 +2681,7 @@ Examples:
2689\(serial-process-configure :port "\\\\.\\COM13" :bytesize 7) 2681\(serial-process-configure :port "\\\\.\\COM13" :bytesize 7)
2690 2682
2691usage: (serial-process-configure &rest ARGS) */) 2683usage: (serial-process-configure &rest ARGS) */)
2692 (int nargs, Lisp_Object *args) 2684 (size_t nargs, Lisp_Object *args)
2693{ 2685{
2694 struct Lisp_Process *p; 2686 struct Lisp_Process *p;
2695 Lisp_Object contact = Qnil; 2687 Lisp_Object contact = Qnil;
@@ -2807,7 +2799,7 @@ Examples:
2807\(make-serial-process :port "/dev/tty.BlueConsole-SPP-1" :speed nil) 2799\(make-serial-process :port "/dev/tty.BlueConsole-SPP-1" :speed nil)
2808 2800
2809usage: (make-serial-process &rest ARGS) */) 2801usage: (make-serial-process &rest ARGS) */)
2810 (int nargs, Lisp_Object *args) 2802 (size_t nargs, Lisp_Object *args)
2811{ 2803{
2812 int fd = -1; 2804 int fd = -1;
2813 Lisp_Object proc, contact, port; 2805 Lisp_Object proc, contact, port;
@@ -3085,7 +3077,7 @@ The original argument list, modified with the actual connection
3085information, is available via the `process-contact' function. 3077information, is available via the `process-contact' function.
3086 3078
3087usage: (make-network-process &rest ARGS) */) 3079usage: (make-network-process &rest ARGS) */)
3088 (int nargs, Lisp_Object *args) 3080 (size_t nargs, Lisp_Object *args)
3089{ 3081{
3090 Lisp_Object proc; 3082 Lisp_Object proc;
3091 Lisp_Object contact; 3083 Lisp_Object contact;
@@ -3401,9 +3393,12 @@ usage: (make-network-process &rest ARGS) */)
3401 3393
3402 for (lres = res; lres; lres = lres->ai_next) 3394 for (lres = res; lres; lres = lres->ai_next)
3403 { 3395 {
3404 int optn, optbits; 3396 size_t optn;
3397 int optbits;
3405 3398
3399#ifdef WINDOWSNT
3406 retry_connect: 3400 retry_connect:
3401#endif
3407 3402
3408 s = socket (lres->ai_family, lres->ai_socktype, lres->ai_protocol); 3403 s = socket (lres->ai_family, lres->ai_socktype, lres->ai_protocol);
3409 if (s < 0) 3404 if (s < 0)
@@ -3467,7 +3462,7 @@ usage: (make-network-process &rest ARGS) */)
3467 if (EQ (service, Qt)) 3462 if (EQ (service, Qt))
3468 { 3463 {
3469 struct sockaddr_in sa1; 3464 struct sockaddr_in sa1;
3470 int len1 = sizeof (sa1); 3465 socklen_t len1 = sizeof (sa1);
3471 if (getsockname (s, (struct sockaddr *)&sa1, &len1) == 0) 3466 if (getsockname (s, (struct sockaddr *)&sa1, &len1) == 0)
3472 { 3467 {
3473 ((struct sockaddr_in *)(lres->ai_addr))->sin_port = sa1.sin_port; 3468 ((struct sockaddr_in *)(lres->ai_addr))->sin_port = sa1.sin_port;
@@ -3514,7 +3509,8 @@ usage: (make-network-process &rest ARGS) */)
3514 /* Unlike most other syscalls connect() cannot be called 3509 /* Unlike most other syscalls connect() cannot be called
3515 again. (That would return EALREADY.) The proper way to 3510 again. (That would return EALREADY.) The proper way to
3516 wait for completion is select(). */ 3511 wait for completion is select(). */
3517 int sc, len; 3512 int sc;
3513 socklen_t len;
3518 SELECT_TYPE fdset; 3514 SELECT_TYPE fdset;
3519 retry_select: 3515 retry_select:
3520 FD_ZERO (&fdset); 3516 FD_ZERO (&fdset);
@@ -3587,7 +3583,7 @@ usage: (make-network-process &rest ARGS) */)
3587 if (!is_server) 3583 if (!is_server)
3588 { 3584 {
3589 struct sockaddr_in sa1; 3585 struct sockaddr_in sa1;
3590 int len1 = sizeof (sa1); 3586 socklen_t len1 = sizeof (sa1);
3591 if (getsockname (s, (struct sockaddr *)&sa1, &len1) == 0) 3587 if (getsockname (s, (struct sockaddr *)&sa1, &len1) == 0)
3592 contact = Fplist_put (contact, QClocal, 3588 contact = Fplist_put (contact, QClocal,
3593 conv_sockaddr_to_lisp ((struct sockaddr *)&sa1, len1)); 3589 conv_sockaddr_to_lisp ((struct sockaddr *)&sa1, len1));
@@ -3705,10 +3701,10 @@ usage: (make-network-process &rest ARGS) */)
3705 3701
3706 { 3702 {
3707 /* Setup coding systems for communicating with the network stream. */ 3703 /* Setup coding systems for communicating with the network stream. */
3708 struct gcpro gcpro1; 3704 struct gcpro inner_gcpro1;
3709 /* Qt denotes we have not yet called Ffind_operation_coding_system. */ 3705 /* Qt denotes we have not yet called Ffind_operation_coding_system. */
3710 Lisp_Object coding_systems = Qt; 3706 Lisp_Object coding_systems = Qt;
3711 Lisp_Object args[5], val; 3707 Lisp_Object fargs[5], val;
3712 3708
3713 if (!NILP (tem)) 3709 if (!NILP (tem))
3714 { 3710 {
@@ -3731,11 +3727,11 @@ usage: (make-network-process &rest ARGS) */)
3731 coding_systems = Qnil; 3727 coding_systems = Qnil;
3732 else 3728 else
3733 { 3729 {
3734 args[0] = Qopen_network_stream, args[1] = name, 3730 fargs[0] = Qopen_network_stream, fargs[1] = name,
3735 args[2] = buffer, args[3] = host, args[4] = service; 3731 fargs[2] = buffer, fargs[3] = host, fargs[4] = service;
3736 GCPRO1 (proc); 3732 GCPRO1_VAR (proc, inner_gcpro);
3737 coding_systems = Ffind_operation_coding_system (5, args); 3733 coding_systems = Ffind_operation_coding_system (5, fargs);
3738 UNGCPRO; 3734 UNGCPRO_VAR (inner_gcpro);
3739 } 3735 }
3740 if (CONSP (coding_systems)) 3736 if (CONSP (coding_systems))
3741 val = XCAR (coding_systems); 3737 val = XCAR (coding_systems);
@@ -3764,11 +3760,11 @@ usage: (make-network-process &rest ARGS) */)
3764 coding_systems = Qnil; 3760 coding_systems = Qnil;
3765 else 3761 else
3766 { 3762 {
3767 args[0] = Qopen_network_stream, args[1] = name, 3763 fargs[0] = Qopen_network_stream, fargs[1] = name,
3768 args[2] = buffer, args[3] = host, args[4] = service; 3764 fargs[2] = buffer, fargs[3] = host, fargs[4] = service;
3769 GCPRO1 (proc); 3765 GCPRO1_VAR (proc, inner_gcpro);
3770 coding_systems = Ffind_operation_coding_system (5, args); 3766 coding_systems = Ffind_operation_coding_system (5, fargs);
3771 UNGCPRO; 3767 UNGCPRO_VAR (inner_gcpro);
3772 } 3768 }
3773 } 3769 }
3774 if (CONSP (coding_systems)) 3770 if (CONSP (coding_systems))
@@ -3948,7 +3944,7 @@ FLAGS is the current flags of the interface. */)
3948 CHECK_STRING (ifname); 3944 CHECK_STRING (ifname);
3949 3945
3950 memset (rq.ifr_name, 0, sizeof rq.ifr_name); 3946 memset (rq.ifr_name, 0, sizeof rq.ifr_name);
3951 strncpy (rq.ifr_name, SDATA (ifname), sizeof (rq.ifr_name)); 3947 strncpy (rq.ifr_name, SSDATA (ifname), sizeof (rq.ifr_name));
3952 3948
3953 s = socket (AF_INET, SOCK_STREAM, 0); 3949 s = socket (AF_INET, SOCK_STREAM, 0);
3954 if (s < 0) 3950 if (s < 0)
@@ -4192,7 +4188,7 @@ server_accept_connection (Lisp_Object server, int channel)
4192 struct sockaddr_un un; 4188 struct sockaddr_un un;
4193#endif 4189#endif
4194 } saddr; 4190 } saddr;
4195 int len = sizeof saddr; 4191 socklen_t len = sizeof saddr;
4196 4192
4197 s = accept (channel, &saddr.sa, &len); 4193 s = accept (channel, &saddr.sa, &len);
4198 4194
@@ -4553,7 +4549,7 @@ wait_reading_process_output (int time_limit, int microsecs, int read_kbd,
4553 struct buffer *old_buffer = current_buffer; 4549 struct buffer *old_buffer = current_buffer;
4554 Lisp_Object old_window = selected_window; 4550 Lisp_Object old_window = selected_window;
4555 4551
4556 timer_delay = timer_check (1); 4552 timer_delay = timer_check ();
4557 4553
4558 /* If a timer has run, this might have changed buffers 4554 /* If a timer has run, this might have changed buffers
4559 an alike. Make read_key_sequence aware of that. */ 4555 an alike. Make read_key_sequence aware of that. */
@@ -4928,8 +4924,6 @@ wait_reading_process_output (int time_limit, int microsecs, int read_kbd,
4928 d->func (channel, d->data, 0); 4924 d->func (channel, d->data, 0);
4929 } 4925 }
4930 4926
4931 /* Really FIRST_PROC_DESC should be 0 on Unix,
4932 but this is safer in the short run. */
4933 for (channel = 0; channel <= max_process_desc; channel++) 4927 for (channel = 0; channel <= max_process_desc; channel++)
4934 { 4928 {
4935 if (FD_ISSET (channel, &Available) 4929 if (FD_ISSET (channel, &Available)
@@ -5059,7 +5053,7 @@ wait_reading_process_output (int time_limit, int microsecs, int read_kbd,
5059 /* getsockopt(,,SO_ERROR,,) is said to hang on some systems. 5053 /* getsockopt(,,SO_ERROR,,) is said to hang on some systems.
5060 So only use it on systems where it is known to work. */ 5054 So only use it on systems where it is known to work. */
5061 { 5055 {
5062 int xlen = sizeof (xerrno); 5056 socklen_t xlen = sizeof (xerrno);
5063 if (getsockopt (channel, SOL_SOCKET, SO_ERROR, &xerrno, &xlen)) 5057 if (getsockopt (channel, SOL_SOCKET, SO_ERROR, &xerrno, &xlen))
5064 xerrno = errno; 5058 xerrno = errno;
5065 } 5059 }
@@ -5128,9 +5122,9 @@ read_process_output_call (Lisp_Object fun_and_args)
5128} 5122}
5129 5123
5130static Lisp_Object 5124static Lisp_Object
5131read_process_output_error_handler (Lisp_Object error) 5125read_process_output_error_handler (Lisp_Object error_val)
5132{ 5126{
5133 cmd_error_internal (error, "error in process filter: "); 5127 cmd_error_internal (error_val, "error in process filter: ");
5134 Vinhibit_quit = Qt; 5128 Vinhibit_quit = Qt;
5135 update_echo_area (); 5129 update_echo_area ();
5136 Fsleep_for (make_number (2), Qnil); 5130 Fsleep_for (make_number (2), Qnil);
@@ -5171,7 +5165,7 @@ read_process_output (Lisp_Object proc, register int channel)
5171 /* We have a working select, so proc_buffered_char is always -1. */ 5165 /* We have a working select, so proc_buffered_char is always -1. */
5172 if (DATAGRAM_CHAN_P (channel)) 5166 if (DATAGRAM_CHAN_P (channel))
5173 { 5167 {
5174 int len = datagram_address[channel].len; 5168 socklen_t len = datagram_address[channel].len;
5175 nbytes = recvfrom (channel, chars + carryover, readmax, 5169 nbytes = recvfrom (channel, chars + carryover, readmax,
5176 0, datagram_address[channel].sa, &len); 5170 0, datagram_address[channel].sa, &len);
5177 } 5171 }
@@ -5477,7 +5471,7 @@ read_process_output (Lisp_Object proc, register int channel)
5477jmp_buf send_process_frame; 5471jmp_buf send_process_frame;
5478Lisp_Object process_sent_to; 5472Lisp_Object process_sent_to;
5479 5473
5480static SIGTYPE 5474static void
5481send_process_trap (int ignore) 5475send_process_trap (int ignore)
5482{ 5476{
5483 SIGNAL_THREAD_CHECK (SIGPIPE); 5477 SIGNAL_THREAD_CHECK (SIGPIPE);
@@ -5504,7 +5498,7 @@ send_process (volatile Lisp_Object proc, const char *volatile buf,
5504 EMACS_INT rv; 5498 EMACS_INT rv;
5505 struct coding_system *coding; 5499 struct coding_system *coding;
5506 struct gcpro gcpro1; 5500 struct gcpro gcpro1;
5507 SIGTYPE (*volatile old_sigpipe) (int); 5501 void (*volatile old_sigpipe) (int);
5508 5502
5509 GCPRO1 (object); 5503 GCPRO1 (object);
5510 5504
@@ -5626,7 +5620,7 @@ send_process (volatile Lisp_Object proc, const char *volatile buf,
5626 while (this > 0) 5620 while (this > 0)
5627 { 5621 {
5628 int outfd = p->outfd; 5622 int outfd = p->outfd;
5629 old_sigpipe = (SIGTYPE (*) (int)) signal (SIGPIPE, send_process_trap); 5623 old_sigpipe = (void (*) (int)) signal (SIGPIPE, send_process_trap);
5630#ifdef DATAGRAM_SOCKETS 5624#ifdef DATAGRAM_SOCKETS
5631 if (DATAGRAM_CHAN_P (outfd)) 5625 if (DATAGRAM_CHAN_P (outfd))
5632 { 5626 {
@@ -5925,7 +5919,7 @@ process_send_signal (Lisp_Object process, int signo, Lisp_Object current_group,
5925 5919
5926 if (sig_char && *sig_char != CDISABLE) 5920 if (sig_char && *sig_char != CDISABLE)
5927 { 5921 {
5928 send_process (proc, sig_char, 1, Qnil); 5922 send_process (proc, (char *) sig_char, 1, Qnil);
5929 return; 5923 return;
5930 } 5924 }
5931 /* If we can't send the signal with a character, 5925 /* If we can't send the signal with a character,
@@ -6386,7 +6380,7 @@ process has been transmitted to the serial port. */)
6386 indirectly; if it does, that is a bug */ 6380 indirectly; if it does, that is a bug */
6387 6381
6388#ifdef SIGCHLD 6382#ifdef SIGCHLD
6389static SIGTYPE 6383static void
6390sigchld_handler (int signo) 6384sigchld_handler (int signo)
6391{ 6385{
6392 int old_errno = errno; 6386 int old_errno = errno;
@@ -6534,9 +6528,9 @@ exec_sentinel_unwind (Lisp_Object data)
6534} 6528}
6535 6529
6536static Lisp_Object 6530static Lisp_Object
6537exec_sentinel_error_handler (Lisp_Object error) 6531exec_sentinel_error_handler (Lisp_Object error_val)
6538{ 6532{
6539 cmd_error_internal (error, "error in process sentinel: "); 6533 cmd_error_internal (error_val, "error in process sentinel: ");
6540 Vinhibit_quit = Qt; 6534 Vinhibit_quit = Qt;
6541 update_echo_area (); 6535 update_echo_area ();
6542 Fsleep_for (make_number (2), Qnil); 6536 Fsleep_for (make_number (2), Qnil);
@@ -6953,7 +6947,7 @@ wait_reading_process_output (int time_limit, int microsecs, int read_kbd,
6953 do 6947 do
6954 { 6948 {
6955 int old_timers_run = timers_run; 6949 int old_timers_run = timers_run;
6956 timer_delay = timer_check (1); 6950 timer_delay = timer_check ();
6957 if (timers_run != old_timers_run && do_display) 6951 if (timers_run != old_timers_run && do_display)
6958 /* We must retry, since a timer may have requeued itself 6952 /* We must retry, since a timer may have requeued itself
6959 and that could alter the time delay. */ 6953 and that could alter the time delay. */
diff --git a/src/region-cache.c b/src/region-cache.c
index 1f9b62da9fa..53ce0e9d802 100644
--- a/src/region-cache.c
+++ b/src/region-cache.c
@@ -290,37 +290,37 @@ move_cache_gap (struct region_cache *c, EMACS_INT pos, EMACS_INT min_size)
290} 290}
291 291
292 292
293/* Insert a new boundary in cache C; it will have cache index INDEX, 293/* Insert a new boundary in cache C; it will have cache index I,
294 and have the specified POS and VALUE. */ 294 and have the specified POS and VALUE. */
295static void 295static void
296insert_cache_boundary (struct region_cache *c, EMACS_INT index, EMACS_INT pos, 296insert_cache_boundary (struct region_cache *c, EMACS_INT i, EMACS_INT pos,
297 int value) 297 int value)
298{ 298{
299 /* index must be a valid cache index. */ 299 /* i must be a valid cache index. */
300 if (index < 0 || index > c->cache_len) 300 if (i < 0 || i > c->cache_len)
301 abort (); 301 abort ();
302 302
303 /* We must never want to insert something before the dummy first 303 /* We must never want to insert something before the dummy first
304 boundary. */ 304 boundary. */
305 if (index == 0) 305 if (i == 0)
306 abort (); 306 abort ();
307 307
308 /* We must only be inserting things in order. */ 308 /* We must only be inserting things in order. */
309 if (! (BOUNDARY_POS (c, index-1) < pos 309 if (! (BOUNDARY_POS (c, i - 1) < pos
310 && (index == c->cache_len 310 && (i == c->cache_len
311 || pos < BOUNDARY_POS (c, index)))) 311 || pos < BOUNDARY_POS (c, i))))
312 abort (); 312 abort ();
313 313
314 /* The value must be different from the ones around it. However, we 314 /* The value must be different from the ones around it. However, we
315 temporarily create boundaries that establish the same value as 315 temporarily create boundaries that establish the same value as
316 the subsequent boundary, so we're not going to flag that case. */ 316 the subsequent boundary, so we're not going to flag that case. */
317 if (BOUNDARY_VALUE (c, index-1) == value) 317 if (BOUNDARY_VALUE (c, i - 1) == value)
318 abort (); 318 abort ();
319 319
320 move_cache_gap (c, index, 1); 320 move_cache_gap (c, i, 1);
321 321
322 c->boundaries[index].pos = pos - c->buffer_beg; 322 c->boundaries[i].pos = pos - c->buffer_beg;
323 c->boundaries[index].value = value; 323 c->boundaries[i].value = value;
324 c->gap_start++; 324 c->gap_start++;
325 c->gap_len--; 325 c->gap_len--;
326 c->cache_len++; 326 c->cache_len++;
@@ -808,4 +808,3 @@ pp_cache (struct region_cache *c)
808 fprintf (stderr, "%ld : %d\n", (long)pos, BOUNDARY_VALUE (c, i)); 808 fprintf (stderr, "%ld : %d\n", (long)pos, BOUNDARY_VALUE (c, i));
809 } 809 }
810} 810}
811
diff --git a/src/region-cache.h b/src/region-cache.h
index 0da159285e4..8e4336c2885 100644
--- a/src/region-cache.h
+++ b/src/region-cache.h
@@ -111,3 +111,5 @@ extern int region_cache_backward (struct buffer *BUF,
111 EMACS_INT POS, 111 EMACS_INT POS,
112 EMACS_INT *NEXT); 112 EMACS_INT *NEXT);
113 113
114/* For debugging. */
115void pp_cache (struct region_cache *);
diff --git a/src/s/template.h b/src/s/template.h
index ee5afa81de4..4e0400e99e3 100644
--- a/src/s/template.h
+++ b/src/s/template.h
@@ -77,15 +77,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
77 a file that someone else has modified in his Emacs. */ 77 a file that someone else has modified in his Emacs. */
78#define CLASH_DETECTION 78#define CLASH_DETECTION
79 79
80/* Define this if your operating system declares signal handlers to
81 have a type other than the usual. `The usual' is `void' for ANSI C
82 systems (i.e. when the __STDC__ macro is defined), and `int' for
83 pre-ANSI systems. If you're using GCC on an older system, __STDC__
84 will be defined, but the system's include files will still say that
85 signal returns int or whatever; in situations like that, define
86 this to be what the system's include files want. */
87/* #define SIGTYPE int */
88
89/* If the character used to separate elements of the executable path 80/* If the character used to separate elements of the executable path
90 is not ':', #define this to be the appropriate character constant. */ 81 is not ':', #define this to be the appropriate character constant. */
91/* #define SEPCHAR ':' */ 82/* #define SEPCHAR ':' */
diff --git a/src/s/usg5-4-common.h b/src/s/usg5-4-common.h
index aeedd7f4b15..236f71e3007 100644
--- a/src/s/usg5-4-common.h
+++ b/src/s/usg5-4-common.h
@@ -38,9 +38,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
38/* The docs for system V/386 suggest v.3 has sigpause, so let's try it. */ 38/* The docs for system V/386 suggest v.3 has sigpause, so let's try it. */
39#define HAVE_SYSV_SIGPAUSE 39#define HAVE_SYSV_SIGPAUSE
40 40
41/* On USG systems signal handlers return void. */
42#define SIGTYPE void
43
44/* Get FIONREAD from <sys/filio.h>. Get <sys/ttold.h> to get struct tchars. 41/* Get FIONREAD from <sys/filio.h>. Get <sys/ttold.h> to get struct tchars.
45 But get <termio.h> first to make sure ttold.h doesn't interfere. 42 But get <termio.h> first to make sure ttold.h doesn't interfere.
46 And don't try to use SIGIO yet. */ 43 And don't try to use SIGIO yet. */
diff --git a/src/scroll.c b/src/scroll.c
index 33af18d2090..fcec596daa3 100644
--- a/src/scroll.c
+++ b/src/scroll.c
@@ -239,14 +239,16 @@ calculate_scrolling (FRAME_PTR frame,
239 of lines. */ 239 of lines. */
240 240
241static void 241static void
242do_scrolling (struct frame *frame, struct glyph_matrix *current_matrix, struct matrix_elt *matrix, int window_size, int unchanged_at_top) 242do_scrolling (struct frame *frame, struct glyph_matrix *current_matrix,
243 struct matrix_elt *matrix, int window_size,
244 int unchanged_at_top)
243{ 245{
244 struct matrix_elt *p; 246 struct matrix_elt *p;
245 int i, j, k; 247 int i, j, k;
246 248
247 /* Set to 1 if we have set a terminal window with 249 /* Set to 1 if we have set a terminal window with
248 set_terminal_window. */ 250 set_terminal_window. It's unsigned to work around GCC bug 48228. */
249 int terminal_window_p = 0; 251 unsigned int terminal_window_p = 0;
250 252
251 /* A queue for line insertions to be done. */ 253 /* A queue for line insertions to be done. */
252 struct queue { int count, pos; }; 254 struct queue { int count, pos; };
@@ -831,7 +833,9 @@ scrolling_1 (FRAME_PTR frame, int window_size, int unchanged_at_top,
831 such a line will have little weight. */ 833 such a line will have little weight. */
832 834
833int 835int
834scrolling_max_lines_saved (int start, int end, int *oldhash, int *newhash, int *cost) 836scrolling_max_lines_saved (int start, int end,
837 int *oldhash, int *newhash,
838 int *cost)
835{ 839{
836 struct { int hash; int count; } lines[01000]; 840 struct { int hash; int count; } lines[01000];
837 register int i, h; 841 register int i, h;
@@ -920,7 +924,8 @@ scroll_cost (FRAME_PTR frame, int from, int to, int amount)
920 overhead and multiply factor values */ 924 overhead and multiply factor values */
921 925
922static void 926static void
923line_ins_del (FRAME_PTR frame, int ov1, int pf1, int ovn, int pfn, register int *ov, register int *mf) 927line_ins_del (FRAME_PTR frame, int ov1, int pf1, int ovn, int pfn,
928 register int *ov, register int *mf)
924{ 929{
925 register EMACS_INT i; 930 register EMACS_INT i;
926 register EMACS_INT frame_lines = FRAME_LINES (frame); 931 register EMACS_INT frame_lines = FRAME_LINES (frame);
diff --git a/src/search.c b/src/search.c
index bf93a7fe442..682fa185bbb 100644
--- a/src/search.c
+++ b/src/search.c
@@ -95,10 +95,9 @@ static void save_search_regs (void);
95static EMACS_INT simple_search (EMACS_INT, unsigned char *, EMACS_INT, 95static EMACS_INT simple_search (EMACS_INT, unsigned char *, EMACS_INT,
96 EMACS_INT, Lisp_Object, EMACS_INT, EMACS_INT, 96 EMACS_INT, Lisp_Object, EMACS_INT, EMACS_INT,
97 EMACS_INT, EMACS_INT); 97 EMACS_INT, EMACS_INT);
98static EMACS_INT boyer_moore (EMACS_INT, unsigned char *, EMACS_INT, EMACS_INT, 98static EMACS_INT boyer_moore (EMACS_INT, unsigned char *, EMACS_INT,
99 Lisp_Object, Lisp_Object, 99 Lisp_Object, Lisp_Object, EMACS_INT,
100 EMACS_INT, EMACS_INT, 100 EMACS_INT, int);
101 EMACS_INT, EMACS_INT, int);
102static EMACS_INT search_buffer (Lisp_Object, EMACS_INT, EMACS_INT, 101static EMACS_INT search_buffer (Lisp_Object, EMACS_INT, EMACS_INT,
103 EMACS_INT, EMACS_INT, EMACS_INT, int, 102 EMACS_INT, EMACS_INT, EMACS_INT, int,
104 Lisp_Object, Lisp_Object, int); 103 Lisp_Object, Lisp_Object, int);
@@ -1416,15 +1415,14 @@ search_buffer (Lisp_Object string, EMACS_INT pos, EMACS_INT pos_byte,
1416 } 1415 }
1417 1416
1418 len_byte = pat - patbuf; 1417 len_byte = pat - patbuf;
1419 len = raw_pattern_size;
1420 pat = base_pat = patbuf; 1418 pat = base_pat = patbuf;
1421 1419
1422 if (boyer_moore_ok) 1420 if (boyer_moore_ok)
1423 return boyer_moore (n, pat, len, len_byte, trt, inverse_trt, 1421 return boyer_moore (n, pat, len_byte, trt, inverse_trt,
1424 pos, pos_byte, lim, lim_byte, 1422 pos_byte, lim_byte,
1425 char_base); 1423 char_base);
1426 else 1424 else
1427 return simple_search (n, pat, len, len_byte, trt, 1425 return simple_search (n, pat, raw_pattern_size, len_byte, trt,
1428 pos, pos_byte, lim, lim_byte); 1426 pos, pos_byte, lim, lim_byte);
1429 } 1427 }
1430} 1428}
@@ -1636,8 +1634,8 @@ simple_search (EMACS_INT n, unsigned char *pat,
1636} 1634}
1637 1635
1638/* Do Boyer-Moore search N times for the string BASE_PAT, 1636/* Do Boyer-Moore search N times for the string BASE_PAT,
1639 whose length is LEN/LEN_BYTE, 1637 whose length is LEN_BYTE,
1640 from buffer position POS/POS_BYTE until LIM/LIM_BYTE. 1638 from buffer position POS_BYTE until LIM_BYTE.
1641 DIRECTION says which direction we search in. 1639 DIRECTION says which direction we search in.
1642 TRT and INVERSE_TRT are translation tables. 1640 TRT and INVERSE_TRT are translation tables.
1643 Characters in PAT are already translated by TRT. 1641 Characters in PAT are already translated by TRT.
@@ -1652,10 +1650,10 @@ simple_search (EMACS_INT n, unsigned char *pat,
1652 1650
1653static EMACS_INT 1651static EMACS_INT
1654boyer_moore (EMACS_INT n, unsigned char *base_pat, 1652boyer_moore (EMACS_INT n, unsigned char *base_pat,
1655 EMACS_INT len, EMACS_INT len_byte, 1653 EMACS_INT len_byte,
1656 Lisp_Object trt, Lisp_Object inverse_trt, 1654 Lisp_Object trt, Lisp_Object inverse_trt,
1657 EMACS_INT pos, EMACS_INT pos_byte, 1655 EMACS_INT pos_byte, EMACS_INT lim_byte,
1658 EMACS_INT lim, EMACS_INT lim_byte, int char_base) 1656 int char_base)
1659{ 1657{
1660 int direction = ((n > 0) ? 1 : -1); 1658 int direction = ((n > 0) ? 1 : -1);
1661 register EMACS_INT dirlen; 1659 register EMACS_INT dirlen;
@@ -1776,8 +1774,8 @@ boyer_moore (EMACS_INT n, unsigned char *base_pat,
1776 stride_for_teases = BM_tab[j]; 1774 stride_for_teases = BM_tab[j];
1777 1775
1778 BM_tab[j] = dirlen - i; 1776 BM_tab[j] = dirlen - i;
1779 /* A translation table is accompanied by its inverse -- see */ 1777 /* A translation table is accompanied by its inverse -- see
1780 /* comment following downcase_table for details */ 1778 comment following downcase_table for details. */
1781 if (ch >= 0) 1779 if (ch >= 0)
1782 { 1780 {
1783 int starting_ch = ch; 1781 int starting_ch = ch;
@@ -2636,11 +2634,8 @@ since only regular expressions have distinguished subexpressions. */)
2636 EMACS_INT substed_alloc_size, substed_len; 2634 EMACS_INT substed_alloc_size, substed_len;
2637 int buf_multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters)); 2635 int buf_multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters));
2638 int str_multibyte = STRING_MULTIBYTE (newtext); 2636 int str_multibyte = STRING_MULTIBYTE (newtext);
2639 Lisp_Object rev_tbl;
2640 int really_changed = 0; 2637 int really_changed = 0;
2641 2638
2642 rev_tbl = Qnil;
2643
2644 substed_alloc_size = length * 2 + 100; 2639 substed_alloc_size = length * 2 + 100;
2645 substed = (unsigned char *) xmalloc (substed_alloc_size + 1); 2640 substed = (unsigned char *) xmalloc (substed_alloc_size + 1);
2646 substed_len = 0; 2641 substed_len = 0;
@@ -2660,7 +2655,7 @@ since only regular expressions have distinguished subexpressions. */)
2660 { 2655 {
2661 FETCH_STRING_CHAR_ADVANCE_NO_CHECK (c, newtext, pos, pos_byte); 2656 FETCH_STRING_CHAR_ADVANCE_NO_CHECK (c, newtext, pos, pos_byte);
2662 if (!buf_multibyte) 2657 if (!buf_multibyte)
2663 c = multibyte_char_to_unibyte (c, rev_tbl); 2658 c = multibyte_char_to_unibyte (c);
2664 } 2659 }
2665 else 2660 else
2666 { 2661 {
@@ -2683,7 +2678,7 @@ since only regular expressions have distinguished subexpressions. */)
2683 FETCH_STRING_CHAR_ADVANCE_NO_CHECK (c, newtext, 2678 FETCH_STRING_CHAR_ADVANCE_NO_CHECK (c, newtext,
2684 pos, pos_byte); 2679 pos, pos_byte);
2685 if (!buf_multibyte && !ASCII_CHAR_P (c)) 2680 if (!buf_multibyte && !ASCII_CHAR_P (c))
2686 c = multibyte_char_to_unibyte (c, rev_tbl); 2681 c = multibyte_char_to_unibyte (c);
2687 } 2682 }
2688 else 2683 else
2689 { 2684 {
diff --git a/src/sound.c b/src/sound.c
index 3a1668e4903..a2fe7ccc8ce 100644
--- a/src/sound.c
+++ b/src/sound.c
@@ -595,12 +595,12 @@ wav_play (struct sound *s, struct sound_device *sd)
595 files I found so far. If someone feels inclined to implement the 595 files I found so far. If someone feels inclined to implement the
596 whole RIFF-WAVE spec, please do. */ 596 whole RIFF-WAVE spec, please do. */
597 if (STRINGP (s->data)) 597 if (STRINGP (s->data))
598 sd->write (sd, SDATA (s->data) + sizeof *header, 598 sd->write (sd, SSDATA (s->data) + sizeof *header,
599 SBYTES (s->data) - sizeof *header); 599 SBYTES (s->data) - sizeof *header);
600 else 600 else
601 { 601 {
602 char *buffer; 602 char *buffer;
603 int nbytes; 603 int nbytes = 0;
604 int blksize = sd->period_size ? sd->period_size (sd) : 2048; 604 int blksize = sd->period_size ? sd->period_size (sd) : 2048;
605 int data_left = header->data_length; 605 int data_left = header->data_length;
606 606
@@ -686,7 +686,7 @@ au_play (struct sound *s, struct sound_device *sd)
686 sd->configure (sd); 686 sd->configure (sd);
687 687
688 if (STRINGP (s->data)) 688 if (STRINGP (s->data))
689 sd->write (sd, SDATA (s->data) + header->data_offset, 689 sd->write (sd, SSDATA (s->data) + header->data_offset,
690 SBYTES (s->data) - header->data_offset); 690 SBYTES (s->data) - header->data_offset);
691 else 691 else
692 { 692 {
@@ -1104,7 +1104,6 @@ alsa_close (struct sound_device *sd)
1104static void 1104static void
1105alsa_choose_format (struct sound_device *sd, struct sound *s) 1105alsa_choose_format (struct sound_device *sd, struct sound *s)
1106{ 1106{
1107 struct alsa_params *p = (struct alsa_params *) sd->data;
1108 if (s->type == RIFF) 1107 if (s->type == RIFF)
1109 { 1108 {
1110 struct wav_header *h = (struct wav_header *) s->header; 1109 struct wav_header *h = (struct wav_header *) s->header;
@@ -1410,7 +1409,7 @@ Internal use only, use `play-sound' instead. */)
1410 { 1409 {
1411 int len = SCHARS (attrs[SOUND_DEVICE]); 1410 int len = SCHARS (attrs[SOUND_DEVICE]);
1412 current_sound_device->file = (char *) alloca (len + 1); 1411 current_sound_device->file = (char *) alloca (len + 1);
1413 strcpy (current_sound_device->file, SDATA (attrs[SOUND_DEVICE])); 1412 strcpy (current_sound_device->file, SSDATA (attrs[SOUND_DEVICE]));
1414 } 1413 }
1415 1414
1416 if (INTEGERP (attrs[SOUND_VOLUME])) 1415 if (INTEGERP (attrs[SOUND_VOLUME]))
@@ -1498,4 +1497,3 @@ init_sound (void)
1498} 1497}
1499 1498
1500#endif /* HAVE_SOUND */ 1499#endif /* HAVE_SOUND */
1501
diff --git a/src/syntax.c b/src/syntax.c
index c1442c396c1..0a1525b54ea 100644
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -3265,9 +3265,9 @@ do { prev_from = from; \
3265 = (curlevel == levelstart) ? -1 : (curlevel - 1)->last; 3265 = (curlevel == levelstart) ? -1 : (curlevel - 1)->last;
3266 state.location = from; 3266 state.location = from;
3267 state.levelstarts = Qnil; 3267 state.levelstarts = Qnil;
3268 while (--curlevel >= levelstart) 3268 while (curlevel > levelstart)
3269 state.levelstarts = Fcons (make_number (curlevel->last), 3269 state.levelstarts = Fcons (make_number ((--curlevel)->last),
3270 state.levelstarts); 3270 state.levelstarts);
3271 immediate_quit = 0; 3271 immediate_quit = 0;
3272 3272
3273 *stateptr = state; 3273 *stateptr = state;
diff --git a/src/sysdep.c b/src/sysdep.c
index 6ef3d88c5c8..1bb400421f0 100644
--- a/src/sysdep.c
+++ b/src/sysdep.c
@@ -449,7 +449,7 @@ child_setup_tty (int out)
449struct save_signal 449struct save_signal
450{ 450{
451 int code; 451 int code;
452 SIGTYPE (*handler) (int); 452 void (*handler) (int);
453}; 453};
454 454
455static void save_signal_handlers (struct save_signal *); 455static void save_signal_handlers (struct save_signal *);
@@ -488,7 +488,8 @@ sys_subshell (void)
488 int pid; 488 int pid;
489 struct save_signal saved_handlers[5]; 489 struct save_signal saved_handlers[5];
490 Lisp_Object dir; 490 Lisp_Object dir;
491 unsigned char * IF_LINT (volatile) str = 0; 491 unsigned char *volatile str_volatile = 0;
492 unsigned char *str;
492 int len; 493 int len;
493 494
494 saved_handlers[0].code = SIGINT; 495 saved_handlers[0].code = SIGINT;
@@ -512,7 +513,7 @@ sys_subshell (void)
512 goto xyzzy; 513 goto xyzzy;
513 514
514 dir = expand_and_dir_to_file (Funhandled_file_name_directory (dir), Qnil); 515 dir = expand_and_dir_to_file (Funhandled_file_name_directory (dir), Qnil);
515 str = (unsigned char *) alloca (SCHARS (dir) + 2); 516 str_volatile = str = (unsigned char *) alloca (SCHARS (dir) + 2);
516 len = SCHARS (dir); 517 len = SCHARS (dir);
517 memcpy (str, SDATA (dir), len); 518 memcpy (str, SDATA (dir), len);
518 if (str[len - 1] != '/') str[len++] = '/'; 519 if (str[len - 1] != '/') str[len++] = '/';
@@ -544,6 +545,7 @@ sys_subshell (void)
544 sh = "sh"; 545 sh = "sh";
545 546
546 /* Use our buffer's default directory for the subshell. */ 547 /* Use our buffer's default directory for the subshell. */
548 str = str_volatile;
547 if (str && chdir ((char *) str) != 0) 549 if (str && chdir ((char *) str) != 0)
548 { 550 {
549#ifndef DOS_NT 551#ifndef DOS_NT
@@ -606,7 +608,7 @@ save_signal_handlers (struct save_signal *saved_handlers)
606 while (saved_handlers->code) 608 while (saved_handlers->code)
607 { 609 {
608 saved_handlers->handler 610 saved_handlers->handler
609 = (SIGTYPE (*) (int)) signal (saved_handlers->code, SIG_IGN); 611 = (void (*) (int)) signal (saved_handlers->code, SIG_IGN);
610 saved_handlers++; 612 saved_handlers++;
611 } 613 }
612} 614}
diff --git a/src/syssignal.h b/src/syssignal.h
index 7b4070322d6..03768168e20 100644
--- a/src/syssignal.h
+++ b/src/syssignal.h
@@ -69,7 +69,7 @@ extern sigset_t sys_sigmask ();
69 69
70/* Whether this is what all systems want or not, this is what 70/* Whether this is what all systems want or not, this is what
71 appears to be assumed in the source, for example data.c:arith_error. */ 71 appears to be assumed in the source, for example data.c:arith_error. */
72typedef RETSIGTYPE (*signal_handler_t) (int); 72typedef void (*signal_handler_t) (int);
73 73
74signal_handler_t sys_signal (int signal_number, signal_handler_t action); 74signal_handler_t sys_signal (int signal_number, signal_handler_t action);
75sigset_t sys_sigblock (sigset_t new_mask); 75sigset_t sys_sigblock (sigset_t new_mask);
diff --git a/src/term.c b/src/term.c
index e84bbe125f8..fc7726298c5 100644
--- a/src/term.c
+++ b/src/term.c
@@ -1952,7 +1952,7 @@ produce_glyphless_glyph (struct it *it, int for_no_font, Lisp_Object acronym)
1952 1952
1953 it->pixel_width = len; 1953 it->pixel_width = len;
1954 it->nglyphs = len; 1954 it->nglyphs = len;
1955 if (len > 0 && it->glyph_row) 1955 if (it->glyph_row)
1956 append_glyphless_glyph (it, face_id, str); 1956 append_glyphless_glyph (it, face_id, str);
1957} 1957}
1958 1958
@@ -2500,13 +2500,10 @@ A suspended tty may be resumed by calling `resume-tty' on it. */)
2500 /* First run `suspend-tty-functions' and then clean up the tty 2500 /* First run `suspend-tty-functions' and then clean up the tty
2501 state because `suspend-tty-functions' might need to change 2501 state because `suspend-tty-functions' might need to change
2502 the tty state. */ 2502 the tty state. */
2503 if (!NILP (Vrun_hooks)) 2503 Lisp_Object args[2];
2504 { 2504 args[0] = intern ("suspend-tty-functions");
2505 Lisp_Object args[2]; 2505 XSETTERMINAL (args[1], t);
2506 args[0] = intern ("suspend-tty-functions"); 2506 Frun_hook_with_args (2, args);
2507 XSETTERMINAL (args[1], t);
2508 Frun_hook_with_args (2, args);
2509 }
2510 2507
2511 reset_sys_modes (t->display_info.tty); 2508 reset_sys_modes (t->display_info.tty);
2512 delete_keyboard_wait_descriptor (fileno (f)); 2509 delete_keyboard_wait_descriptor (fileno (f));
@@ -2596,14 +2593,13 @@ frame's terminal). */)
2596 2593
2597 init_sys_modes (t->display_info.tty); 2594 init_sys_modes (t->display_info.tty);
2598 2595
2599 /* Run `resume-tty-functions'. */ 2596 {
2600 if (!NILP (Vrun_hooks)) 2597 /* Run `resume-tty-functions'. */
2601 { 2598 Lisp_Object args[2];
2602 Lisp_Object args[2]; 2599 args[0] = intern ("resume-tty-functions");
2603 args[0] = intern ("resume-tty-functions"); 2600 XSETTERMINAL (args[1], t);
2604 XSETTERMINAL (args[1], t); 2601 Frun_hook_with_args (2, args);
2605 Frun_hook_with_args (2, args); 2602 }
2606 }
2607 } 2603 }
2608 2604
2609 set_tty_hooks (t); 2605 set_tty_hooks (t);
diff --git a/src/terminfo.c b/src/terminfo.c
index 905a8edacc7..c0418984efa 100644
--- a/src/terminfo.c
+++ b/src/terminfo.c
@@ -17,6 +17,8 @@ You should have received a copy of the GNU General Public License
17along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ 17along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
18 18
19#include <config.h> 19#include <config.h>
20#include "tparam.h"
21
20#include <setjmp.h> 22#include <setjmp.h>
21#include "lisp.h" 23#include "lisp.h"
22 24
@@ -33,18 +35,19 @@ char *UP, *BC, PC;
33 format is different too. 35 format is different too.
34*/ 36*/
35 37
38extern char *tparm (const char *str, ...);
39
40
36char * 41char *
37tparam (char *string, char *outstring, 42tparam (const char *string, char *outstring, int len,
38 int len, int arg1, int arg2, int arg3, int arg4, 43 int arg1, int arg2, int arg3, int arg4)
39 int arg5, int arg6, int arg7, int arg8, int arg9)
40{ 44{
41 char *temp; 45 char *temp;
42 extern char *tparm (char *str, ...);
43 46
44 temp = tparm (string, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9); 47 /* Emacs always should pass a null OUTSTRING and zero LEN. */
45 if (outstring == 0) 48 if (outstring || len)
46 outstring = ((char *) (xmalloc ((strlen (temp)) + 1))); 49 abort ();
47 strcpy (outstring, temp);
48 return outstring;
49}
50 50
51 temp = tparm (string, arg1, arg2, arg3, arg4);
52 return xstrdup (temp);
53}
diff --git a/src/textprop.c b/src/textprop.c
index 5db6033670b..cd89efeb38d 100644
--- a/src/textprop.c
+++ b/src/textprop.c
@@ -974,37 +974,6 @@ past position LIMIT; return LIMIT if nothing is found before LIMIT. */)
974 return make_number (next->position); 974 return make_number (next->position);
975} 975}
976 976
977/* Return 1 if there's a change in some property between BEG and END. */
978
979int
980property_change_between_p (EMACS_INT beg, EMACS_INT end)
981{
982 register INTERVAL i, next;
983 Lisp_Object object, pos;
984
985 XSETBUFFER (object, current_buffer);
986 XSETFASTINT (pos, beg);
987
988 i = validate_interval_range (object, &pos, &pos, soft);
989 if (NULL_INTERVAL_P (i))
990 return 0;
991
992 next = next_interval (i);
993 while (! NULL_INTERVAL_P (next) && intervals_equal (i, next))
994 {
995 next = next_interval (next);
996 if (NULL_INTERVAL_P (next))
997 return 0;
998 if (next->position >= end)
999 return 0;
1000 }
1001
1002 if (NULL_INTERVAL_P (next))
1003 return 0;
1004
1005 return 1;
1006}
1007
1008DEFUN ("next-single-property-change", Fnext_single_property_change, 977DEFUN ("next-single-property-change", Fnext_single_property_change,
1009 Snext_single_property_change, 2, 4, 0, 978 Snext_single_property_change, 2, 4, 0,
1010 doc: /* Return the position of next property change for a specific property. 979 doc: /* Return the position of next property change for a specific property.
@@ -2331,4 +2300,3 @@ inherits it if NONSTICKINESS is nil. The `front-sticky' and
2331/* defsubr (&Serase_text_properties); */ 2300/* defsubr (&Serase_text_properties); */
2332/* defsubr (&Scopy_text_properties); */ 2301/* defsubr (&Scopy_text_properties); */
2333} 2302}
2334
diff --git a/src/tparam.h b/src/tparam.h
index 3cd3e6053cc..dc4cdfaa28c 100644
--- a/src/tparam.h
+++ b/src/tparam.h
@@ -29,3 +29,7 @@ char *tgetstr (const char *, char **);
29char *tgoto (const char *, int, int); 29char *tgoto (const char *, int, int);
30 30
31char *tparam (const char *, char *, int, int, int, int, int); 31char *tparam (const char *, char *, int, int, int, int, int);
32
33extern char PC;
34extern char *BC;
35extern char *UP;
diff --git a/src/unexelf.c b/src/unexelf.c
index b58c78501b8..8b45894f853 100644
--- a/src/unexelf.c
+++ b/src/unexelf.c
@@ -651,7 +651,9 @@ unexec (const char *new_name, const char *old_name)
651 int n, nn; 651 int n, nn;
652 int old_bss_index, old_sbss_index, old_plt_index; 652 int old_bss_index, old_sbss_index, old_plt_index;
653 int old_data_index, new_data2_index; 653 int old_data_index, new_data2_index;
654#if defined _SYSTYPE_SYSV || defined __sgi
654 int old_mdebug_index; 655 int old_mdebug_index;
656#endif
655 struct stat stat_buf; 657 struct stat stat_buf;
656 int old_file_size; 658 int old_file_size;
657 659
@@ -695,8 +697,10 @@ unexec (const char *new_name, const char *old_name)
695 697
696 /* Find the mdebug section, if any. */ 698 /* Find the mdebug section, if any. */
697 699
700#if defined _SYSTYPE_SYSV || defined __sgi
698 old_mdebug_index = find_section (".mdebug", old_section_names, 701 old_mdebug_index = find_section (".mdebug", old_section_names,
699 old_name, old_file_h, old_section_h, 1); 702 old_name, old_file_h, old_section_h, 1);
703#endif
700 704
701 /* Find the old .bss section. Figure out parameters of the new 705 /* Find the old .bss section. Figure out parameters of the new
702 data2 and bss sections. */ 706 data2 and bss sections. */
diff --git a/src/unexw32.c b/src/unexw32.c
index cd8211d6bee..e03fa6c9b9a 100644
--- a/src/unexw32.c
+++ b/src/unexw32.c
@@ -341,7 +341,6 @@ get_section_info (file_data *p_infile)
341{ 341{
342 PIMAGE_DOS_HEADER dos_header; 342 PIMAGE_DOS_HEADER dos_header;
343 PIMAGE_NT_HEADERS nt_header; 343 PIMAGE_NT_HEADERS nt_header;
344 PIMAGE_SECTION_HEADER section;
345 int overlap; 344 int overlap;
346 345
347 dos_header = (PIMAGE_DOS_HEADER) p_infile->file_base; 346 dos_header = (PIMAGE_DOS_HEADER) p_infile->file_base;
diff --git a/src/w32.c b/src/w32.c
index 721cea07d20..da403671115 100644
--- a/src/w32.c
+++ b/src/w32.c
@@ -1505,6 +1505,7 @@ w32_get_resource (char *key, LPDWORD lpdwtype)
1505} 1505}
1506 1506
1507char *get_emacs_configuration (void); 1507char *get_emacs_configuration (void);
1508
1508void 1509void
1509init_environment (char ** argv) 1510init_environment (char ** argv)
1510{ 1511{
@@ -1591,25 +1592,25 @@ init_environment (char ** argv)
1591 If not, then we can try to default to the appdata directory under the 1592 If not, then we can try to default to the appdata directory under the
1592 user's profile, which is more likely to be writable. */ 1593 user's profile, which is more likely to be writable. */
1593 if (stat ("C:/.emacs", &ignored) < 0) 1594 if (stat ("C:/.emacs", &ignored) < 0)
1594 { 1595 {
1595 HRESULT profile_result; 1596 HRESULT profile_result;
1596 /* Dynamically load ShGetFolderPath, as it won't exist on versions 1597 /* Dynamically load ShGetFolderPath, as it won't exist on versions
1597 of Windows 95 and NT4 that have not been updated to include 1598 of Windows 95 and NT4 that have not been updated to include
1598 MSIE 5. */ 1599 MSIE 5. */
1599 ShGetFolderPath_fn get_folder_path; 1600 ShGetFolderPath_fn get_folder_path;
1600 get_folder_path = (ShGetFolderPath_fn) 1601 get_folder_path = (ShGetFolderPath_fn)
1601 GetProcAddress (GetModuleHandle ("shell32.dll"), "SHGetFolderPathA"); 1602 GetProcAddress (GetModuleHandle ("shell32.dll"), "SHGetFolderPathA");
1602 1603
1603 if (get_folder_path != NULL) 1604 if (get_folder_path != NULL)
1604 { 1605 {
1605 profile_result = get_folder_path (NULL, CSIDL_APPDATA, NULL, 1606 profile_result = get_folder_path (NULL, CSIDL_APPDATA, NULL,
1606 0, default_home); 1607 0, default_home);
1607 1608
1608 /* If we can't get the appdata dir, revert to old behavior. */ 1609 /* If we can't get the appdata dir, revert to old behavior. */
1609 if (profile_result == S_OK) 1610 if (profile_result == S_OK)
1610 env_vars[0].def_value = default_home; 1611 env_vars[0].def_value = default_home;
1611 } 1612 }
1612 } 1613 }
1613 1614
1614 /* Get default locale info and use it for LANG. */ 1615 /* Get default locale info and use it for LANG. */
1615 if (GetLocaleInfo (LOCALE_USER_DEFAULT, 1616 if (GetLocaleInfo (LOCALE_USER_DEFAULT,
@@ -2082,42 +2083,42 @@ GetCachedVolumeInformation (char * root_dir)
2082 info = lookup_volume_info (root_dir); 2083 info = lookup_volume_info (root_dir);
2083 2084
2084 if (info == NULL || ! VOLINFO_STILL_VALID (root_dir, info)) 2085 if (info == NULL || ! VOLINFO_STILL_VALID (root_dir, info))
2085 { 2086 {
2086 char name[ 256 ]; 2087 char name[ 256 ];
2087 DWORD serialnum; 2088 DWORD serialnum;
2088 DWORD maxcomp; 2089 DWORD maxcomp;
2089 DWORD flags; 2090 DWORD flags;
2090 char type[ 256 ]; 2091 char type[ 256 ];
2091 2092
2092 /* Info is not cached, or is stale. */ 2093 /* Info is not cached, or is stale. */
2093 if (!GetVolumeInformation (root_dir, 2094 if (!GetVolumeInformation (root_dir,
2094 name, sizeof (name), 2095 name, sizeof (name),
2095 &serialnum, 2096 &serialnum,
2096 &maxcomp, 2097 &maxcomp,
2097 &flags, 2098 &flags,
2098 type, sizeof (type))) 2099 type, sizeof (type)))
2099 return NULL; 2100 return NULL;
2100 2101
2101 /* Cache the volume information for future use, overwriting existing 2102 /* Cache the volume information for future use, overwriting existing
2102 entry if present. */ 2103 entry if present. */
2103 if (info == NULL) 2104 if (info == NULL)
2104 { 2105 {
2105 info = (volume_info_data *) xmalloc (sizeof (volume_info_data)); 2106 info = (volume_info_data *) xmalloc (sizeof (volume_info_data));
2106 add_volume_info (root_dir, info); 2107 add_volume_info (root_dir, info);
2107 } 2108 }
2108 else 2109 else
2109 { 2110 {
2110 xfree (info->name); 2111 xfree (info->name);
2111 xfree (info->type); 2112 xfree (info->type);
2112 } 2113 }
2113 2114
2114 info->name = xstrdup (name); 2115 info->name = xstrdup (name);
2115 info->serialnum = serialnum; 2116 info->serialnum = serialnum;
2116 info->maxcomp = maxcomp; 2117 info->maxcomp = maxcomp;
2117 info->flags = flags; 2118 info->flags = flags;
2118 info->type = xstrdup (type); 2119 info->type = xstrdup (type);
2119 info->timestamp = GetTickCount (); 2120 info->timestamp = GetTickCount ();
2120 } 2121 }
2121 2122
2122 return info; 2123 return info;
2123} 2124}
@@ -2376,8 +2377,8 @@ readdir (DIR *dirp)
2376 if (wnet_enum_handle != INVALID_HANDLE_VALUE) 2377 if (wnet_enum_handle != INVALID_HANDLE_VALUE)
2377 { 2378 {
2378 if (!read_unc_volume (wnet_enum_handle, 2379 if (!read_unc_volume (wnet_enum_handle,
2379 dir_find_data.cFileName, 2380 dir_find_data.cFileName,
2380 MAX_PATH)) 2381 MAX_PATH))
2381 return NULL; 2382 return NULL;
2382 } 2383 }
2383 /* If we aren't dir_finding, do a find-first, otherwise do a find-next. */ 2384 /* If we aren't dir_finding, do a find-first, otherwise do a find-next. */
@@ -2487,7 +2488,7 @@ read_unc_volume (HANDLE henum, char *readbuf, int size)
2487 2488
2488 count = 1; 2489 count = 1;
2489 buffer = alloca (bufsize); 2490 buffer = alloca (bufsize);
2490 result = WNetEnumResource (wnet_enum_handle, &count, buffer, &bufsize); 2491 result = WNetEnumResource (henum, &count, buffer, &bufsize);
2491 if (result != NO_ERROR) 2492 if (result != NO_ERROR)
2492 return NULL; 2493 return NULL;
2493 2494
@@ -3250,8 +3251,6 @@ int
3250stat (const char * path, struct stat * buf) 3251stat (const char * path, struct stat * buf)
3251{ 3252{
3252 char *name, *r; 3253 char *name, *r;
3253 char drive_root[4];
3254 UINT devtype;
3255 WIN32_FIND_DATA wfd; 3254 WIN32_FIND_DATA wfd;
3256 HANDLE fh; 3255 HANDLE fh;
3257 unsigned __int64 fake_inode; 3256 unsigned __int64 fake_inode;
@@ -4043,7 +4042,6 @@ system_process_attributes (Lisp_Object pid)
4043 TOKEN_PRIMARY_GROUP group_token; 4042 TOKEN_PRIMARY_GROUP group_token;
4044 unsigned euid; 4043 unsigned euid;
4045 unsigned egid; 4044 unsigned egid;
4046 DWORD sess;
4047 PROCESS_MEMORY_COUNTERS mem; 4045 PROCESS_MEMORY_COUNTERS mem;
4048 PROCESS_MEMORY_COUNTERS_EX mem_ex; 4046 PROCESS_MEMORY_COUNTERS_EX mem_ex;
4049 DWORD minrss, maxrss; 4047 DWORD minrss, maxrss;
@@ -4520,75 +4518,75 @@ struct {
4520 int errnum; 4518 int errnum;
4521 char * msg; 4519 char * msg;
4522} _wsa_errlist[] = { 4520} _wsa_errlist[] = {
4523 WSAEINTR , "Interrupted function call", 4521 {WSAEINTR , "Interrupted function call"},
4524 WSAEBADF , "Bad file descriptor", 4522 {WSAEBADF , "Bad file descriptor"},
4525 WSAEACCES , "Permission denied", 4523 {WSAEACCES , "Permission denied"},
4526 WSAEFAULT , "Bad address", 4524 {WSAEFAULT , "Bad address"},
4527 WSAEINVAL , "Invalid argument", 4525 {WSAEINVAL , "Invalid argument"},
4528 WSAEMFILE , "Too many open files", 4526 {WSAEMFILE , "Too many open files"},
4529 4527
4530 WSAEWOULDBLOCK , "Resource temporarily unavailable", 4528 {WSAEWOULDBLOCK , "Resource temporarily unavailable"},
4531 WSAEINPROGRESS , "Operation now in progress", 4529 {WSAEINPROGRESS , "Operation now in progress"},
4532 WSAEALREADY , "Operation already in progress", 4530 {WSAEALREADY , "Operation already in progress"},
4533 WSAENOTSOCK , "Socket operation on non-socket", 4531 {WSAENOTSOCK , "Socket operation on non-socket"},
4534 WSAEDESTADDRREQ , "Destination address required", 4532 {WSAEDESTADDRREQ , "Destination address required"},
4535 WSAEMSGSIZE , "Message too long", 4533 {WSAEMSGSIZE , "Message too long"},
4536 WSAEPROTOTYPE , "Protocol wrong type for socket", 4534 {WSAEPROTOTYPE , "Protocol wrong type for socket"},
4537 WSAENOPROTOOPT , "Bad protocol option", 4535 {WSAENOPROTOOPT , "Bad protocol option"},
4538 WSAEPROTONOSUPPORT , "Protocol not supported", 4536 {WSAEPROTONOSUPPORT , "Protocol not supported"},
4539 WSAESOCKTNOSUPPORT , "Socket type not supported", 4537 {WSAESOCKTNOSUPPORT , "Socket type not supported"},
4540 WSAEOPNOTSUPP , "Operation not supported", 4538 {WSAEOPNOTSUPP , "Operation not supported"},
4541 WSAEPFNOSUPPORT , "Protocol family not supported", 4539 {WSAEPFNOSUPPORT , "Protocol family not supported"},
4542 WSAEAFNOSUPPORT , "Address family not supported by protocol family", 4540 {WSAEAFNOSUPPORT , "Address family not supported by protocol family"},
4543 WSAEADDRINUSE , "Address already in use", 4541 {WSAEADDRINUSE , "Address already in use"},
4544 WSAEADDRNOTAVAIL , "Cannot assign requested address", 4542 {WSAEADDRNOTAVAIL , "Cannot assign requested address"},
4545 WSAENETDOWN , "Network is down", 4543 {WSAENETDOWN , "Network is down"},
4546 WSAENETUNREACH , "Network is unreachable", 4544 {WSAENETUNREACH , "Network is unreachable"},
4547 WSAENETRESET , "Network dropped connection on reset", 4545 {WSAENETRESET , "Network dropped connection on reset"},
4548 WSAECONNABORTED , "Software caused connection abort", 4546 {WSAECONNABORTED , "Software caused connection abort"},
4549 WSAECONNRESET , "Connection reset by peer", 4547 {WSAECONNRESET , "Connection reset by peer"},
4550 WSAENOBUFS , "No buffer space available", 4548 {WSAENOBUFS , "No buffer space available"},
4551 WSAEISCONN , "Socket is already connected", 4549 {WSAEISCONN , "Socket is already connected"},
4552 WSAENOTCONN , "Socket is not connected", 4550 {WSAENOTCONN , "Socket is not connected"},
4553 WSAESHUTDOWN , "Cannot send after socket shutdown", 4551 {WSAESHUTDOWN , "Cannot send after socket shutdown"},
4554 WSAETOOMANYREFS , "Too many references", /* not sure */ 4552 {WSAETOOMANYREFS , "Too many references"}, /* not sure */
4555 WSAETIMEDOUT , "Connection timed out", 4553 {WSAETIMEDOUT , "Connection timed out"},
4556 WSAECONNREFUSED , "Connection refused", 4554 {WSAECONNREFUSED , "Connection refused"},
4557 WSAELOOP , "Network loop", /* not sure */ 4555 {WSAELOOP , "Network loop"}, /* not sure */
4558 WSAENAMETOOLONG , "Name is too long", 4556 {WSAENAMETOOLONG , "Name is too long"},
4559 WSAEHOSTDOWN , "Host is down", 4557 {WSAEHOSTDOWN , "Host is down"},
4560 WSAEHOSTUNREACH , "No route to host", 4558 {WSAEHOSTUNREACH , "No route to host"},
4561 WSAENOTEMPTY , "Buffer not empty", /* not sure */ 4559 {WSAENOTEMPTY , "Buffer not empty"}, /* not sure */
4562 WSAEPROCLIM , "Too many processes", 4560 {WSAEPROCLIM , "Too many processes"},
4563 WSAEUSERS , "Too many users", /* not sure */ 4561 {WSAEUSERS , "Too many users"}, /* not sure */
4564 WSAEDQUOT , "Double quote in host name", /* really not sure */ 4562 {WSAEDQUOT , "Double quote in host name"}, /* really not sure */
4565 WSAESTALE , "Data is stale", /* not sure */ 4563 {WSAESTALE , "Data is stale"}, /* not sure */
4566 WSAEREMOTE , "Remote error", /* not sure */ 4564 {WSAEREMOTE , "Remote error"}, /* not sure */
4567 4565
4568 WSASYSNOTREADY , "Network subsystem is unavailable", 4566 {WSASYSNOTREADY , "Network subsystem is unavailable"},
4569 WSAVERNOTSUPPORTED , "WINSOCK.DLL version out of range", 4567 {WSAVERNOTSUPPORTED , "WINSOCK.DLL version out of range"},
4570 WSANOTINITIALISED , "Winsock not initialized successfully", 4568 {WSANOTINITIALISED , "Winsock not initialized successfully"},
4571 WSAEDISCON , "Graceful shutdown in progress", 4569 {WSAEDISCON , "Graceful shutdown in progress"},
4572#ifdef WSAENOMORE 4570#ifdef WSAENOMORE
4573 WSAENOMORE , "No more operations allowed", /* not sure */ 4571 {WSAENOMORE , "No more operations allowed"}, /* not sure */
4574 WSAECANCELLED , "Operation cancelled", /* not sure */ 4572 {WSAECANCELLED , "Operation cancelled"}, /* not sure */
4575 WSAEINVALIDPROCTABLE , "Invalid procedure table from service provider", 4573 {WSAEINVALIDPROCTABLE , "Invalid procedure table from service provider"},
4576 WSAEINVALIDPROVIDER , "Invalid service provider version number", 4574 {WSAEINVALIDPROVIDER , "Invalid service provider version number"},
4577 WSAEPROVIDERFAILEDINIT , "Unable to initialize a service provider", 4575 {WSAEPROVIDERFAILEDINIT , "Unable to initialize a service provider"},
4578 WSASYSCALLFAILURE , "System call failure", 4576 {WSASYSCALLFAILURE , "System call failure"},
4579 WSASERVICE_NOT_FOUND , "Service not found", /* not sure */ 4577 {WSASERVICE_NOT_FOUND , "Service not found"}, /* not sure */
4580 WSATYPE_NOT_FOUND , "Class type not found", 4578 {WSATYPE_NOT_FOUND , "Class type not found"},
4581 WSA_E_NO_MORE , "No more resources available", /* really not sure */ 4579 {WSA_E_NO_MORE , "No more resources available"}, /* really not sure */
4582 WSA_E_CANCELLED , "Operation already cancelled", /* really not sure */ 4580 {WSA_E_CANCELLED , "Operation already cancelled"}, /* really not sure */
4583 WSAEREFUSED , "Operation refused", /* not sure */ 4581 {WSAEREFUSED , "Operation refused"}, /* not sure */
4584#endif 4582#endif
4585 4583
4586 WSAHOST_NOT_FOUND , "Host not found", 4584 {WSAHOST_NOT_FOUND , "Host not found"},
4587 WSATRY_AGAIN , "Authoritative host not found during name lookup", 4585 {WSATRY_AGAIN , "Authoritative host not found during name lookup"},
4588 WSANO_RECOVERY , "Non-recoverable error during name lookup", 4586 {WSANO_RECOVERY , "Non-recoverable error during name lookup"},
4589 WSANO_DATA , "Valid name, no data record of requested type", 4587 {WSANO_DATA , "Valid name, no data record of requested type"},
4590 4588
4591 -1, NULL 4589 {-1, NULL}
4592}; 4590};
4593 4591
4594char * 4592char *
@@ -5408,7 +5406,6 @@ sys_read (int fd, char * buffer, unsigned int count)
5408 { 5406 {
5409 HANDLE hnd = fd_info[fd].hnd; 5407 HANDLE hnd = fd_info[fd].hnd;
5410 OVERLAPPED *ovl = &fd_info[fd].cp->ovl_read; 5408 OVERLAPPED *ovl = &fd_info[fd].cp->ovl_read;
5411 DWORD err = 0;
5412 int rc = 0; 5409 int rc = 0;
5413 COMMTIMEOUTS ct; 5410 COMMTIMEOUTS ct;
5414 5411
diff --git a/src/w32fns.c b/src/w32fns.c
index 0c899cdceff..821cc671646 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -183,7 +183,7 @@ unsigned int msh_mousewheel = 0;
183#define MENU_FREE_DELAY 1000 183#define MENU_FREE_DELAY 1000
184static unsigned menu_free_timer = 0; 184static unsigned menu_free_timer = 0;
185 185
186#ifdef GLYPH_DEBUG 186#if GLYPH_DEBUG
187int image_cache_refcount, dpyinfo_refcount; 187int image_cache_refcount, dpyinfo_refcount;
188#endif 188#endif
189 189
@@ -1527,7 +1527,6 @@ void
1527x_set_menu_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval) 1527x_set_menu_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval)
1528{ 1528{
1529 int nlines; 1529 int nlines;
1530 int olines = FRAME_MENU_BAR_LINES (f);
1531 1530
1532 /* Right now, menu bars don't work properly in minibuf-only frames; 1531 /* Right now, menu bars don't work properly in minibuf-only frames;
1533 most of the commands try to apply themselves to the minibuffer 1532 most of the commands try to apply themselves to the minibuffer
@@ -2863,7 +2862,6 @@ w32_wnd_proc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
2863 base character (ie. translating the base key plus 2862 base character (ie. translating the base key plus
2864 shift modifier). */ 2863 shift modifier). */
2865 int add; 2864 int add;
2866 int isdead = 0;
2867 KEY_EVENT_RECORD key; 2865 KEY_EVENT_RECORD key;
2868 2866
2869 key.bKeyDown = TRUE; 2867 key.bKeyDown = TRUE;
@@ -2951,7 +2949,7 @@ w32_wnd_proc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
2951 HIMC context = get_ime_context_fn (hwnd); 2949 HIMC context = get_ime_context_fn (hwnd);
2952 wmsg.dwModifiers = w32_get_key_modifiers (wParam, lParam); 2950 wmsg.dwModifiers = w32_get_key_modifiers (wParam, lParam);
2953 /* Get buffer size. */ 2951 /* Get buffer size. */
2954 size = get_composition_string_fn (context, GCS_RESULTSTR, buffer, 0); 2952 size = get_composition_string_fn (context, GCS_RESULTSTR, NULL, 0);
2955 buffer = alloca (size); 2953 buffer = alloca (size);
2956 size = get_composition_string_fn (context, GCS_RESULTSTR, 2954 size = get_composition_string_fn (context, GCS_RESULTSTR,
2957 buffer, size); 2955 buffer, size);
@@ -3981,7 +3979,7 @@ unwind_create_frame (Lisp_Object frame)
3981 /* If frame is ``official'', nothing to do. */ 3979 /* If frame is ``official'', nothing to do. */
3982 if (!CONSP (Vframe_list) || !EQ (XCAR (Vframe_list), frame)) 3980 if (!CONSP (Vframe_list) || !EQ (XCAR (Vframe_list), frame))
3983 { 3981 {
3984#ifdef GLYPH_DEBUG 3982#if GLYPH_DEBUG
3985 struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f); 3983 struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f);
3986#endif 3984#endif
3987 3985
@@ -4522,8 +4520,6 @@ DISPLAY should be either a frame or a display name (a string).
4522If omitted or nil, that stands for the selected frame's display. */) 4520If omitted or nil, that stands for the selected frame's display. */)
4523 (Lisp_Object display) 4521 (Lisp_Object display)
4524{ 4522{
4525 struct w32_display_info *dpyinfo = check_x_display_info (display);
4526
4527 return make_number (1); 4523 return make_number (1);
4528} 4524}
4529 4525
@@ -4820,7 +4816,6 @@ If DISPLAY is nil, that stands for the selected frame's display. */)
4820 (Lisp_Object display) 4816 (Lisp_Object display)
4821{ 4817{
4822 struct w32_display_info *dpyinfo = check_x_display_info (display); 4818 struct w32_display_info *dpyinfo = check_x_display_info (display);
4823 int i;
4824 4819
4825 if (dpyinfo->reference_count > 0) 4820 if (dpyinfo->reference_count > 0)
4826 error ("Display still has frames on it"); 4821 error ("Display still has frames on it");
@@ -5173,7 +5168,7 @@ x_create_tip_frame (struct w32_display_info *dpyinfo,
5173 Lisp_Object parms, Lisp_Object text) 5168 Lisp_Object parms, Lisp_Object text)
5174{ 5169{
5175 struct frame *f; 5170 struct frame *f;
5176 Lisp_Object frame, tem; 5171 Lisp_Object frame;
5177 Lisp_Object name; 5172 Lisp_Object name;
5178 long window_prompting = 0; 5173 long window_prompting = 0;
5179 int width, height; 5174 int width, height;
diff --git a/src/w32font.c b/src/w32font.c
index 40ff0782b88..d86107bc6d5 100644
--- a/src/w32font.c
+++ b/src/w32font.c
@@ -533,6 +533,7 @@ w32font_draw (struct glyph_string *s, int from, int to,
533{ 533{
534 UINT options; 534 UINT options;
535 HRGN orig_clip = NULL; 535 HRGN orig_clip = NULL;
536 int len = to - from;
536 struct w32font_info *w32font = (struct w32font_info *) s->font; 537 struct w32font_info *w32font = (struct w32font_info *) s->font;
537 538
538 options = w32font->glyph_idx; 539 options = w32font->glyph_idx;
@@ -581,14 +582,14 @@ w32font_draw (struct glyph_string *s, int from, int to,
581 582
582 if (s->padding_p) 583 if (s->padding_p)
583 { 584 {
584 int len = to - from, i; 585 int i;
585 586
586 for (i = 0; i < len; i++) 587 for (i = 0; i < len; i++)
587 ExtTextOutW (s->hdc, x + i, y, options, NULL, 588 ExtTextOutW (s->hdc, x + i, y, options, NULL,
588 s->char2b + from + i, 1, NULL); 589 s->char2b + from + i, 1, NULL);
589 } 590 }
590 else 591 else
591 ExtTextOutW (s->hdc, x, y, options, NULL, s->char2b + from, to - from, NULL); 592 ExtTextOutW (s->hdc, x, y, options, NULL, s->char2b + from, len, NULL);
592 593
593 /* Restore clip region. */ 594 /* Restore clip region. */
594 if (s->num_clips > 0) 595 if (s->num_clips > 0)
@@ -596,6 +597,8 @@ w32font_draw (struct glyph_string *s, int from, int to,
596 597
597 if (orig_clip) 598 if (orig_clip)
598 DeleteObject (orig_clip); 599 DeleteObject (orig_clip);
600
601 return len;
599} 602}
600 603
601/* w32 implementation of free_entity for font backend. 604/* w32 implementation of free_entity for font backend.
@@ -774,7 +777,7 @@ int
774w32font_open_internal (FRAME_PTR f, Lisp_Object font_entity, 777w32font_open_internal (FRAME_PTR f, Lisp_Object font_entity,
775 int pixel_size, Lisp_Object font_object) 778 int pixel_size, Lisp_Object font_object)
776{ 779{
777 int len, size, i; 780 int len, size;
778 LOGFONT logfont; 781 LOGFONT logfont;
779 HDC dc; 782 HDC dc;
780 HFONT hfont, old_font; 783 HFONT hfont, old_font;
@@ -2418,6 +2421,7 @@ struct font_driver w32font_driver =
2418 NULL, /* check */ 2421 NULL, /* check */
2419 NULL, /* get_variation_glyphs */ 2422 NULL, /* get_variation_glyphs */
2420 w32font_filter_properties, 2423 w32font_filter_properties,
2424 NULL, /* cached_font_ok */
2421 }; 2425 };
2422 2426
2423 2427
diff --git a/src/w32inevt.c b/src/w32inevt.c
index c4858dea908..465f5ccb70f 100644
--- a/src/w32inevt.c
+++ b/src/w32inevt.c
@@ -677,7 +677,6 @@ w32_console_read_socket (struct terminal *terminal,
677 int expected, 677 int expected,
678 struct input_event *hold_quit) 678 struct input_event *hold_quit)
679{ 679{
680 BOOL no_events = TRUE;
681 int nev, ret = 0, add; 680 int nev, ret = 0, add;
682 int isdead; 681 int isdead;
683 682
diff --git a/src/w32menu.c b/src/w32menu.c
index a2e62f24f6a..f092ff87bf2 100644
--- a/src/w32menu.c
+++ b/src/w32menu.c
@@ -1320,7 +1320,6 @@ utf8to16 (unsigned char * src, int len, WCHAR * dest)
1320{ 1320{
1321 while (len > 0) 1321 while (len > 0)
1322 { 1322 {
1323 int utf16;
1324 if (*src < 0x80) 1323 if (*src < 0x80)
1325 { 1324 {
1326 *dest = (WCHAR) *src; 1325 *dest = (WCHAR) *src;
@@ -1546,8 +1545,6 @@ add_menu_item (HMENU menu, widget_value *wv, HMENU item)
1546static int 1545static int
1547fill_in_menu (HMENU menu, widget_value *wv) 1546fill_in_menu (HMENU menu, widget_value *wv)
1548{ 1547{
1549 int items_added = 0;
1550
1551 for ( ; wv != NULL; wv = wv->next) 1548 for ( ; wv != NULL; wv = wv->next)
1552 { 1549 {
1553 if (wv->contents) 1550 if (wv->contents)
@@ -1619,7 +1616,7 @@ w32_menu_display_help (HWND owner, HMENU menu, UINT item, UINT flags)
1619 else 1616 else
1620 /* X version has a loop through frames here, which doesn't 1617 /* X version has a loop through frames here, which doesn't
1621 appear to do anything, unless it has some side effect. */ 1618 appear to do anything, unless it has some side effect. */
1622 show_help_echo (help, Qnil, Qnil, Qnil, 1); 1619 show_help_echo (help, Qnil, Qnil, Qnil);
1623 } 1620 }
1624} 1621}
1625 1622
diff --git a/src/w32term.c b/src/w32term.c
index f31c4e90e77..f6a6ba3e82f 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -160,7 +160,6 @@ int last_scroll_bar_drag_pos;
160/* Where the mouse was last time we reported a mouse event. */ 160/* Where the mouse was last time we reported a mouse event. */
161static RECT last_mouse_glyph; 161static RECT last_mouse_glyph;
162static FRAME_PTR last_mouse_glyph_frame; 162static FRAME_PTR last_mouse_glyph_frame;
163static Lisp_Object last_mouse_press_frame;
164 163
165/* The scroll bar in which the last motion event occurred. 164/* The scroll bar in which the last motion event occurred.
166 165
@@ -1069,16 +1068,12 @@ x_set_glyph_string_clipping (struct glyph_string *s)
1069 w32_set_clip_rectangle (s->hdc, r); 1068 w32_set_clip_rectangle (s->hdc, r);
1070 else if (n > 1) 1069 else if (n > 1)
1071 { 1070 {
1072 HRGN full_clip, clip1, clip2; 1071 HRGN clip1 = CreateRectRgnIndirect (r);
1073 clip1 = CreateRectRgnIndirect (r); 1072 HRGN clip2 = CreateRectRgnIndirect (r + 1);
1074 clip2 = CreateRectRgnIndirect (r + 1); 1073 if (CombineRgn (clip1, clip1, clip2, RGN_OR) != ERROR)
1075 if (CombineRgn (full_clip, clip1, clip2, RGN_OR) != ERROR) 1074 SelectClipRgn (s->hdc, clip1);
1076 {
1077 SelectClipRgn (s->hdc, full_clip);
1078 }
1079 DeleteObject (clip1); 1075 DeleteObject (clip1);
1080 DeleteObject (clip2); 1076 DeleteObject (clip2);
1081 DeleteObject (full_clip);
1082 } 1077 }
1083 s->num_clips = n; 1078 s->num_clips = n;
1084} 1079}
@@ -1294,7 +1289,6 @@ x_draw_composite_glyph_string_foreground (struct glyph_string *s)
1294 else if (! s->first_glyph->u.cmp.automatic) 1289 else if (! s->first_glyph->u.cmp.automatic)
1295 { 1290 {
1296 int y = s->ybase; 1291 int y = s->ybase;
1297 int width = 0;
1298 HFONT old_font; 1292 HFONT old_font;
1299 1293
1300 old_font = SelectObject (s->hdc, FONT_HANDLE (font)); 1294 old_font = SelectObject (s->hdc, FONT_HANDLE (font));
@@ -4842,7 +4836,6 @@ w32_read_socket (struct terminal *terminal, int expected,
4842static void 4836static void
4843w32_clip_to_row (struct window *w, struct glyph_row *row, int area, HDC hdc) 4837w32_clip_to_row (struct window *w, struct glyph_row *row, int area, HDC hdc)
4844{ 4838{
4845 struct frame *f = XFRAME (WINDOW_FRAME (w));
4846 RECT clip_rect; 4839 RECT clip_rect;
4847 int window_x, window_y, window_width; 4840 int window_x, window_y, window_width;
4848 4841
@@ -6089,7 +6082,6 @@ static void
6089x_delete_terminal (struct terminal *terminal) 6082x_delete_terminal (struct terminal *terminal)
6090{ 6083{
6091 struct w32_display_info *dpyinfo = terminal->display_info.w32; 6084 struct w32_display_info *dpyinfo = terminal->display_info.w32;
6092 int i;
6093 6085
6094 /* Protect against recursive calls. delete_frame in 6086 /* Protect against recursive calls. delete_frame in
6095 delete_terminal calls us back when it deletes our last frame. */ 6087 delete_terminal calls us back when it deletes our last frame. */
diff --git a/src/w32uniscribe.c b/src/w32uniscribe.c
index 39d1ee5c851..f6347bb88f7 100644
--- a/src/w32uniscribe.c
+++ b/src/w32uniscribe.c
@@ -320,7 +320,7 @@ uniscribe_shape (Lisp_Object lgstring)
320 } 320 }
321 if (SUCCEEDED (result)) 321 if (SUCCEEDED (result))
322 { 322 {
323 int j, nclusters, from, to; 323 int j, from, to;
324 324
325 from = 0; 325 from = 0;
326 to = from; 326 to = from;
@@ -629,8 +629,6 @@ add_opentype_font_name_to_list (ENUMLOGFONTEX *logical_font,
629 STR[4] = '\0'; \ 629 STR[4] = '\0'; \
630 } while (0) 630 } while (0)
631 631
632static char* NOTHING = " ";
633
634#define SNAME(VAL) SDATA (SYMBOL_NAME (VAL)) 632#define SNAME(VAL) SDATA (SYMBOL_NAME (VAL))
635 633
636/* Check if font supports the otf script/language/features specified. 634/* Check if font supports the otf script/language/features specified.
@@ -646,7 +644,6 @@ uniscribe_check_otf (LOGFONT *font, Lisp_Object otf_spec)
646 struct frame * f; 644 struct frame * f;
647 HDC context; 645 HDC context;
648 HFONT check_font, old_font; 646 HFONT check_font, old_font;
649 DWORD table;
650 int i, retval = 0; 647 int i, retval = 0;
651 struct gcpro gcpro1; 648 struct gcpro gcpro1;
652 649
@@ -936,7 +933,11 @@ struct font_driver uniscribe_font_driver =
936 NULL, /* otf_drive - use shape instead. */ 933 NULL, /* otf_drive - use shape instead. */
937 NULL, /* start_for_frame */ 934 NULL, /* start_for_frame */
938 NULL, /* end_for_frame */ 935 NULL, /* end_for_frame */
939 uniscribe_shape 936 uniscribe_shape,
937 NULL, /* check */
938 NULL, /* get_variation_glyphs */
939 NULL, /* filter_properties */
940 NULL, /* cached_font_ok */
940 }; 941 };
941 942
942/* Note that this should be called at every startup, not just when dumping, 943/* Note that this should be called at every startup, not just when dumping,
diff --git a/src/window.c b/src/window.c
index f35815d757c..4bd533c22ac 100644
--- a/src/window.c
+++ b/src/window.c
@@ -2978,14 +2978,10 @@ shrink_windows (int total, int size, int nchildren, int shrinkable,
2978 while (total_shrink > total_removed) 2978 while (total_shrink > total_removed)
2979 { 2979 {
2980 int nonzero_sizes = 0; 2980 int nonzero_sizes = 0;
2981 int nonzero_idx = -1;
2982 2981
2983 for (i = 0; i < nchildren; ++i) 2982 for (i = 0; i < nchildren; ++i)
2984 if (new_sizes[i] > 0) 2983 if (new_sizes[i] > 0)
2985 { 2984 ++nonzero_sizes;
2986 ++nonzero_sizes;
2987 nonzero_idx = i;
2988 }
2989 2985
2990 for (i = 0; i < nchildren; ++i) 2986 for (i = 0; i < nchildren; ++i)
2991 if (new_sizes[i] > min_sizes[i]) 2987 if (new_sizes[i] > min_sizes[i])
@@ -3689,27 +3685,23 @@ temp_output_buffer_show (register Lisp_Object buf)
3689 3685
3690 /* Run temp-buffer-show-hook, with the chosen window selected 3686 /* Run temp-buffer-show-hook, with the chosen window selected
3691 and its buffer current. */ 3687 and its buffer current. */
3692 3688 {
3693 if (!NILP (Vrun_hooks) 3689 int count = SPECPDL_INDEX ();
3694 && !NILP (Fboundp (Qtemp_buffer_show_hook)) 3690 Lisp_Object prev_window, prev_buffer;
3695 && !NILP (Fsymbol_value (Qtemp_buffer_show_hook))) 3691 prev_window = selected_window;
3696 { 3692 XSETBUFFER (prev_buffer, old);
3697 int count = SPECPDL_INDEX (); 3693
3698 Lisp_Object prev_window, prev_buffer; 3694 /* Select the window that was chosen, for running the hook.
3699 prev_window = selected_window; 3695 Note: Both Fselect_window and select_window_norecord may
3700 XSETBUFFER (prev_buffer, old); 3696 set-buffer to the buffer displayed in the window,
3701 3697 so we need to save the current buffer. --stef */
3702 /* Select the window that was chosen, for running the hook. 3698 record_unwind_protect (Fset_buffer, prev_buffer);
3703 Note: Both Fselect_window and select_window_norecord may 3699 record_unwind_protect (select_window_norecord, prev_window);
3704 set-buffer to the buffer displayed in the window, 3700 Fselect_window (window, Qt);
3705 so we need to save the current buffer. --stef */ 3701 Fset_buffer (w->buffer);
3706 record_unwind_protect (Fset_buffer, prev_buffer); 3702 Frun_hooks (1, &Qtemp_buffer_show_hook);
3707 record_unwind_protect (select_window_norecord, prev_window); 3703 unbind_to (count, Qnil);
3708 Fselect_window (window, Qt); 3704 }
3709 Fset_buffer (w->buffer);
3710 call1 (Vrun_hooks, Qtemp_buffer_show_hook);
3711 unbind_to (count, Qnil);
3712 }
3713 } 3705 }
3714} 3706}
3715 3707
diff --git a/src/xdisp.c b/src/xdisp.c
index a7955f41e0c..bbbf37b68ac 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -754,7 +754,7 @@ static void setup_for_ellipsis (struct it *, int);
754static void mark_window_display_accurate_1 (struct window *, int); 754static void mark_window_display_accurate_1 (struct window *, int);
755static int single_display_spec_string_p (Lisp_Object, Lisp_Object); 755static int single_display_spec_string_p (Lisp_Object, Lisp_Object);
756static int display_prop_string_p (Lisp_Object, Lisp_Object); 756static int display_prop_string_p (Lisp_Object, Lisp_Object);
757static int cursor_row_p (struct window *, struct glyph_row *); 757static int cursor_row_p (struct glyph_row *);
758static int redisplay_mode_lines (Lisp_Object, int); 758static int redisplay_mode_lines (Lisp_Object, int);
759static char *decode_mode_spec_coding (Lisp_Object, char *, int); 759static char *decode_mode_spec_coding (Lisp_Object, char *, int);
760 760
@@ -802,8 +802,8 @@ static int cursor_row_fully_visible_p (struct window *, int, int);
802static int try_scrolling (Lisp_Object, int, EMACS_INT, EMACS_INT, int, int); 802static int try_scrolling (Lisp_Object, int, EMACS_INT, EMACS_INT, int, int);
803static int try_cursor_movement (Lisp_Object, struct text_pos, int *); 803static int try_cursor_movement (Lisp_Object, struct text_pos, int *);
804static int trailing_whitespace_p (EMACS_INT); 804static int trailing_whitespace_p (EMACS_INT);
805static int message_log_check_duplicate (EMACS_INT, EMACS_INT, 805static unsigned long int message_log_check_duplicate (EMACS_INT, EMACS_INT,
806 EMACS_INT, EMACS_INT); 806 EMACS_INT, EMACS_INT);
807static void push_it (struct it *); 807static void push_it (struct it *);
808static void pop_it (struct it *); 808static void pop_it (struct it *);
809static void sync_frame_with_window_matrix_rows (struct window *); 809static void sync_frame_with_window_matrix_rows (struct window *);
@@ -823,8 +823,7 @@ static int display_mode_lines (struct window *);
823static int display_mode_line (struct window *, enum face_id, Lisp_Object); 823static int display_mode_line (struct window *, enum face_id, Lisp_Object);
824static int display_mode_element (struct it *, int, int, int, Lisp_Object, Lisp_Object, int); 824static int display_mode_element (struct it *, int, int, int, Lisp_Object, Lisp_Object, int);
825static int store_mode_line_string (const char *, Lisp_Object, int, int, int, Lisp_Object); 825static int store_mode_line_string (const char *, Lisp_Object, int, int, int, Lisp_Object);
826static const char *decode_mode_spec (struct window *, int, int, int, 826static const char *decode_mode_spec (struct window *, int, int, Lisp_Object *);
827 Lisp_Object *);
828static void display_menu_bar (struct window *); 827static void display_menu_bar (struct window *);
829static int display_count_lines (EMACS_INT, EMACS_INT, EMACS_INT, int, 828static int display_count_lines (EMACS_INT, EMACS_INT, EMACS_INT, int,
830 EMACS_INT *); 829 EMACS_INT *);
@@ -2181,7 +2180,7 @@ safe_eval_handler (Lisp_Object arg)
2181 redisplay during the evaluation. */ 2180 redisplay during the evaluation. */
2182 2181
2183Lisp_Object 2182Lisp_Object
2184safe_call (int nargs, Lisp_Object *args) 2183safe_call (size_t nargs, Lisp_Object *args)
2185{ 2184{
2186 Lisp_Object val; 2185 Lisp_Object val;
2187 2186
@@ -3164,6 +3163,9 @@ handle_fontified_prop (struct it *it)
3164 { 3163 {
3165 int count = SPECPDL_INDEX (); 3164 int count = SPECPDL_INDEX ();
3166 Lisp_Object val; 3165 Lisp_Object val;
3166 struct buffer *obuf = current_buffer;
3167 int begv = BEGV, zv = ZV;
3168 int old_clip_changed = current_buffer->clip_changed;
3167 3169
3168 val = Vfontification_functions; 3170 val = Vfontification_functions;
3169 specbind (Qfontification_functions, Qnil); 3171 specbind (Qfontification_functions, Qnil);
@@ -3209,6 +3211,23 @@ handle_fontified_prop (struct it *it)
3209 3211
3210 unbind_to (count, Qnil); 3212 unbind_to (count, Qnil);
3211 3213
3214 /* Fontification functions routinely call `save-restriction'.
3215 Normally, this tags clip_changed, which can confuse redisplay
3216 (see discussion in Bug#6671). Since we don't perform any
3217 special handling of fontification changes in the case where
3218 `save-restriction' isn't called, there's no point doing so in
3219 this case either. So, if the buffer's restrictions are
3220 actually left unchanged, reset clip_changed. */
3221 if (obuf == current_buffer)
3222 {
3223 if (begv == BEGV && zv == ZV)
3224 current_buffer->clip_changed = old_clip_changed;
3225 }
3226 /* There isn't much we can reasonably do to protect against
3227 misbehaving fontification, but here's a fig leaf. */
3228 else if (!NILP (BVAR (obuf, name)))
3229 set_buffer_internal_1 (obuf);
3230
3212 /* The fontification code may have added/removed text. 3231 /* The fontification code may have added/removed text.
3213 It could do even a lot worse, but let's at least protect against 3232 It could do even a lot worse, but let's at least protect against
3214 the most obvious case where only the text past `pos' gets changed', 3233 the most obvious case where only the text past `pos' gets changed',
@@ -4400,20 +4419,18 @@ display_prop_string_p (Lisp_Object prop, Lisp_Object string)
4400 return 0; 4419 return 0;
4401} 4420}
4402 4421
4403/* Look for STRING in overlays and text properties in W's buffer, 4422/* Look for STRING in overlays and text properties in the current
4404 between character positions FROM and TO (excluding TO). 4423 buffer, between character positions FROM and TO (excluding TO).
4405 BACK_P non-zero means look back (in this case, TO is supposed to be 4424 BACK_P non-zero means look back (in this case, TO is supposed to be
4406 less than FROM). 4425 less than FROM).
4407 Value is the first character position where STRING was found, or 4426 Value is the first character position where STRING was found, or
4408 zero if it wasn't found before hitting TO. 4427 zero if it wasn't found before hitting TO.
4409 4428
4410 W's buffer must be current.
4411
4412 This function may only use code that doesn't eval because it is 4429 This function may only use code that doesn't eval because it is
4413 called asynchronously from note_mouse_highlight. */ 4430 called asynchronously from note_mouse_highlight. */
4414 4431
4415static EMACS_INT 4432static EMACS_INT
4416string_buffer_position_lim (struct window *w, Lisp_Object string, 4433string_buffer_position_lim (Lisp_Object string,
4417 EMACS_INT from, EMACS_INT to, int back_p) 4434 EMACS_INT from, EMACS_INT to, int back_p)
4418{ 4435{
4419 Lisp_Object limit, prop, pos; 4436 Lisp_Object limit, prop, pos;
@@ -4451,27 +4468,25 @@ string_buffer_position_lim (struct window *w, Lisp_Object string,
4451 return found ? XINT (pos) : 0; 4468 return found ? XINT (pos) : 0;
4452} 4469}
4453 4470
4454/* Determine which buffer position in W's buffer STRING comes from. 4471/* Determine which buffer position in current buffer STRING comes from.
4455 AROUND_CHARPOS is an approximate position where it could come from. 4472 AROUND_CHARPOS is an approximate position where it could come from.
4456 Value is the buffer position or 0 if it couldn't be determined. 4473 Value is the buffer position or 0 if it couldn't be determined.
4457 4474
4458 W's buffer must be current.
4459
4460 This function is necessary because we don't record buffer positions 4475 This function is necessary because we don't record buffer positions
4461 in glyphs generated from strings (to keep struct glyph small). 4476 in glyphs generated from strings (to keep struct glyph small).
4462 This function may only use code that doesn't eval because it is 4477 This function may only use code that doesn't eval because it is
4463 called asynchronously from note_mouse_highlight. */ 4478 called asynchronously from note_mouse_highlight. */
4464 4479
4465EMACS_INT 4480static EMACS_INT
4466string_buffer_position (struct window *w, Lisp_Object string, EMACS_INT around_charpos) 4481string_buffer_position (Lisp_Object string, EMACS_INT around_charpos)
4467{ 4482{
4468 const int MAX_DISTANCE = 1000; 4483 const int MAX_DISTANCE = 1000;
4469 EMACS_INT found = string_buffer_position_lim (w, string, around_charpos, 4484 EMACS_INT found = string_buffer_position_lim (string, around_charpos,
4470 around_charpos + MAX_DISTANCE, 4485 around_charpos + MAX_DISTANCE,
4471 0); 4486 0);
4472 4487
4473 if (!found) 4488 if (!found)
4474 found = string_buffer_position_lim (w, string, around_charpos, 4489 found = string_buffer_position_lim (string, around_charpos,
4475 around_charpos - MAX_DISTANCE, 1); 4490 around_charpos - MAX_DISTANCE, 1);
4476 return found; 4491 return found;
4477} 4492}
@@ -7947,7 +7962,7 @@ message_dolog (const char *m, EMACS_INT nbytes, int nlflag, int multibyte)
7947 c = string_char_and_length (msg + i, &char_bytes); 7962 c = string_char_and_length (msg + i, &char_bytes);
7948 work[0] = (ASCII_CHAR_P (c) 7963 work[0] = (ASCII_CHAR_P (c)
7949 ? c 7964 ? c
7950 : multibyte_char_to_unibyte (c, Qnil)); 7965 : multibyte_char_to_unibyte (c));
7951 insert_1_both (work, 1, 1, 1, 0, 0); 7966 insert_1_both (work, 1, 1, 1, 0, 0);
7952 } 7967 }
7953 } 7968 }
@@ -7973,7 +7988,7 @@ message_dolog (const char *m, EMACS_INT nbytes, int nlflag, int multibyte)
7973 if (nlflag) 7988 if (nlflag)
7974 { 7989 {
7975 EMACS_INT this_bol, this_bol_byte, prev_bol, prev_bol_byte; 7990 EMACS_INT this_bol, this_bol_byte, prev_bol, prev_bol_byte;
7976 int dups; 7991 unsigned long int dups;
7977 insert_1 ("\n", 1, 1, 0, 0); 7992 insert_1 ("\n", 1, 1, 0, 0);
7978 7993
7979 scan_newline (Z, Z_BYTE, BEG, BEG_BYTE, -2, 0); 7994 scan_newline (Z, Z_BYTE, BEG, BEG_BYTE, -2, 0);
@@ -8001,7 +8016,7 @@ message_dolog (const char *m, EMACS_INT nbytes, int nlflag, int multibyte)
8001 8016
8002 /* If you change this format, don't forget to also 8017 /* If you change this format, don't forget to also
8003 change message_log_check_duplicate. */ 8018 change message_log_check_duplicate. */
8004 sprintf (dupstr, " [%d times]", dups); 8019 sprintf (dupstr, " [%lu times]", dups);
8005 duplen = strlen (dupstr); 8020 duplen = strlen (dupstr);
8006 TEMP_SET_PT_BOTH (Z - 1, Z_BYTE - 1); 8021 TEMP_SET_PT_BOTH (Z - 1, Z_BYTE - 1);
8007 insert_1 (dupstr, duplen, 1, 0, 1); 8022 insert_1 (dupstr, duplen, 1, 0, 1);
@@ -8063,7 +8078,7 @@ message_dolog (const char *m, EMACS_INT nbytes, int nlflag, int multibyte)
8063 Return 0 if different, 1 if the new one should just replace it, or a 8078 Return 0 if different, 1 if the new one should just replace it, or a
8064 value N > 1 if we should also append " [N times]". */ 8079 value N > 1 if we should also append " [N times]". */
8065 8080
8066static int 8081static unsigned long int
8067message_log_check_duplicate (EMACS_INT prev_bol, EMACS_INT prev_bol_byte, 8082message_log_check_duplicate (EMACS_INT prev_bol, EMACS_INT prev_bol_byte,
8068 EMACS_INT this_bol, EMACS_INT this_bol_byte) 8083 EMACS_INT this_bol, EMACS_INT this_bol_byte)
8069{ 8084{
@@ -8085,10 +8100,9 @@ message_log_check_duplicate (EMACS_INT prev_bol, EMACS_INT prev_bol_byte,
8085 return 2; 8100 return 2;
8086 if (*p1++ == ' ' && *p1++ == '[') 8101 if (*p1++ == ' ' && *p1++ == '[')
8087 { 8102 {
8088 int n = 0; 8103 char *pend;
8089 while (*p1 >= '0' && *p1 <= '9') 8104 unsigned long int n = strtoul ((char *) p1, &pend, 10);
8090 n = n * 10 + *p1++ - '0'; 8105 if (strncmp (pend, " times]\n", 8) == 0)
8091 if (strncmp ((char *) p1, " times]\n", 8) == 0)
8092 return n+1; 8106 return n+1;
8093 } 8107 }
8094 return 0; 8108 return 0;
@@ -9209,7 +9223,7 @@ set_message_1 (EMACS_INT a1, Lisp_Object a2, EMACS_INT nbytes, EMACS_INT multiby
9209 c = string_char_and_length (msg + i, &n); 9223 c = string_char_and_length (msg + i, &n);
9210 work[0] = (ASCII_CHAR_P (c) 9224 work[0] = (ASCII_CHAR_P (c)
9211 ? c 9225 ? c
9212 : multibyte_char_to_unibyte (c, Qnil)); 9226 : multibyte_char_to_unibyte (c));
9213 insert_1_both (work, 1, 1, 1, 0, 0); 9227 insert_1_both (work, 1, 1, 1, 0, 0);
9214 } 9228 }
9215 } 9229 }
@@ -12712,7 +12726,7 @@ set_cursor_from_row (struct window *w, struct glyph_row *row,
12712 EMACS_INT tem; 12726 EMACS_INT tem;
12713 12727
12714 str = glyph->object; 12728 str = glyph->object;
12715 tem = string_buffer_position_lim (w, str, pos, pos_after, 0); 12729 tem = string_buffer_position_lim (str, pos, pos_after, 0);
12716 if (tem == 0 /* from overlay */ 12730 if (tem == 0 /* from overlay */
12717 || pos <= tem) 12731 || pos <= tem)
12718 { 12732 {
@@ -13438,7 +13452,7 @@ try_cursor_movement (Lisp_Object window, struct text_pos startp, int *scroll_ste
13438 && row < w->current_matrix->rows 13452 && row < w->current_matrix->rows
13439 + w->current_matrix->nrows - 1 13453 + w->current_matrix->nrows - 1
13440 && MATRIX_ROW_START_CHARPOS (row+1) == PT 13454 && MATRIX_ROW_START_CHARPOS (row+1) == PT
13441 && !cursor_row_p (w, row)) 13455 && !cursor_row_p (row))
13442 ++row; 13456 ++row;
13443 13457
13444 /* If within the scroll margin, scroll. Note that 13458 /* If within the scroll margin, scroll. Note that
@@ -13490,7 +13504,7 @@ try_cursor_movement (Lisp_Object window, struct text_pos startp, int *scroll_ste
13490 skip forward over overlay strings. */ 13504 skip forward over overlay strings. */
13491 while (MATRIX_ROW_BOTTOM_Y (row) < last_y 13505 while (MATRIX_ROW_BOTTOM_Y (row) < last_y
13492 && MATRIX_ROW_END_CHARPOS (row) == PT 13506 && MATRIX_ROW_END_CHARPOS (row) == PT
13493 && !cursor_row_p (w, row)) 13507 && !cursor_row_p (row))
13494 ++row; 13508 ++row;
13495 13509
13496 /* If within the scroll margin, scroll. */ 13510 /* If within the scroll margin, scroll. */
@@ -13586,7 +13600,7 @@ try_cursor_movement (Lisp_Object window, struct text_pos startp, int *scroll_ste
13586 { 13600 {
13587 if (MATRIX_ROW_START_CHARPOS (row) <= PT 13601 if (MATRIX_ROW_START_CHARPOS (row) <= PT
13588 && PT <= MATRIX_ROW_END_CHARPOS (row) 13602 && PT <= MATRIX_ROW_END_CHARPOS (row)
13589 && cursor_row_p (w, row)) 13603 && cursor_row_p (row))
13590 rv |= set_cursor_from_row (w, row, w->current_matrix, 13604 rv |= set_cursor_from_row (w, row, w->current_matrix,
13591 0, 0, 0, 0); 13605 0, 0, 0, 0);
13592 /* As soon as we've found the first suitable row 13606 /* As soon as we've found the first suitable row
@@ -13625,7 +13639,7 @@ try_cursor_movement (Lisp_Object window, struct text_pos startp, int *scroll_ste
13625 } 13639 }
13626 while (MATRIX_ROW_BOTTOM_Y (row) < last_y 13640 while (MATRIX_ROW_BOTTOM_Y (row) < last_y
13627 && MATRIX_ROW_START_CHARPOS (row) == PT 13641 && MATRIX_ROW_START_CHARPOS (row) == PT
13628 && cursor_row_p (w, row)); 13642 && cursor_row_p (row));
13629 } 13643 }
13630 } 13644 }
13631 } 13645 }
@@ -14157,7 +14171,6 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
14157 || temp_scroll_step 14171 || temp_scroll_step
14158 || NUMBERP (BVAR (current_buffer, scroll_up_aggressively)) 14172 || NUMBERP (BVAR (current_buffer, scroll_up_aggressively))
14159 || NUMBERP (BVAR (current_buffer, scroll_down_aggressively))) 14173 || NUMBERP (BVAR (current_buffer, scroll_down_aggressively)))
14160 && !current_buffer->clip_changed
14161 && CHARPOS (startp) >= BEGV 14174 && CHARPOS (startp) >= BEGV
14162 && CHARPOS (startp) <= ZV) 14175 && CHARPOS (startp) <= ZV)
14163 { 14176 {
@@ -14625,8 +14638,6 @@ try_window_reusing_current_matrix (struct window *w)
14625 14638
14626 if (CHARPOS (new_start) <= CHARPOS (start)) 14639 if (CHARPOS (new_start) <= CHARPOS (start))
14627 { 14640 {
14628 int first_row_y;
14629
14630 /* Don't use this method if the display starts with an ellipsis 14641 /* Don't use this method if the display starts with an ellipsis
14631 displayed for invisible text. It's not easy to handle that case 14642 displayed for invisible text. It's not easy to handle that case
14632 below, and it's certainly not worth the effort since this is 14643 below, and it's certainly not worth the effort since this is
@@ -14641,7 +14652,6 @@ try_window_reusing_current_matrix (struct window *w)
14641 text. Note that it.vpos == 0 if or if not there is a 14652 text. Note that it.vpos == 0 if or if not there is a
14642 header-line; it's not the same as the MATRIX_ROW_VPOS! */ 14653 header-line; it's not the same as the MATRIX_ROW_VPOS! */
14643 start_display (&it, w, new_start); 14654 start_display (&it, w, new_start);
14644 first_row_y = it.current_y;
14645 w->cursor.vpos = -1; 14655 w->cursor.vpos = -1;
14646 last_text_row = last_reused_text_row = NULL; 14656 last_text_row = last_reused_text_row = NULL;
14647 14657
@@ -16370,7 +16380,7 @@ With ARG, turn tracing on if and only if ARG is positive. */)
16370DEFUN ("trace-to-stderr", Ftrace_to_stderr, Strace_to_stderr, 1, MANY, "", 16380DEFUN ("trace-to-stderr", Ftrace_to_stderr, Strace_to_stderr, 1, MANY, "",
16371 doc: /* Like `format', but print result to stderr. 16381 doc: /* Like `format', but print result to stderr.
16372usage: (trace-to-stderr STRING &rest OBJECTS) */) 16382usage: (trace-to-stderr STRING &rest OBJECTS) */)
16373 (int nargs, Lisp_Object *args) 16383 (size_t nargs, Lisp_Object *args)
16374{ 16384{
16375 Lisp_Object s = Fformat (nargs, args); 16385 Lisp_Object s = Fformat (nargs, args);
16376 fprintf (stderr, "%s", SDATA (s)); 16386 fprintf (stderr, "%s", SDATA (s));
@@ -16953,11 +16963,11 @@ highlight_trailing_whitespace (struct frame *f, struct glyph_row *row)
16953} 16963}
16954 16964
16955 16965
16956/* Value is non-zero if glyph row ROW in window W should be 16966/* Value is non-zero if glyph row ROW should be
16957 used to hold the cursor. */ 16967 used to hold the cursor. */
16958 16968
16959static int 16969static int
16960cursor_row_p (struct window *w, struct glyph_row *row) 16970cursor_row_p (struct glyph_row *row)
16961{ 16971{
16962 int result = 1; 16972 int result = 1;
16963 16973
@@ -17870,7 +17880,7 @@ display_line (struct it *it)
17870 && !MATRIX_ROW (it->w->desired_matrix, cvpos)->ends_at_zv_p)) 17880 && !MATRIX_ROW (it->w->desired_matrix, cvpos)->ends_at_zv_p))
17871 && PT >= MATRIX_ROW_START_CHARPOS (row) 17881 && PT >= MATRIX_ROW_START_CHARPOS (row)
17872 && PT <= MATRIX_ROW_END_CHARPOS (row) 17882 && PT <= MATRIX_ROW_END_CHARPOS (row)
17873 && cursor_row_p (it->w, row)) 17883 && cursor_row_p (row))
17874 set_cursor_from_row (it->w, row, it->w->desired_matrix, 0, 0, 0, 0); 17884 set_cursor_from_row (it->w, row, it->w->desired_matrix, 0, 0, 0, 0);
17875 17885
17876 /* Highlight trailing whitespace. */ 17886 /* Highlight trailing whitespace. */
@@ -18522,7 +18532,7 @@ display_mode_element (struct it *it, int depth, int field_width, int precision,
18522 charpos = (STRING_MULTIBYTE (elt) 18532 charpos = (STRING_MULTIBYTE (elt)
18523 ? string_byte_to_char (elt, bytepos) 18533 ? string_byte_to_char (elt, bytepos)
18524 : bytepos); 18534 : bytepos);
18525 spec = decode_mode_spec (it->w, c, field, prec, &string); 18535 spec = decode_mode_spec (it->w, c, field, &string);
18526 multibyte = STRINGP (string) && STRING_MULTIBYTE (string); 18536 multibyte = STRINGP (string) && STRING_MULTIBYTE (string);
18527 18537
18528 switch (mode_line_target) 18538 switch (mode_line_target)
@@ -19007,7 +19017,7 @@ pint2str (register char *buf, register int width, register EMACS_INT d)
19007 19017
19008static const char power_letter[] = 19018static const char power_letter[] =
19009 { 19019 {
19010 0, /* not used */ 19020 0, /* no letter */
19011 'k', /* kilo */ 19021 'k', /* kilo */
19012 'M', /* mega */ 19022 'M', /* mega */
19013 'G', /* giga */ 19023 'G', /* giga */
@@ -19089,8 +19099,7 @@ pint2hrstr (char *buf, int width, int d)
19089 p = psuffix = buf + max (width, length); 19099 p = psuffix = buf + max (width, length);
19090 19100
19091 /* Print EXPONENT. */ 19101 /* Print EXPONENT. */
19092 if (exponent) 19102 *psuffix++ = power_letter[exponent];
19093 *psuffix++ = power_letter[exponent];
19094 *psuffix = '\0'; 19103 *psuffix = '\0';
19095 19104
19096 /* Print TENTHS. */ 19105 /* Print TENTHS. */
@@ -19194,9 +19203,8 @@ decode_mode_spec_coding (Lisp_Object coding_system, register char *buf, int eol_
19194} 19203}
19195 19204
19196/* Return a string for the output of a mode line %-spec for window W, 19205/* Return a string for the output of a mode line %-spec for window W,
19197 generated by character C. PRECISION >= 0 means don't return a 19206 generated by character C. FIELD_WIDTH > 0 means pad the string
19198 string longer than that value. FIELD_WIDTH > 0 means pad the 19207 returned with spaces to that value. Return a Lisp string in
19199 string returned with spaces to that value. Return a Lisp string in
19200 *STRING if the resulting string is taken from that Lisp string. 19208 *STRING if the resulting string is taken from that Lisp string.
19201 19209
19202 Note we operate on the current buffer for most purposes, 19210 Note we operate on the current buffer for most purposes,
@@ -19206,7 +19214,7 @@ static char lots_of_dashes[] = "------------------------------------------------
19206 19214
19207static const char * 19215static const char *
19208decode_mode_spec (struct window *w, register int c, int field_width, 19216decode_mode_spec (struct window *w, register int c, int field_width,
19209 int precision, Lisp_Object *string) 19217 Lisp_Object *string)
19210{ 19218{
19211 Lisp_Object obj; 19219 Lisp_Object obj;
19212 struct frame *f = XFRAME (WINDOW_FRAME (w)); 19220 struct frame *f = XFRAME (WINDOW_FRAME (w));
@@ -22740,7 +22748,6 @@ x_produce_glyphs (struct it *it)
22740 int ch = COMPOSITION_GLYPH (cmp, i); 22748 int ch = COMPOSITION_GLYPH (cmp, i);
22741 int face_id; 22749 int face_id;
22742 struct face *this_face; 22750 struct face *this_face;
22743 int this_boff;
22744 22751
22745 if (ch == '\t') 22752 if (ch == '\t')
22746 ch = ' '; 22753 ch = ' ';
@@ -22752,9 +22759,6 @@ x_produce_glyphs (struct it *it)
22752 pcm = NULL; 22759 pcm = NULL;
22753 else 22760 else
22754 { 22761 {
22755 this_boff = font->baseline_offset;
22756 if (font->vertical_centering)
22757 this_boff = VCENTER_BASELINE_OFFSET (font, it->f) - boff;
22758 get_char_face_and_encoding (it->f, ch, face_id, 22762 get_char_face_and_encoding (it->f, ch, face_id,
22759 &char2b, it->multibyte_p, 0); 22763 &char2b, it->multibyte_p, 0);
22760 pcm = get_per_char_metric (it->f, font, &char2b); 22764 pcm = get_per_char_metric (it->f, font, &char2b);
@@ -24307,7 +24311,7 @@ mouse_face_from_buffer_pos (Lisp_Object window,
24307 END_CHARPOS, or if they come from an overlay. */ 24311 END_CHARPOS, or if they come from an overlay. */
24308 if (EQ (glyph->object, before_string)) 24312 if (EQ (glyph->object, before_string))
24309 { 24313 {
24310 pos = string_buffer_position (w, before_string, 24314 pos = string_buffer_position (before_string,
24311 start_charpos); 24315 start_charpos);
24312 /* If pos == 0, it means before_string came from an 24316 /* If pos == 0, it means before_string came from an
24313 overlay, not from a buffer position. */ 24317 overlay, not from a buffer position. */
@@ -24316,7 +24320,7 @@ mouse_face_from_buffer_pos (Lisp_Object window,
24316 } 24320 }
24317 else if (EQ (glyph->object, after_string)) 24321 else if (EQ (glyph->object, after_string))
24318 { 24322 {
24319 pos = string_buffer_position (w, after_string, end_charpos); 24323 pos = string_buffer_position (after_string, end_charpos);
24320 if (!pos || (pos >= start_charpos && pos < end_charpos)) 24324 if (!pos || (pos >= start_charpos && pos < end_charpos))
24321 break; 24325 break;
24322 } 24326 }
@@ -24358,7 +24362,7 @@ mouse_face_from_buffer_pos (Lisp_Object window,
24358 END_CHARPOS, or if they come from an overlay. */ 24362 END_CHARPOS, or if they come from an overlay. */
24359 if (EQ (glyph->object, before_string)) 24363 if (EQ (glyph->object, before_string))
24360 { 24364 {
24361 pos = string_buffer_position (w, before_string, start_charpos); 24365 pos = string_buffer_position (before_string, start_charpos);
24362 /* If pos == 0, it means before_string came from an 24366 /* If pos == 0, it means before_string came from an
24363 overlay, not from a buffer position. */ 24367 overlay, not from a buffer position. */
24364 if (!pos || (pos >= start_charpos && pos < end_charpos)) 24368 if (!pos || (pos >= start_charpos && pos < end_charpos))
@@ -24366,7 +24370,7 @@ mouse_face_from_buffer_pos (Lisp_Object window,
24366 } 24370 }
24367 else if (EQ (glyph->object, after_string)) 24371 else if (EQ (glyph->object, after_string))
24368 { 24372 {
24369 pos = string_buffer_position (w, after_string, end_charpos); 24373 pos = string_buffer_position (after_string, end_charpos);
24370 if (!pos || (pos >= start_charpos && pos < end_charpos)) 24374 if (!pos || (pos >= start_charpos && pos < end_charpos))
24371 break; 24375 break;
24372 } 24376 }
@@ -24424,13 +24428,13 @@ mouse_face_from_buffer_pos (Lisp_Object window,
24424 END_CHARPOS, or if they come from an overlay. */ 24428 END_CHARPOS, or if they come from an overlay. */
24425 if (EQ (end->object, before_string)) 24429 if (EQ (end->object, before_string))
24426 { 24430 {
24427 pos = string_buffer_position (w, before_string, start_charpos); 24431 pos = string_buffer_position (before_string, start_charpos);
24428 if (!pos || (pos >= start_charpos && pos < end_charpos)) 24432 if (!pos || (pos >= start_charpos && pos < end_charpos))
24429 break; 24433 break;
24430 } 24434 }
24431 else if (EQ (end->object, after_string)) 24435 else if (EQ (end->object, after_string))
24432 { 24436 {
24433 pos = string_buffer_position (w, after_string, end_charpos); 24437 pos = string_buffer_position (after_string, end_charpos);
24434 if (!pos || (pos >= start_charpos && pos < end_charpos)) 24438 if (!pos || (pos >= start_charpos && pos < end_charpos))
24435 break; 24439 break;
24436 } 24440 }
@@ -24474,13 +24478,13 @@ mouse_face_from_buffer_pos (Lisp_Object window,
24474 END_CHARPOS, or if they come from an overlay. */ 24478 END_CHARPOS, or if they come from an overlay. */
24475 if (EQ (end->object, before_string)) 24479 if (EQ (end->object, before_string))
24476 { 24480 {
24477 pos = string_buffer_position (w, before_string, start_charpos); 24481 pos = string_buffer_position (before_string, start_charpos);
24478 if (!pos || (pos >= start_charpos && pos < end_charpos)) 24482 if (!pos || (pos >= start_charpos && pos < end_charpos))
24479 break; 24483 break;
24480 } 24484 }
24481 else if (EQ (end->object, after_string)) 24485 else if (EQ (end->object, after_string))
24482 { 24486 {
24483 pos = string_buffer_position (w, after_string, end_charpos); 24487 pos = string_buffer_position (after_string, end_charpos);
24484 if (!pos || (pos >= start_charpos && pos < end_charpos)) 24488 if (!pos || (pos >= start_charpos && pos < end_charpos))
24485 break; 24489 break;
24486 } 24490 }
@@ -24957,10 +24961,9 @@ note_mode_line_or_margin_highlight (Lisp_Object window, int x, int y,
24957 CONSP (hotspot)) 24961 CONSP (hotspot))
24958 && (hotspot = XCDR (hotspot), CONSP (hotspot))) 24962 && (hotspot = XCDR (hotspot), CONSP (hotspot)))
24959 { 24963 {
24960 Lisp_Object area_id, plist; 24964 Lisp_Object plist;
24961 24965
24962 area_id = XCAR (hotspot); 24966 /* Could check XCAR (hotspot) to see if we enter/leave this hot-spot.
24963 /* Could check AREA_ID to see if we enter/leave this hot-spot.
24964 If so, we could look for mouse-enter, mouse-leave 24967 If so, we could look for mouse-enter, mouse-leave
24965 properties in PLIST (and do something...). */ 24968 properties in PLIST (and do something...). */
24966 hotspot = XCDR (hotspot); 24969 hotspot = XCDR (hotspot);
@@ -25295,10 +25298,10 @@ note_mouse_highlight (struct frame *f, int x, int y)
25295 CONSP (hotspot)) 25298 CONSP (hotspot))
25296 && (hotspot = XCDR (hotspot), CONSP (hotspot))) 25299 && (hotspot = XCDR (hotspot), CONSP (hotspot)))
25297 { 25300 {
25298 Lisp_Object area_id, plist; 25301 Lisp_Object plist;
25299 25302
25300 area_id = XCAR (hotspot); 25303 /* Could check XCAR (hotspot) to see if we enter/leave
25301 /* Could check AREA_ID to see if we enter/leave this hot-spot. 25304 this hot-spot.
25302 If so, we could look for mouse-enter, mouse-leave 25305 If so, we could look for mouse-enter, mouse-leave
25303 properties in PLIST (and do something...). */ 25306 properties in PLIST (and do something...). */
25304 hotspot = XCDR (hotspot); 25307 hotspot = XCDR (hotspot);
@@ -25464,7 +25467,7 @@ note_mouse_highlight (struct frame *f, int x, int y)
25464 check if the text under it has one. */ 25467 check if the text under it has one. */
25465 struct glyph_row *r = MATRIX_ROW (w->current_matrix, vpos); 25468 struct glyph_row *r = MATRIX_ROW (w->current_matrix, vpos);
25466 EMACS_INT start = MATRIX_ROW_START_CHARPOS (r); 25469 EMACS_INT start = MATRIX_ROW_START_CHARPOS (r);
25467 pos = string_buffer_position (w, object, start); 25470 pos = string_buffer_position (object, start);
25468 if (pos > 0) 25471 if (pos > 0)
25469 { 25472 {
25470 mouse_face = get_char_property_and_overlay 25473 mouse_face = get_char_property_and_overlay
@@ -25574,7 +25577,7 @@ note_mouse_highlight (struct frame *f, int x, int y)
25574 struct glyph_row *r 25577 struct glyph_row *r
25575 = MATRIX_ROW (w->current_matrix, vpos); 25578 = MATRIX_ROW (w->current_matrix, vpos);
25576 EMACS_INT start = MATRIX_ROW_START_CHARPOS (r); 25579 EMACS_INT start = MATRIX_ROW_START_CHARPOS (r);
25577 EMACS_INT p = string_buffer_position (w, obj, start); 25580 EMACS_INT p = string_buffer_position (obj, start);
25578 if (p > 0) 25581 if (p > 0)
25579 { 25582 {
25580 help = Fget_char_property (make_number (p), 25583 help = Fget_char_property (make_number (p),
@@ -25630,7 +25633,7 @@ note_mouse_highlight (struct frame *f, int x, int y)
25630 struct glyph_row *r 25633 struct glyph_row *r
25631 = MATRIX_ROW (w->current_matrix, vpos); 25634 = MATRIX_ROW (w->current_matrix, vpos);
25632 EMACS_INT start = MATRIX_ROW_START_CHARPOS (r); 25635 EMACS_INT start = MATRIX_ROW_START_CHARPOS (r);
25633 EMACS_INT p = string_buffer_position (w, obj, start); 25636 EMACS_INT p = string_buffer_position (obj, start);
25634 if (p > 0) 25637 if (p > 0)
25635 pointer = Fget_char_property (make_number (p), 25638 pointer = Fget_char_property (make_number (p),
25636 Qpointer, w->buffer); 25639 Qpointer, w->buffer);
diff --git a/src/xfont.c b/src/xfont.c
index f8aace3663c..3e0fcd2cd75 100644
--- a/src/xfont.c
+++ b/src/xfont.c
@@ -629,7 +629,7 @@ xfont_list_family (Lisp_Object frame)
629 char **names; 629 char **names;
630 int num_fonts, i; 630 int num_fonts, i;
631 Lisp_Object list; 631 Lisp_Object list;
632 char *last_family; 632 char *last_family IF_LINT (= 0);
633 int last_len; 633 int last_len;
634 634
635 BLOCK_INPUT; 635 BLOCK_INPUT;
diff --git a/src/xftfont.c b/src/xftfont.c
index 695527c4236..c27a4fcf91a 100644
--- a/src/xftfont.c
+++ b/src/xftfont.c
@@ -280,7 +280,7 @@ xftfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size)
280{ 280{
281 FcResult result; 281 FcResult result;
282 Display *display = FRAME_X_DISPLAY (f); 282 Display *display = FRAME_X_DISPLAY (f);
283 Lisp_Object val, filename, index, font_object; 283 Lisp_Object val, filename, idx, font_object;
284 FcPattern *pat = NULL, *match; 284 FcPattern *pat = NULL, *match;
285 struct xftfont_info *xftfont_info = NULL; 285 struct xftfont_info *xftfont_info = NULL;
286 struct font *font; 286 struct font *font;
@@ -298,7 +298,7 @@ xftfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size)
298 return Qnil; 298 return Qnil;
299 val = XCDR (val); 299 val = XCDR (val);
300 filename = XCAR (val); 300 filename = XCAR (val);
301 index = XCDR (val); 301 idx = XCDR (val);
302 size = XINT (AREF (entity, FONT_SIZE_INDEX)); 302 size = XINT (AREF (entity, FONT_SIZE_INDEX));
303 if (size == 0) 303 if (size == 0)
304 size = pixel_size; 304 size = pixel_size;
@@ -335,7 +335,7 @@ xftfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size)
335 xftfont_add_rendering_parameters (pat, entity); 335 xftfont_add_rendering_parameters (pat, entity);
336 336
337 FcPatternAddString (pat, FC_FILE, (FcChar8 *) SDATA (filename)); 337 FcPatternAddString (pat, FC_FILE, (FcChar8 *) SDATA (filename));
338 FcPatternAddInteger (pat, FC_INDEX, XINT (index)); 338 FcPatternAddInteger (pat, FC_INDEX, XINT (idx));
339 339
340 340
341 BLOCK_INPUT; 341 BLOCK_INPUT;
@@ -409,9 +409,9 @@ xftfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size)
409 spacing = FC_PROPORTIONAL; 409 spacing = FC_PROPORTIONAL;
410 if (! ascii_printable[0]) 410 if (! ascii_printable[0])
411 { 411 {
412 int i; 412 int ch;
413 for (i = 0; i < 95; i++) 413 for (ch = 0; ch < 95; ch++)
414 ascii_printable[i] = ' ' + i; 414 ascii_printable[ch] = ' ' + ch;
415 } 415 }
416 BLOCK_INPUT; 416 BLOCK_INPUT;
417 if (spacing != FC_PROPORTIONAL 417 if (spacing != FC_PROPORTIONAL
@@ -672,7 +672,8 @@ xftfont_draw (struct glyph_string *s, int from, int to, int x, int y, int with_b
672 return len; 672 return len;
673} 673}
674 674
675Lisp_Object 675#if defined HAVE_M17N_FLT && defined HAVE_LIBOTF
676static Lisp_Object
676xftfont_shape (Lisp_Object lgstring) 677xftfont_shape (Lisp_Object lgstring)
677{ 678{
678 struct font *font; 679 struct font *font;
@@ -688,6 +689,7 @@ xftfont_shape (Lisp_Object lgstring)
688 XftUnlockFace (xftfont_info->xftfont); 689 XftUnlockFace (xftfont_info->xftfont);
689 return val; 690 return val;
690} 691}
692#endif
691 693
692static int 694static int
693xftfont_end_for_frame (FRAME_PTR f) 695xftfont_end_for_frame (FRAME_PTR f)
diff --git a/src/xmenu.c b/src/xmenu.c
index eab7bb03f20..8ecef00c88e 100644
--- a/src/xmenu.c
+++ b/src/xmenu.c
@@ -383,7 +383,7 @@ x_menu_wait_for_event (void *data)
383#endif 383#endif
384 ) 384 )
385 { 385 {
386 EMACS_TIME next_time = timer_check (1), *ntp; 386 EMACS_TIME next_time = timer_check (), *ntp;
387 long secs = EMACS_SECS (next_time); 387 long secs = EMACS_SECS (next_time);
388 long usecs = EMACS_USECS (next_time); 388 long usecs = EMACS_USECS (next_time);
389 SELECT_TYPE read_fds; 389 SELECT_TYPE read_fds;
@@ -712,7 +712,7 @@ show_help_event (FRAME_PTR f, xt_or_gtk_widget widget, Lisp_Object help)
712 break; 712 break;
713 } 713 }
714#endif 714#endif
715 show_help_echo (help, Qnil, Qnil, Qnil, 1); 715 show_help_echo (help, Qnil, Qnil, Qnil);
716 } 716 }
717} 717}
718 718
@@ -922,7 +922,7 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p)
922#endif 922#endif
923 Lisp_Object items; 923 Lisp_Object items;
924 widget_value *wv, *first_wv, *prev_wv = 0; 924 widget_value *wv, *first_wv, *prev_wv = 0;
925 int i, last_i = 0; 925 EMACS_UINT i, last_i = 0;
926 int *submenu_start, *submenu_end; 926 int *submenu_start, *submenu_end;
927 int *submenu_top_level_items, *submenu_n_panes; 927 int *submenu_top_level_items, *submenu_n_panes;
928 928
@@ -2201,7 +2201,7 @@ menu_help_callback (char *help_string, int pane, int item)
2201 Fcons (pane_name, 2201 Fcons (pane_name,
2202 Fcons (make_number (pane), Qnil))); 2202 Fcons (make_number (pane), Qnil)));
2203 show_help_echo (help_string ? build_string (help_string) : Qnil, 2203 show_help_echo (help_string ? build_string (help_string) : Qnil,
2204 Qnil, menu_object, make_number (item), 1); 2204 Qnil, menu_object, make_number (item));
2205} 2205}
2206 2206
2207static Lisp_Object 2207static Lisp_Object
diff --git a/src/xml.c b/src/xml.c
index 12ef14e6b9f..d8e6f8c3faa 100644
--- a/src/xml.c
+++ b/src/xml.c
@@ -28,7 +28,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
28#include "lisp.h" 28#include "lisp.h"
29#include "buffer.h" 29#include "buffer.h"
30 30
31Lisp_Object make_dom (xmlNode *node) 31static Lisp_Object
32make_dom (xmlNode *node)
32{ 33{
33 if (node->type == XML_ELEMENT_NODE) 34 if (node->type == XML_ELEMENT_NODE)
34 { 35 {
diff --git a/src/xselect.c b/src/xselect.c
index 5254fa96838..451b2a0b13f 100644
--- a/src/xselect.c
+++ b/src/xselect.c
@@ -2190,7 +2190,8 @@ and t is the same as `SECONDARY'. */)
2190***********************************************************************/ 2190***********************************************************************/
2191/* Check that lisp values are of correct type for x_fill_property_data. 2191/* Check that lisp values are of correct type for x_fill_property_data.
2192 That is, number, string or a cons with two numbers (low and high 16 2192 That is, number, string or a cons with two numbers (low and high 16
2193 bit parts of a 32 bit number). */ 2193 bit parts of a 32 bit number). Return the number of items in DATA,
2194 or -1 if there is an error. */
2194 2195
2195int 2196int
2196x_check_property_data (Lisp_Object data) 2197x_check_property_data (Lisp_Object data)
@@ -2198,15 +2199,16 @@ x_check_property_data (Lisp_Object data)
2198 Lisp_Object iter; 2199 Lisp_Object iter;
2199 int size = 0; 2200 int size = 0;
2200 2201
2201 for (iter = data; CONSP (iter) && size != -1; iter = XCDR (iter), ++size) 2202 for (iter = data; CONSP (iter); iter = XCDR (iter))
2202 { 2203 {
2203 Lisp_Object o = XCAR (iter); 2204 Lisp_Object o = XCAR (iter);
2204 2205
2205 if (! NUMBERP (o) && ! STRINGP (o) && ! CONSP (o)) 2206 if (! NUMBERP (o) && ! STRINGP (o) && ! CONSP (o))
2206 size = -1; 2207 return -1;
2207 else if (CONSP (o) && 2208 else if (CONSP (o) &&
2208 (! NUMBERP (XCAR (o)) || ! NUMBERP (XCDR (o)))) 2209 (! NUMBERP (XCAR (o)) || ! NUMBERP (XCDR (o))))
2209 size = -1; 2210 return -1;
2211 size++;
2210 } 2212 }
2211 2213
2212 return size; 2214 return size;
diff --git a/src/xterm.c b/src/xterm.c
index fd7ffd68e62..dc1fd3cbbd1 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -349,7 +349,7 @@ static int handle_one_xevent (struct x_display_info *, XEvent *,
349 int *, struct input_event *); 349 int *, struct input_event *);
350/* Don't declare this NO_RETURN because we want no 350/* Don't declare this NO_RETURN because we want no
351 interference with debugging failing X calls. */ 351 interference with debugging failing X calls. */
352static SIGTYPE x_connection_closed (Display *, const char *); 352static void x_connection_closed (Display *, const char *);
353 353
354 354
355/* Flush display of frame F, or of all frames if F is null. */ 355/* Flush display of frame F, or of all frames if F is null. */
@@ -2928,10 +2928,14 @@ x_clear_frame (struct frame *f)
2928 /* We don't set the output cursor here because there will always 2928 /* We don't set the output cursor here because there will always
2929 follow an explicit cursor_to. */ 2929 follow an explicit cursor_to. */
2930 BLOCK_INPUT; 2930 BLOCK_INPUT;
2931 XClearWindow (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f));
2932 2931
2933 /* We have to clear the scroll bars, too. If we have changed 2932 /* The following calls have been commented out because they do not
2934 colors or something like that, then they should be notified. */ 2933 seem to accomplish anything, apart from causing flickering during
2934 window resize. */
2935 /* XClearWindow (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f)); */
2936
2937 /* We have to clear the scroll bars. If we have changed colors or
2938 something like that, then they should be notified. */
2935 x_scroll_bar_clear (f); 2939 x_scroll_bar_clear (f);
2936 2940
2937#if defined (USE_GTK) && defined (USE_TOOLKIT_SCROLL_BARS) 2941#if defined (USE_GTK) && defined (USE_TOOLKIT_SCROLL_BARS)
@@ -7646,7 +7650,7 @@ x_trace_wire (void)
7646 SIGPIPE will fail, causing Xlib to invoke the X IO error handler, 7650 SIGPIPE will fail, causing Xlib to invoke the X IO error handler,
7647 which will do the appropriate cleanup for us. */ 7651 which will do the appropriate cleanup for us. */
7648 7652
7649static SIGTYPE 7653static void
7650x_connection_signal (int signalnum) /* If we don't have an argument, */ 7654x_connection_signal (int signalnum) /* If we don't have an argument, */
7651 /* some compilers complain in signal calls. */ 7655 /* some compilers complain in signal calls. */
7652{ 7656{
@@ -7669,7 +7673,7 @@ static char *error_msg;
7669/* Handle the loss of connection to display DPY. ERROR_MESSAGE is 7673/* Handle the loss of connection to display DPY. ERROR_MESSAGE is
7670 the text of an error message that lead to the connection loss. */ 7674 the text of an error message that lead to the connection loss. */
7671 7675
7672static SIGTYPE 7676static void
7673x_connection_closed (Display *dpy, const char *error_message) 7677x_connection_closed (Display *dpy, const char *error_message)
7674{ 7678{
7675 struct x_display_info *dpyinfo = x_display_info_for_display (dpy); 7679 struct x_display_info *dpyinfo = x_display_info_for_display (dpy);
@@ -9117,7 +9121,7 @@ x_make_frame_visible (struct frame *f)
9117 unknown reason, the call to XtMapWidget is completely ignored. 9121 unknown reason, the call to XtMapWidget is completely ignored.
9118 Mapping the widget a second time works. */ 9122 Mapping the widget a second time works. */
9119 9123
9120 if (!FRAME_VISIBLE_P (f) && --retry_count > 0) 9124 if (!FRAME_VISIBLE_P (f) && --retry_count != 0)
9121 goto retry; 9125 goto retry;
9122 } 9126 }
9123} 9127}
@@ -9722,7 +9726,7 @@ same_x_server (const char *name1, const char *name2)
9722 for (; *name1 != '\0' && *name1 == *name2; name1++, name2++) 9726 for (; *name1 != '\0' && *name1 == *name2; name1++, name2++)
9723 { 9727 {
9724 if (*name1 == ':') 9728 if (*name1 == ':')
9725 seen_colon++; 9729 seen_colon = 1;
9726 if (seen_colon && *name1 == '.') 9730 if (seen_colon && *name1 == '.')
9727 return 1; 9731 return 1;
9728 } 9732 }