aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKenichi Handa2012-10-06 21:55:09 +0900
committerKenichi Handa2012-10-06 21:55:09 +0900
commit16ddec7e9e6adcf615db097d9627d490ca29208c (patch)
tree1c16b9565c9cca81ec8f5b10f0f4110340d4654a /src
parent2b89bca49d55cec1a004353354a76de2972c68f3 (diff)
parentd5acb99a199d83cde1a43482709c3e9d4ec34b2f (diff)
downloademacs-16ddec7e9e6adcf615db097d9627d490ca29208c.tar.gz
emacs-16ddec7e9e6adcf615db097d9627d490ca29208c.zip
merge trunk
Diffstat (limited to 'src')
-rw-r--r--src/.gdbinit8
-rw-r--r--src/ChangeLog384
-rw-r--r--src/alloc.c29
-rw-r--r--src/atimer.c6
-rw-r--r--src/bidi.c68
-rw-r--r--src/buffer.c106
-rw-r--r--src/category.c2
-rw-r--r--src/charset.c2
-rw-r--r--src/coding.c10
-rw-r--r--src/coding.h6
-rw-r--r--src/dispextern.h2
-rw-r--r--src/dispnew.c14
-rw-r--r--src/emacs.c18
-rw-r--r--src/eval.c4
-rw-r--r--src/fileio.c2
-rw-r--r--src/fns.c10
-rw-r--r--src/frame.c18
-rw-r--r--src/gmalloc.c8
-rw-r--r--src/image.c4
-rw-r--r--src/intervals.c14
-rw-r--r--src/keyboard.c38
-rw-r--r--src/lisp.h2
-rw-r--r--src/lread.c4
-rw-r--r--src/makefile.w32-in8
-rw-r--r--src/marker.c6
-rw-r--r--src/minibuf.c2
-rw-r--r--src/nsterm.m3
-rw-r--r--src/process.c34
-rw-r--r--src/profiler.c86
-rw-r--r--src/ralloc.c16
-rw-r--r--src/syntax.c4
-rw-r--r--src/sysdep.c32
-rw-r--r--src/syssignal.h12
-rw-r--r--src/terminal.c2
-rw-r--r--src/textprop.c4
-rw-r--r--src/unexmacosx.c2
-rw-r--r--src/unexw32.c46
-rw-r--r--src/vm-limit.c12
-rw-r--r--src/w32.c88
-rw-r--r--src/w32.h3
-rw-r--r--src/w32fns.c89
-rw-r--r--src/w32heap.c44
-rw-r--r--src/w32heap.h12
-rw-r--r--src/w32menu.c10
-rw-r--r--src/w32proc.c555
-rw-r--r--src/w32term.c8
-rw-r--r--src/w32term.h14
-rw-r--r--src/window.c40
-rw-r--r--src/xdisp.c53
-rw-r--r--src/xfaces.c38
-rw-r--r--src/xml.c2
-rw-r--r--src/xterm.c8
52 files changed, 1453 insertions, 539 deletions
diff --git a/src/.gdbinit b/src/.gdbinit
index 7a6bfb07fed..952d7392a4c 100644
--- a/src/.gdbinit
+++ b/src/.gdbinit
@@ -1121,15 +1121,15 @@ end
1121define xbacktrace 1121define xbacktrace
1122 set $bt = backtrace_list 1122 set $bt = backtrace_list
1123 while $bt 1123 while $bt
1124 xgettype (*$bt->function) 1124 xgettype ($bt->function)
1125 if $type == Lisp_Symbol 1125 if $type == Lisp_Symbol
1126 xprintsym (*$bt->function) 1126 xprintsym ($bt->function)
1127 printf " (0x%x)\n", $bt->args 1127 printf " (0x%x)\n", $bt->args
1128 else 1128 else
1129 xgetptr *$bt->function 1129 xgetptr $bt->function
1130 printf "0x%x ", $ptr 1130 printf "0x%x ", $ptr
1131 if $type == Lisp_Vectorlike 1131 if $type == Lisp_Vectorlike
1132 xgetptr (*$bt->function) 1132 xgetptr ($bt->function)
1133 set $size = ((struct Lisp_Vector *) $ptr)->header.size 1133 set $size = ((struct Lisp_Vector *) $ptr)->header.size
1134 if ($size & PSEUDOVECTOR_FLAG) 1134 if ($size & PSEUDOVECTOR_FLAG)
1135 output (enum pvec_type) (($size & PVEC_TYPE_MASK) >> PSEUDOVECTOR_SIZE_BITS) 1135 output (enum pvec_type) (($size & PVEC_TYPE_MASK) >> PSEUDOVECTOR_SIZE_BITS)
diff --git a/src/ChangeLog b/src/ChangeLog
index 1f5ad1e6d05..956e78e6c7e 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,387 @@
12012-10-06 Paul Eggert <eggert@cs.ucla.edu>
2
3 * keyboard.c (read_char): Remove unnecessary 'volatile's and label.
4
52012-10-05 Eli Zaretskii <eliz@gnu.org>
6
7 * w32proc.c (stop_timer_thread): Fix declaration of 'err'.
8
9 * w32.c (utime): Open the file with FILE_FLAG_BACKUP_SEMANTICS, so
10 that time stamps of directories could also be changed. Don't
11 request the too broad GENERIC_WRITE, only the more restrictive
12 FILE_WRITE_ATTRIBUTES access rights.
13
14 * fileio.c (Fset_file_times): Special-case ignoring errors for
15 directories only on MSDOS, not on MS-Windows.
16
172012-10-05 Ikumi Keita <ikumi@ikumi.que.jp> (tiny change)
18
19 * minibuf.c (Fcompleting_read): Doc fix. (Bug#12555)
20
212012-10-04 Eli Zaretskii <eliz@gnu.org>
22
23 * w32.c (utime): Test for INVALID_HANDLE_VALUE, not for NULL, to
24 see whether CreateFile failed.
25
262012-10-04 Paul Eggert <eggert@cs.ucla.edu>
27
28 * profiler.c (handle_profiler_signal): Inhibit pending signals too,
29 to avoid similar races.
30 * keyboard.c (pending_signals): Now bool, not int.
31
32 Port timers to OpenBSD, plus check for timer failures.
33 OpenBSD problem reported by Han Boetes.
34 * profiler.c (setup_cpu_timer): Check for failure of timer_settime
35 and/or setitimer.
36 (Fprofiler_cpu_stop): Don't assume HAVE_SETITIMER.
37 * syssignal.h (HAVE_ITIMERSPEC): New macro. This is for platforms
38 like OpenBSD, which has timer_settime but does not declare it.
39 OpenBSD does not define SIGEV_SIGNAL, so use that when deciding
40 whether to use itimerspec-related primitives. All uses of
41 HAVE_TIMER_SETTIME replaced with HAVE_ITIMERSPEC.
42
432012-10-02 Paul Eggert <eggert@cs.ucla.edu>
44
45 * profiler.c (handle_profiler_signal): Fix a malloc race
46 that caused Emacs to hang on Fedora 17 when profiling Lisp.
47
482012-10-02 Jan Djärv <jan.h.d@swipnet.se>
49
50 * nsterm.m (windowDidEnterFullScreen): Remove fprintf.
51
522012-10-02 Eli Zaretskii <eliz@gnu.org>
53
54 * w32proc.c (sys_wait): Declare 'signame' 'const char *', to be
55 consistent with the change in return value of 'safe_strsignal'.
56
572012-10-02 Paul Eggert <eggert@cs.ucla.edu>
58
59 Prefer plain 'static' to 'static inline' (Bug#12541).
60 * bidi.c (bidi_get_type, bidi_check_type, bidi_get_category)
61 (bidi_set_sor_type, bidi_push_embedding_level)
62 (bidi_pop_embedding_level, bidi_remember_char, bidi_copy_it)
63 (bidi_cache_reset, bidi_cache_shrink, bidi_cache_fetch_state)
64 (bidi_cache_search, bidi_cache_ensure_space)
65 (bidi_cache_iterator_state, bidi_cache_find)
66 (bidi_peek_at_next_level, bidi_set_paragraph_end)
67 (bidi_count_bytes, bidi_char_at_pos, bidi_fetch_char)
68 (bidi_explicit_dir_char, bidi_resolve_neutral_1):
69 Now 'static', not 'static inline'.
70
71 Count overruns when profiling; change units to ns.
72 * profiler.c (handle_profiler_signal): Count sampling intervals, not ms.
73 Give extra weight to samples after overruns, to attempt to count
74 the time more accurately.
75 (setup_cpu_timer): Change sampling interval units from ms to ns, since
76 the underlying primitives nominally do ns.
77 (Fprofiler_cpu_start): Document the change. Mention that
78 the sampling intervals are only approximate.
79
802012-10-02 Stefan Monnier <monnier@iro.umontreal.ca>
81
82 * frame.c (Fmake_terminal_frame): Prefer safer CONSP over !NILP.
83
84 * coding.h (ENCODE_FILE, DECODE_FILE, DECODE_SYSTEM): Remove special
85 case for the special 0 coding-system.
86
87 * buffer.c (Fset_buffer_multibyte): Signal an error instead of widening.
88 (Fmake_overlay): Remove redundant tests.
89 (fix_start_end_in_overlays): Remove redundant recentering.
90
912012-10-02 Juanma Barranquero <lekktu@gmail.com>
92
93 * makefile.w32-in ($(BLD)/alloc.$(O), $(BLD)/gmalloc.$(O)):
94 Update dependencies.
95
962012-10-01 Paul Eggert <eggert@cs.ucla.edu>
97
98 Fix a malloc race condition involving strsignal.
99 A signal can arrive in the middle of a malloc, and Emacs's signal
100 handler can invoke strsignal, which can invoke malloc, which is
101 not portable. This race condition bug makes Emacs hang on GNU/Linux.
102 Fix it by altering the signal handler so that it does not invoke
103 strsignal.
104 * emacs.c (shut_down_emacs): Use safe_strsignal, not strsignal.
105 * process.c (status_message): Use const pointer, in case strsignal
106 is #defined to safe_strsignal.
107 * sysdep.c (sys_siglist, init_signals): Always define and
108 initialize a substitute sys_siglist if the system does not define
109 one, even if HAVE_STRSIGNAL.
110 (safe_strsignal): Rename from strsignal. Always define,
111 using sys_siglist. Return a const pointer.
112 * syssignal.h (safe_strsignal): New decl.
113 (strsignal) [!HAVE_STRSIGNAL]: Define in terms of safe_strsignal.
114
1152012-10-01 Eli Zaretskii <eliz@gnu.org>
116
117 * w32proc.c (timer_loop): Fix code that waits for timer
118 expiration, to avoid high CPU usage.
119
1202012-10-01 Stefan Monnier <monnier@iro.umontreal.ca>
121
122 * fns.c (check_hash_table, get_key_arg, maybe_resize_hash_table)
123 (sweep_weak_table): Remove redundant prototypes.
124
1252012-10-01 Fabrice Popineau <fabrice.popineau@gmail.com>
126
127 * emacs.c: Move the inclusion of TERM_HEADER after including
128 windows.h on WINDOWSNT. This avoids compilation problems with
129 MSVC.
130
1312012-10-01 Eli Zaretskii <eliz@gnu.org>
132
133 * unexw32.c (OFFSET_TO_RVA, RVA_TO_OFFSET)
134 (RVA_TO_SECTION_OFFSET): Encode all macro arguments in parentheses.
135 (RVA_TO_PTR): Cast the result of RVA_TO_OFFSET to 'unsigned char *',
136 as the previous version used 'void *'.
137
138 * ralloc.c (ROUNDUP): Fix last change.
139 (MEM_ROUNDUP): Don't cast MEM_ALIGN, it is already of type
140 'size_t'.
141
142 * w32proc.c <disable_itimers>: New static flag.
143 (init_timers): Initialize it to zero, after creating the critical
144 sections used by the timer threads.
145 (term_timers): Set to 1 before deleting the critical sections.
146 (getitimer, setitimer): If disable_itimers is non-zero, return an
147 error indication without doing anything. Reported by Fabrice
148 Popineau <fabrice.popineau@supelec.fr> as part of bug#12544.
149 (alarm) [HAVE_SETITIMER]: Be more conformant to the expected
150 return results.
151 [!HAVE_SETITIMER]: Behave as the previous version that didn't
152 support timers.
153
154 * emacs.c (shut_down_emacs) [WINDOWSNT]: Move the call to
155 term_ntproc after all the other bookkeeping, to get timers working
156 as long as possible.
157
1582012-10-01 Paul Eggert <eggert@cs.ucla.edu>
159
160 * xdisp.c (syms_of_xdisp): Default message-log-max to 1000, not 100.
161 Suggested by Juri Linkov in
162 <http://lists.gnu.org/archive/html/emacs-devel/2012-09/msg00821.html>.
163
164 Prefer plain 'static' to 'static inline' (Bug#12541).
165 With static functions, modern compilers inline pretty well by
166 themselves; advice from programmers often hurts as much as it helps.
167 On my host (x86-64, Fedora 17, GCC 4.7.2, default 'configure'),
168 this change shrinks the text size of the Emacs executable by 1.1%
169 without affecting CPU significantly in my benchmark.
170 * alloc.c (mem_find, live_string_p, live_cons_p, live_symbol_p)
171 (live_float_p, live_misc_p, live_vector_p, live_buffer_p)
172 (mark_maybe_object, mark_maybe_pointer, bounded_number):
173 * buffer.c (bset_abbrev_mode, bset_abbrev_table)
174 (bset_auto_fill_function, bset_auto_save_file_format)
175 (bset_auto_save_file_name, bset_backed_up, bset_begv_marker)
176 (bset_bidi_display_reordering, bset_buffer_file_coding_system)
177 (bset_cache_long_line_scans, bset_case_fold_search)
178 (bset_ctl_arrow, bset_cursor_in_non_selected_windows)
179 (bset_cursor_type, bset_display_table, bset_extra_line_spacing)
180 (bset_file_format, bset_file_truename, bset_fringe_cursor_alist)
181 (bset_fringe_indicator_alist, bset_fringes_outside_margins)
182 (bset_header_line_format, bset_indicate_buffer_boundaries)
183 (bset_indicate_empty_lines, bset_invisibility_spec)
184 (bset_left_fringe_width, bset_major_mode, bset_mark)
185 (bset_minor_modes, bset_mode_line_format, bset_mode_name)
186 (bset_name, bset_overwrite_mode, bset_pt_marker)
187 (bset_right_fringe_width, bset_save_length)
188 (bset_scroll_bar_width, bset_scroll_down_aggressively)
189 (bset_scroll_up_aggressively, bset_selective_display)
190 (bset_selective_display_ellipses, bset_vertical_scroll_bar_type)
191 (bset_word_wrap, bset_zv_marker, set_buffer_overlays_before)
192 (set_buffer_overlays_after):
193 * category.c (bset_category_table):
194 * charset.c (read_hex):
195 * coding.c (produce_composition, produce_charset)
196 (handle_composition_annotation, handle_charset_annotation)
197 (char_encodable_p):
198 * dispnew.c (swap_glyph_pointers, copy_row_except_pointers)
199 (assign_row, set_frame_matrix_frame, make_current)
200 (add_row_entry):
201 * eval.c (set_specpdl_symbol, set_specpdl_old_value):
202 * fns.c (maybe_resize_hash_table):
203 * frame.c (fset_buffer_predicate, fset_minibuffer_window):
204 * gmalloc.c (register_heapinfo):
205 * image.c (lookup_image_type):
206 * intervals.c (set_interval_object, set_interval_left)
207 (set_interval_right, copy_interval_parent, rotate_right)
208 (rotate_left, balance_possible_root_interval):
209 * keyboard.c (kset_echo_string, kset_kbd_queue)
210 (kset_keyboard_translate_table, kset_last_prefix_arg)
211 (kset_last_repeatable_command, kset_local_function_key_map)
212 (kset_overriding_terminal_local_map, kset_real_last_command)
213 (kset_system_key_syms, clear_event, set_prop):
214 * lread.c (digit_to_number):
215 * marker.c (attach_marker, live_buffer, set_marker_internal):
216 * nsterm.m (ns_compute_glyph_string_overhangs):
217 * process.c (pset_buffer, pset_command)
218 (pset_decode_coding_system, pset_decoding_buf)
219 (pset_encode_coding_system, pset_encoding_buf, pset_filter)
220 (pset_log, pset_mark, pset_name, pset_plist, pset_sentinel)
221 (pset_status, pset_tty_name, pset_type, pset_write_queue):
222 * syntax.c (bset_syntax_table, dec_bytepos):
223 * terminal.c (tset_param_alist):
224 * textprop.c (interval_has_some_properties)
225 (interval_has_some_properties_list):
226 * window.c (wset_combination_limit, wset_dedicated)
227 (wset_display_table, wset_hchild, wset_left_fringe_width)
228 (wset_left_margin_cols, wset_new_normal, wset_new_total)
229 (wset_normal_cols, wset_normal_lines, wset_parent, wset_pointm)
230 (wset_right_fringe_width, wset_right_margin_cols)
231 (wset_scroll_bar_width, wset_start, wset_temslot, wset_vchild)
232 (wset_vertical_scroll_bar_type, wset_window_parameters):
233 * xdisp.c (wset_base_line_number, wset_base_line_pos)
234 (wset_column_number_displayed, wset_region_showing)
235 (window_box_edges, run_window_scroll_functions)
236 (append_glyph_string_lists, prepend_glyph_string_lists)
237 (append_glyph_string, set_glyph_string_background_width)
238 (append_glyph, append_composite_glyph)
239 (take_vertical_position_into_account):
240 * xfaces.c (x_create_gc, x_free_gc, merge_face_vectors)
241 (face_attr_equal_p, lface_equal_p, hash_string_case_insensitive)
242 (lface_hash, lface_same_font_attributes_p, lookup_face):
243 * xml.c (libxml2_loaded_p):
244 * xterm.c (x_set_mode_line_face_gc, x_set_glyph_string_gc)
245 (x_set_glyph_string_clipping, x_clear_glyph_string_rect):
246 Now 'static', not 'static inline'.
247
248 * bidi.c: Tune.
249 (bidi_copy_it): Do the whole copy with a single memcpy.
250 (bidi_char_at_pos): Merge the two STRING_CHAR calls into one.
251
252 Revert the FOLLOW-SYMLINKS change for file-attributes.
253 Doing it right would require several changes to Tramp, and there's
254 not enough time to get that tested before the freeze today.
255 * dired.c (directory_files_internal, Ffile_attributes):
256 Undo last change.
257
258 * frame.c (x_report_frame_params): Port better to wider ints.
259 Do not assume that EMACS_UINT is the same width as uprintmax_t,
260 or that pointers can be printed in 15 decimal digits.
261 Avoid GCC warnings if EMACS_UINT is wider than a pointer.
262
2632012-09-30 Fabrice Popineau <fabrice.popineau@supelec.fr>
264
265 Support x64 build on MS-Windows.
266 * w32term.h (SCROLL_BAR_PACK, SCROLL_BAR_UNPACK): Define for x64.
267 (SET_SCROLL_BAR_W32_WINDOW): Cast ID to intptr_t, for
268 compatibility with x64.
269 (x_get_focus_frame): Add prototype.
270
271 * w32term.c (w32_draw_underwave): Don't use GCC extensions for
272 defining an XRectangle structure.
273
274 * w32proc.c (RVA_TO_PTR, w32_executable_type): Fix pointer
275 arithmetics for compatibility with x64.
276
277 * w32menu.c (add_menu_item): Use UINT_PTR instead of UINT, for
278 compatibility with x64.
279
280 * w32heap.h: Adjust prototypes and declarations.
281
282 * w32heap.c (RVA_TO_PTR, allocate_heap, sbrk, init_heap)
283 (round_heap): Use DWORD_PTR, ptrdiff_t and size_t instead of
284 DWORD, long, and unsigned long, for compatibility with x64.
285 (allocate_heap) [_WIN64]: Reserve 32GB of memory.
286 (sbrk): Argument is now of type ptrdiff_t.
287
288 * w32fns.c (HMONITOR): Condition declaration on _WIN32_WINNT being
289 less than 0x0500.
290 (w32_msg_pump): Use WPARAM type for 'result'.
291
292 * w32.c (init_environment, get_emacs_configuration): Support AMD64
293 architecture.
294 (init_ntproc): Cast arguments of _open_osfhandle to intptr_t, for
295 compatibility with x64.
296
297 * vm-limit.c (lim_data): Now size_t.
298 (check_memory_limits): Adjust prototypes of real_morecore and
299 __morecore to receive argument of type ptrdiff_t. Use size_t for
300 five_percent and data_size.
301
302 * unexw32.c: Use DWORD_PTR instead of DWORD for file-scope
303 variables, for compatibility with x64.
304 (rva_to_section, offset_to_section, relocate_offset)
305 (OFFSET_TO_RVA, RVA_TO_OFFSET, RVA_TO_SECTION_OFFSET)
306 (PTR_TO_RVA, RVA_TO_PTR, OFFSET_TO_PTR, get_section_info)
307 (copy_executable_and_dump_data): Use DWORD_PTR instead of DWORD
308 for compatibility with x64.
309
310 * sysdep.c (STDERR_FILENO): Define if not already defined.
311
312 * ralloc.c (real_morecore): Argument type is now ptrdiff_t.
313 (__morecore): Argument type is now ptrdiff_t.
314 (ROUNDUP, MEM_ROUNDUP): Use size_t instead of 'unsigned long'.
315 (relinquish): Use ptrdiff_t type for 'excess'.
316 (r_alloc_sbrk): Argument type is now ptrdiff_t.
317
318 * makefile.w32-in (HEAPSIZE): Get value from EMACS_HEAPSIZE.
319 (bootstrap-temacs-CMD, bootstrap-temacs-SH): Use $(EMACS_PURESIZE)
320 instead of a literal number.
321
322 * gmalloc.c [WINDOWSNT]: Include w32heap.h.
323 (min): Define only if not already defined.
324
325 * frame.c (x_report_frame_params): Use EMACS_UINT for the return
326 value of FRAME_X_WINDOW, to fit a 64-bit pointer on 64-bit Windows
327 hosts.
328
329 * image.c (x_bitmap_pixmap): Return ptrdiff_t, not int, since
330 'bitmaps' is a pointer.
331
332 * dispextern.h (x_bitmap_pixmap): Adjust prototype.
333
334 * alloc.c (gdb_make_enums_visible): Now conditional on __GNUC__.
335
3362012-09-30 Paul Eggert <eggert@cs.ucla.edu>
337
338 file-attributes has a new optional arg FOLLOW-SYMLINKS.
339 * dired.c (directory_files_internal, Ffile_attributes):
340 New arg follow_symlinks. All uses changed.
341
3422012-09-30 Stefan Monnier <monnier@iro.umontreal.ca>
343
344 * .gdbinit (xbacktrace): Adjust to recent "struct backtrace" change.
345
3462012-09-30 Eli Zaretskii <eliz@gnu.org>
347
348 Support atimers and CPU profiler via profile.c on MS-Windows.
349 * w32proc.c (sig_mask, crit_sig): New static variables.
350 (sys_signal): Support SIGALRM and SIGPROF.
351 (sigemptyset, sigaddset, sigfillset, sigprocmask)
352 (pthread_sigmask, setpgrp): Move here from w32.c. sigaddset,
353 sigfillset, and sigprocmask are no longer no-ops.
354 (sigismember): New function.
355 (struct itimer_data): New definition.
356 (ticks_now, real_itimer, prof_itimer, clocks_min, crit_real)
357 (crit_prof): New static variables.
358 (MAX_SINGLE_SLEEP): New definition.
359 (timer_loop, stop_timer_thread, term_timers, init_timers)
360 (start_timer_thread, getitimer, setitimer): New functions.
361 (alarm): No longer a no-op, calls setitimer.
362
363 * w32.c (term_ntproc): Call term_timers.
364 (init_ntproc): Make sure all signals are unblocked at startup, to
365 erase any traces of dumping. Call init_timers.
366
367 * w32fns.c (hourglass_timer, HOURGLASS_ID): Remove.
368 Windows-specific code to display the hourglass mouse pointer is no
369 longer used.
370 (w32_wnd_proc): Remove code that handled the WM_TIMER message due
371 to hourglass timer expiration.
372 (start_hourglass, cancel_hourglass, DEFAULT_HOURGLASS_DELAY):
373 Remove, no longer used.
374 (w32_note_current_window, show_hourglass, hide_hourglass):
375 New functions, in support of hourglass cursor display similar to other
376 window systems.
377 (syms_of_w32fns): Don't initialize hourglass_timer.
378
379 * xdisp.c (start_hourglass, cancel_hourglass): Now used on
380 WINDOWSNT as well.
381 (start_hourglass) [WINDOWSNT]: Call w32_note_current_window.
382
383 * w32.h (init_timers, term_timers): Add prototypes.
384
12012-09-30 Kenichi Handa <handa@gnu.org> 3852012-09-30 Kenichi Handa <handa@gnu.org>
2 386
3 * coding.c (decode_coding_ccl, encode_coding_ccl): Pay attention 387 * coding.c (decode_coding_ccl, encode_coding_ccl): Pay attention
diff --git a/src/alloc.c b/src/alloc.c
index df166b4924a..3ed8cc2d990 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -74,6 +74,7 @@ extern void *sbrk ();
74#endif 74#endif
75#ifdef WINDOWSNT 75#ifdef WINDOWSNT
76#include "w32.h" 76#include "w32.h"
77#include "w32heap.h" /* for sbrk */
77#endif 78#endif
78 79
79#ifdef DOUG_LEA_MALLOC 80#ifdef DOUG_LEA_MALLOC
@@ -354,7 +355,7 @@ static void mem_rotate_left (struct mem_node *);
354static void mem_rotate_right (struct mem_node *); 355static void mem_rotate_right (struct mem_node *);
355static void mem_delete (struct mem_node *); 356static void mem_delete (struct mem_node *);
356static void mem_delete_fixup (struct mem_node *); 357static void mem_delete_fixup (struct mem_node *);
357static inline struct mem_node *mem_find (void *); 358static struct mem_node *mem_find (void *);
358#endif 359#endif
359 360
360 361
@@ -3549,7 +3550,7 @@ mem_init (void)
3549/* Value is a pointer to the mem_node containing START. Value is 3550/* Value is a pointer to the mem_node containing START. Value is
3550 MEM_NIL if there is no node in the tree containing START. */ 3551 MEM_NIL if there is no node in the tree containing START. */
3551 3552
3552static inline struct mem_node * 3553static struct mem_node *
3553mem_find (void *start) 3554mem_find (void *start)
3554{ 3555{
3555 struct mem_node *p; 3556 struct mem_node *p;
@@ -3925,7 +3926,7 @@ mem_delete_fixup (struct mem_node *x)
3925/* Value is non-zero if P is a pointer to a live Lisp string on 3926/* Value is non-zero if P is a pointer to a live Lisp string on
3926 the heap. M is a pointer to the mem_block for P. */ 3927 the heap. M is a pointer to the mem_block for P. */
3927 3928
3928static inline bool 3929static bool
3929live_string_p (struct mem_node *m, void *p) 3930live_string_p (struct mem_node *m, void *p)
3930{ 3931{
3931 if (m->type == MEM_TYPE_STRING) 3932 if (m->type == MEM_TYPE_STRING)
@@ -3948,7 +3949,7 @@ live_string_p (struct mem_node *m, void *p)
3948/* Value is non-zero if P is a pointer to a live Lisp cons on 3949/* Value is non-zero if P is a pointer to a live Lisp cons on
3949 the heap. M is a pointer to the mem_block for P. */ 3950 the heap. M is a pointer to the mem_block for P. */
3950 3951
3951static inline bool 3952static bool
3952live_cons_p (struct mem_node *m, void *p) 3953live_cons_p (struct mem_node *m, void *p)
3953{ 3954{
3954 if (m->type == MEM_TYPE_CONS) 3955 if (m->type == MEM_TYPE_CONS)
@@ -3974,7 +3975,7 @@ live_cons_p (struct mem_node *m, void *p)
3974/* Value is non-zero if P is a pointer to a live Lisp symbol on 3975/* Value is non-zero if P is a pointer to a live Lisp symbol on
3975 the heap. M is a pointer to the mem_block for P. */ 3976 the heap. M is a pointer to the mem_block for P. */
3976 3977
3977static inline bool 3978static bool
3978live_symbol_p (struct mem_node *m, void *p) 3979live_symbol_p (struct mem_node *m, void *p)
3979{ 3980{
3980 if (m->type == MEM_TYPE_SYMBOL) 3981 if (m->type == MEM_TYPE_SYMBOL)
@@ -4000,7 +4001,7 @@ live_symbol_p (struct mem_node *m, void *p)
4000/* Value is non-zero if P is a pointer to a live Lisp float on 4001/* Value is non-zero if P is a pointer to a live Lisp float on
4001 the heap. M is a pointer to the mem_block for P. */ 4002 the heap. M is a pointer to the mem_block for P. */
4002 4003
4003static inline bool 4004static bool
4004live_float_p (struct mem_node *m, void *p) 4005live_float_p (struct mem_node *m, void *p)
4005{ 4006{
4006 if (m->type == MEM_TYPE_FLOAT) 4007 if (m->type == MEM_TYPE_FLOAT)
@@ -4024,7 +4025,7 @@ live_float_p (struct mem_node *m, void *p)
4024/* Value is non-zero if P is a pointer to a live Lisp Misc on 4025/* Value is non-zero if P is a pointer to a live Lisp Misc on
4025 the heap. M is a pointer to the mem_block for P. */ 4026 the heap. M is a pointer to the mem_block for P. */
4026 4027
4027static inline bool 4028static bool
4028live_misc_p (struct mem_node *m, void *p) 4029live_misc_p (struct mem_node *m, void *p)
4029{ 4030{
4030 if (m->type == MEM_TYPE_MISC) 4031 if (m->type == MEM_TYPE_MISC)
@@ -4050,7 +4051,7 @@ live_misc_p (struct mem_node *m, void *p)
4050/* Value is non-zero if P is a pointer to a live vector-like object. 4051/* Value is non-zero if P is a pointer to a live vector-like object.
4051 M is a pointer to the mem_block for P. */ 4052 M is a pointer to the mem_block for P. */
4052 4053
4053static inline bool 4054static bool
4054live_vector_p (struct mem_node *m, void *p) 4055live_vector_p (struct mem_node *m, void *p)
4055{ 4056{
4056 if (m->type == MEM_TYPE_VECTOR_BLOCK) 4057 if (m->type == MEM_TYPE_VECTOR_BLOCK)
@@ -4086,7 +4087,7 @@ live_vector_p (struct mem_node *m, void *p)
4086/* Value is non-zero if P is a pointer to a live buffer. M is a 4087/* Value is non-zero if P is a pointer to a live buffer. M is a
4087 pointer to the mem_block for P. */ 4088 pointer to the mem_block for P. */
4088 4089
4089static inline bool 4090static bool
4090live_buffer_p (struct mem_node *m, void *p) 4091live_buffer_p (struct mem_node *m, void *p)
4091{ 4092{
4092 /* P must point to the start of the block, and the buffer 4093 /* P must point to the start of the block, and the buffer
@@ -4152,7 +4153,7 @@ DEFUN ("gc-status", Fgc_status, Sgc_status, 0, 0, "",
4152 4153
4153/* Mark OBJ if we can prove it's a Lisp_Object. */ 4154/* Mark OBJ if we can prove it's a Lisp_Object. */
4154 4155
4155static inline void 4156static void
4156mark_maybe_object (Lisp_Object obj) 4157mark_maybe_object (Lisp_Object obj)
4157{ 4158{
4158 void *po; 4159 void *po;
@@ -4221,7 +4222,7 @@ mark_maybe_object (Lisp_Object obj)
4221/* If P points to Lisp data, mark that as live if it isn't already 4222/* If P points to Lisp data, mark that as live if it isn't already
4222 marked. */ 4223 marked. */
4223 4224
4224static inline void 4225static void
4225mark_maybe_pointer (void *p) 4226mark_maybe_pointer (void *p)
4226{ 4227{
4227 struct mem_node *m; 4228 struct mem_node *m;
@@ -5051,7 +5052,7 @@ inhibit_garbage_collection (void)
5051/* Used to avoid possible overflows when 5052/* Used to avoid possible overflows when
5052 converting from C to Lisp integers. */ 5053 converting from C to Lisp integers. */
5053 5054
5054static inline Lisp_Object 5055static Lisp_Object
5055bounded_number (EMACS_INT number) 5056bounded_number (EMACS_INT number)
5056{ 5057{
5057 return make_number (min (MOST_POSITIVE_FIXNUM, number)); 5058 return make_number (min (MOST_POSITIVE_FIXNUM, number));
@@ -6607,7 +6608,8 @@ The time is in seconds as a floating point value. */);
6607/* When compiled with GCC, GDB might say "No enum type named 6608/* When compiled with GCC, GDB might say "No enum type named
6608 pvec_type" if we don't have at least one symbol with that type, and 6609 pvec_type" if we don't have at least one symbol with that type, and
6609 then xbacktrace could fail. Similarly for the other enums and 6610 then xbacktrace could fail. Similarly for the other enums and
6610 their values. */ 6611 their values. Some non-GCC compilers don't like these constructs. */
6612#ifdef __GNUC__
6611union 6613union
6612{ 6614{
6613 enum CHARTAB_SIZE_BITS CHARTAB_SIZE_BITS; 6615 enum CHARTAB_SIZE_BITS CHARTAB_SIZE_BITS;
@@ -6627,3 +6629,4 @@ union
6627 enum lsb_bits lsb_bits; 6629 enum lsb_bits lsb_bits;
6628#endif 6630#endif
6629} const EXTERNALLY_VISIBLE gdb_make_enums_visible = {0}; 6631} const EXTERNALLY_VISIBLE gdb_make_enums_visible = {0};
6632#endif /* __GNUC__ */
diff --git a/src/atimer.c b/src/atimer.c
index 048c62798ef..5752192be76 100644
--- a/src/atimer.c
+++ b/src/atimer.c
@@ -42,7 +42,7 @@ static struct atimer *atimers;
42 42
43/* The alarm timer and whether it was properly initialized, if 43/* The alarm timer and whether it was properly initialized, if
44 POSIX timers are available. */ 44 POSIX timers are available. */
45#ifdef HAVE_TIMER_SETTIME 45#ifdef HAVE_ITIMERSPEC
46static timer_t alarm_timer; 46static timer_t alarm_timer;
47static bool alarm_timer_ok; 47static bool alarm_timer_ok;
48#endif 48#endif
@@ -296,7 +296,7 @@ set_alarm (void)
296#endif 296#endif
297 EMACS_TIME now, interval; 297 EMACS_TIME now, interval;
298 298
299#ifdef HAVE_TIMER_SETTIME 299#ifdef HAVE_ITIMERSPEC
300 if (alarm_timer_ok) 300 if (alarm_timer_ok)
301 { 301 {
302 struct itimerspec ispec; 302 struct itimerspec ispec;
@@ -416,7 +416,7 @@ void
416init_atimer (void) 416init_atimer (void)
417{ 417{
418 struct sigaction action; 418 struct sigaction action;
419#ifdef HAVE_TIMER_SETTIME 419#ifdef HAVE_ITIMERSPEC
420 struct sigevent sigev; 420 struct sigevent sigev;
421 sigev.sigev_notify = SIGEV_SIGNAL; 421 sigev.sigev_notify = SIGEV_SIGNAL;
422 sigev.sigev_signo = SIGALRM; 422 sigev.sigev_signo = SIGALRM;
diff --git a/src/bidi.c b/src/bidi.c
index af0209565e2..6f3d749ef22 100644
--- a/src/bidi.c
+++ b/src/bidi.c
@@ -96,7 +96,7 @@ static Lisp_Object Qparagraph_start, Qparagraph_separate;
96 96
97/* Return the bidi type of a character CH, subject to the current 97/* Return the bidi type of a character CH, subject to the current
98 directional OVERRIDE. */ 98 directional OVERRIDE. */
99static inline bidi_type_t 99static bidi_type_t
100bidi_get_type (int ch, bidi_dir_t override) 100bidi_get_type (int ch, bidi_dir_t override)
101{ 101{
102 bidi_type_t default_type; 102 bidi_type_t default_type;
@@ -145,14 +145,14 @@ bidi_get_type (int ch, bidi_dir_t override)
145 } 145 }
146} 146}
147 147
148static inline void 148static void
149bidi_check_type (bidi_type_t type) 149bidi_check_type (bidi_type_t type)
150{ 150{
151 eassert (UNKNOWN_BT <= type && type <= NEUTRAL_ON); 151 eassert (UNKNOWN_BT <= type && type <= NEUTRAL_ON);
152} 152}
153 153
154/* Given a bidi TYPE of a character, return its category. */ 154/* Given a bidi TYPE of a character, return its category. */
155static inline bidi_category_t 155static bidi_category_t
156bidi_get_category (bidi_type_t type) 156bidi_get_category (bidi_type_t type)
157{ 157{
158 switch (type) 158 switch (type)
@@ -226,7 +226,7 @@ bidi_mirror_char (int c)
226 embedding levels on either side of the run boundary. Also, update 226 embedding levels on either side of the run boundary. Also, update
227 the saved info about previously seen characters, since that info is 227 the saved info about previously seen characters, since that info is
228 generally valid for a single level run. */ 228 generally valid for a single level run. */
229static inline void 229static void
230bidi_set_sor_type (struct bidi_it *bidi_it, int level_before, int level_after) 230bidi_set_sor_type (struct bidi_it *bidi_it, int level_before, int level_after)
231{ 231{
232 int higher_level = (level_before > level_after ? level_before : level_after); 232 int higher_level = (level_before > level_after ? level_before : level_after);
@@ -257,7 +257,7 @@ bidi_set_sor_type (struct bidi_it *bidi_it, int level_before, int level_after)
257 257
258/* Push the current embedding level and override status; reset the 258/* Push the current embedding level and override status; reset the
259 current level to LEVEL and the current override status to OVERRIDE. */ 259 current level to LEVEL and the current override status to OVERRIDE. */
260static inline void 260static void
261bidi_push_embedding_level (struct bidi_it *bidi_it, 261bidi_push_embedding_level (struct bidi_it *bidi_it,
262 int level, bidi_dir_t override) 262 int level, bidi_dir_t override)
263{ 263{
@@ -269,7 +269,7 @@ bidi_push_embedding_level (struct bidi_it *bidi_it,
269 269
270/* Pop the embedding level and directional override status from the 270/* Pop the embedding level and directional override status from the
271 stack, and return the new level. */ 271 stack, and return the new level. */
272static inline int 272static int
273bidi_pop_embedding_level (struct bidi_it *bidi_it) 273bidi_pop_embedding_level (struct bidi_it *bidi_it)
274{ 274{
275 /* UAX#9 says to ignore invalid PDFs. */ 275 /* UAX#9 says to ignore invalid PDFs. */
@@ -279,7 +279,7 @@ bidi_pop_embedding_level (struct bidi_it *bidi_it)
279} 279}
280 280
281/* Record in SAVED_INFO the information about the current character. */ 281/* Record in SAVED_INFO the information about the current character. */
282static inline void 282static void
283bidi_remember_char (struct bidi_saved_info *saved_info, 283bidi_remember_char (struct bidi_saved_info *saved_info,
284 struct bidi_it *bidi_it) 284 struct bidi_it *bidi_it)
285{ 285{
@@ -295,18 +295,14 @@ bidi_remember_char (struct bidi_saved_info *saved_info,
295 295
296/* Copy the bidi iterator from FROM to TO. To save cycles, this only 296/* Copy the bidi iterator from FROM to TO. To save cycles, this only
297 copies the part of the level stack that is actually in use. */ 297 copies the part of the level stack that is actually in use. */
298static inline void 298static void
299bidi_copy_it (struct bidi_it *to, struct bidi_it *from) 299bidi_copy_it (struct bidi_it *to, struct bidi_it *from)
300{ 300{
301 int i; 301 /* Copy everything from the start through the active part of
302 302 the level stack. */
303 /* Copy everything except the level stack and beyond. */ 303 memcpy (to, from,
304 memcpy (to, from, offsetof (struct bidi_it, level_stack[0])); 304 (offsetof (struct bidi_it, level_stack[1])
305 305 + from->stack_idx * sizeof from->level_stack[0]));
306 /* Copy the active part of the level stack. */
307 to->level_stack[0] = from->level_stack[0]; /* level zero is always in use */
308 for (i = 1; i <= from->stack_idx; i++)
309 to->level_stack[i] = from->level_stack[i];
310} 306}
311 307
312 308
@@ -344,7 +340,7 @@ enum
344 intact. This is called when the cached information is no more 340 intact. This is called when the cached information is no more
345 useful for the current iteration, e.g. when we were reseated to a 341 useful for the current iteration, e.g. when we were reseated to a
346 new position on the same object. */ 342 new position on the same object. */
347static inline void 343static void
348bidi_cache_reset (void) 344bidi_cache_reset (void)
349{ 345{
350 bidi_cache_idx = bidi_cache_start; 346 bidi_cache_idx = bidi_cache_start;
@@ -355,7 +351,7 @@ bidi_cache_reset (void)
355 iterator for reordering a buffer or a string that does not come 351 iterator for reordering a buffer or a string that does not come
356 from display properties, because that means all the previously 352 from display properties, because that means all the previously
357 cached info is of no further use. */ 353 cached info is of no further use. */
358static inline void 354static void
359bidi_cache_shrink (void) 355bidi_cache_shrink (void)
360{ 356{
361 if (bidi_cache_size > BIDI_CACHE_CHUNK) 357 if (bidi_cache_size > BIDI_CACHE_CHUNK)
@@ -366,7 +362,7 @@ bidi_cache_shrink (void)
366 bidi_cache_reset (); 362 bidi_cache_reset ();
367} 363}
368 364
369static inline void 365static void
370bidi_cache_fetch_state (ptrdiff_t idx, struct bidi_it *bidi_it) 366bidi_cache_fetch_state (ptrdiff_t idx, struct bidi_it *bidi_it)
371{ 367{
372 int current_scan_dir = bidi_it->scan_dir; 368 int current_scan_dir = bidi_it->scan_dir;
@@ -383,7 +379,7 @@ bidi_cache_fetch_state (ptrdiff_t idx, struct bidi_it *bidi_it)
383 level less or equal to LEVEL. if LEVEL is -1, disregard the 379 level less or equal to LEVEL. if LEVEL is -1, disregard the
384 resolved levels in cached states. DIR, if non-zero, means search 380 resolved levels in cached states. DIR, if non-zero, means search
385 in that direction from the last cache hit. */ 381 in that direction from the last cache hit. */
386static inline ptrdiff_t 382static ptrdiff_t
387bidi_cache_search (ptrdiff_t charpos, int level, int dir) 383bidi_cache_search (ptrdiff_t charpos, int level, int dir)
388{ 384{
389 ptrdiff_t i, i_start; 385 ptrdiff_t i, i_start;
@@ -488,7 +484,7 @@ bidi_cache_find_level_change (int level, int dir, bool before)
488 return -1; 484 return -1;
489} 485}
490 486
491static inline void 487static void
492bidi_cache_ensure_space (ptrdiff_t idx) 488bidi_cache_ensure_space (ptrdiff_t idx)
493{ 489{
494 /* Enlarge the cache as needed. */ 490 /* Enlarge the cache as needed. */
@@ -510,7 +506,7 @@ bidi_cache_ensure_space (ptrdiff_t idx)
510 } 506 }
511} 507}
512 508
513static inline void 509static void
514bidi_cache_iterator_state (struct bidi_it *bidi_it, bool resolved) 510bidi_cache_iterator_state (struct bidi_it *bidi_it, bool resolved)
515{ 511{
516 ptrdiff_t idx; 512 ptrdiff_t idx;
@@ -567,7 +563,7 @@ bidi_cache_iterator_state (struct bidi_it *bidi_it, bool resolved)
567 bidi_cache_idx = idx + 1; 563 bidi_cache_idx = idx + 1;
568} 564}
569 565
570static inline bidi_type_t 566static bidi_type_t
571bidi_cache_find (ptrdiff_t charpos, int level, struct bidi_it *bidi_it) 567bidi_cache_find (ptrdiff_t charpos, int level, struct bidi_it *bidi_it)
572{ 568{
573 ptrdiff_t i = bidi_cache_search (charpos, level, bidi_it->scan_dir); 569 ptrdiff_t i = bidi_cache_search (charpos, level, bidi_it->scan_dir);
@@ -587,7 +583,7 @@ bidi_cache_find (ptrdiff_t charpos, int level, struct bidi_it *bidi_it)
587 return UNKNOWN_BT; 583 return UNKNOWN_BT;
588} 584}
589 585
590static inline int 586static int
591bidi_peek_at_next_level (struct bidi_it *bidi_it) 587bidi_peek_at_next_level (struct bidi_it *bidi_it)
592{ 588{
593 if (bidi_cache_idx == bidi_cache_start || bidi_cache_last_idx == -1) 589 if (bidi_cache_idx == bidi_cache_start || bidi_cache_last_idx == -1)
@@ -790,7 +786,7 @@ bidi_initialize (void)
790 786
791/* Do whatever UAX#9 clause X8 says should be done at paragraph's 787/* Do whatever UAX#9 clause X8 says should be done at paragraph's
792 end. */ 788 end. */
793static inline void 789static void
794bidi_set_paragraph_end (struct bidi_it *bidi_it) 790bidi_set_paragraph_end (struct bidi_it *bidi_it)
795{ 791{
796 bidi_it->invalid_levels = 0; 792 bidi_it->invalid_levels = 0;
@@ -872,7 +868,7 @@ bidi_line_init (struct bidi_it *bidi_it)
872/* Count bytes in string S between BEG/BEGBYTE and END. BEG and END 868/* Count bytes in string S between BEG/BEGBYTE and END. BEG and END
873 are zero-based character positions in S, BEGBYTE is byte position 869 are zero-based character positions in S, BEGBYTE is byte position
874 corresponding to BEG. UNIBYTE means S is a unibyte string. */ 870 corresponding to BEG. UNIBYTE means S is a unibyte string. */
875static inline ptrdiff_t 871static ptrdiff_t
876bidi_count_bytes (const unsigned char *s, const ptrdiff_t beg, 872bidi_count_bytes (const unsigned char *s, const ptrdiff_t beg,
877 const ptrdiff_t begbyte, const ptrdiff_t end, bool unibyte) 873 const ptrdiff_t begbyte, const ptrdiff_t end, bool unibyte)
878{ 874{
@@ -896,22 +892,22 @@ bidi_count_bytes (const unsigned char *s, const ptrdiff_t beg,
896 return p - start; 892 return p - start;
897} 893}
898 894
899/* Fetch and returns the character at byte position BYTEPOS. If S is 895/* Fetch and return the character at byte position BYTEPOS. If S is
900 non-NULL, fetch the character from string S; otherwise fetch the 896 non-NULL, fetch the character from string S; otherwise fetch the
901 character from the current buffer. UNIBYTE means S is a 897 character from the current buffer. UNIBYTE means S is a
902 unibyte string. */ 898 unibyte string. */
903static inline int 899static int
904bidi_char_at_pos (ptrdiff_t bytepos, const unsigned char *s, bool unibyte) 900bidi_char_at_pos (ptrdiff_t bytepos, const unsigned char *s, bool unibyte)
905{ 901{
906 if (s) 902 if (s)
907 { 903 {
904 s += bytepos;
908 if (unibyte) 905 if (unibyte)
909 return s[bytepos]; 906 return *s;
910 else
911 return STRING_CHAR (s + bytepos);
912 } 907 }
913 else 908 else
914 return FETCH_MULTIBYTE_CHAR (bytepos); 909 s = BYTE_POS_ADDR (bytepos);
910 return STRING_CHAR (s);
915} 911}
916 912
917/* Fetch and return the character at BYTEPOS/CHARPOS. If that 913/* Fetch and return the character at BYTEPOS/CHARPOS. If that
@@ -928,7 +924,7 @@ bidi_char_at_pos (ptrdiff_t bytepos, const unsigned char *s, bool unibyte)
928 u+2029 to handle it as a paragraph separator. STRING->s is the C 924 u+2029 to handle it as a paragraph separator. STRING->s is the C
929 string to iterate, or NULL if iterating over a buffer or a Lisp 925 string to iterate, or NULL if iterating over a buffer or a Lisp
930 string; in the latter case, STRING->lstring is the Lisp string. */ 926 string; in the latter case, STRING->lstring is the Lisp string. */
931static inline int 927static int
932bidi_fetch_char (ptrdiff_t bytepos, ptrdiff_t charpos, ptrdiff_t *disp_pos, 928bidi_fetch_char (ptrdiff_t bytepos, ptrdiff_t charpos, ptrdiff_t *disp_pos,
933 int *disp_prop, struct bidi_string_data *string, 929 int *disp_prop, struct bidi_string_data *string,
934 bool frame_window_p, ptrdiff_t *ch_len, ptrdiff_t *nchars) 930 bool frame_window_p, ptrdiff_t *ch_len, ptrdiff_t *nchars)
@@ -1318,7 +1314,7 @@ bidi_paragraph_init (bidi_dir_t dir, struct bidi_it *bidi_it, bool no_default_p)
1318 The rest of this file constitutes the core of the UBA implementation. 1314 The rest of this file constitutes the core of the UBA implementation.
1319 ***********************************************************************/ 1315 ***********************************************************************/
1320 1316
1321static inline bool 1317static bool
1322bidi_explicit_dir_char (int ch) 1318bidi_explicit_dir_char (int ch)
1323{ 1319{
1324 bidi_type_t ch_type; 1320 bidi_type_t ch_type;
@@ -1841,7 +1837,7 @@ bidi_resolve_weak (struct bidi_it *bidi_it)
1841 1837
1842/* Resolve the type of a neutral character according to the type of 1838/* Resolve the type of a neutral character according to the type of
1843 surrounding strong text and the current embedding level. */ 1839 surrounding strong text and the current embedding level. */
1844static inline bidi_type_t 1840static bidi_type_t
1845bidi_resolve_neutral_1 (bidi_type_t prev_type, bidi_type_t next_type, int lev) 1841bidi_resolve_neutral_1 (bidi_type_t prev_type, bidi_type_t next_type, int lev)
1846{ 1842{
1847 /* N1: European and Arabic numbers are treated as though they were R. */ 1843 /* N1: European and Arabic numbers are treated as though they were R. */
diff --git a/src/buffer.c b/src/buffer.c
index 356a308fce6..425d05ca790 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -150,222 +150,222 @@ static void modify_overlay (struct buffer *, ptrdiff_t, ptrdiff_t);
150static Lisp_Object buffer_lisp_local_variables (struct buffer *, bool); 150static Lisp_Object buffer_lisp_local_variables (struct buffer *, bool);
151 151
152/* These setters are used only in this file, so they can be private. */ 152/* These setters are used only in this file, so they can be private. */
153static inline void 153static void
154bset_abbrev_mode (struct buffer *b, Lisp_Object val) 154bset_abbrev_mode (struct buffer *b, Lisp_Object val)
155{ 155{
156 b->INTERNAL_FIELD (abbrev_mode) = val; 156 b->INTERNAL_FIELD (abbrev_mode) = val;
157} 157}
158static inline void 158static void
159bset_abbrev_table (struct buffer *b, Lisp_Object val) 159bset_abbrev_table (struct buffer *b, Lisp_Object val)
160{ 160{
161 b->INTERNAL_FIELD (abbrev_table) = val; 161 b->INTERNAL_FIELD (abbrev_table) = val;
162} 162}
163static inline void 163static void
164bset_auto_fill_function (struct buffer *b, Lisp_Object val) 164bset_auto_fill_function (struct buffer *b, Lisp_Object val)
165{ 165{
166 b->INTERNAL_FIELD (auto_fill_function) = val; 166 b->INTERNAL_FIELD (auto_fill_function) = val;
167} 167}
168static inline void 168static void
169bset_auto_save_file_format (struct buffer *b, Lisp_Object val) 169bset_auto_save_file_format (struct buffer *b, Lisp_Object val)
170{ 170{
171 b->INTERNAL_FIELD (auto_save_file_format) = val; 171 b->INTERNAL_FIELD (auto_save_file_format) = val;
172} 172}
173static inline void 173static void
174bset_auto_save_file_name (struct buffer *b, Lisp_Object val) 174bset_auto_save_file_name (struct buffer *b, Lisp_Object val)
175{ 175{
176 b->INTERNAL_FIELD (auto_save_file_name) = val; 176 b->INTERNAL_FIELD (auto_save_file_name) = val;
177} 177}
178static inline void 178static void
179bset_backed_up (struct buffer *b, Lisp_Object val) 179bset_backed_up (struct buffer *b, Lisp_Object val)
180{ 180{
181 b->INTERNAL_FIELD (backed_up) = val; 181 b->INTERNAL_FIELD (backed_up) = val;
182} 182}
183static inline void 183static void
184bset_begv_marker (struct buffer *b, Lisp_Object val) 184bset_begv_marker (struct buffer *b, Lisp_Object val)
185{ 185{
186 b->INTERNAL_FIELD (begv_marker) = val; 186 b->INTERNAL_FIELD (begv_marker) = val;
187} 187}
188static inline void 188static void
189bset_bidi_display_reordering (struct buffer *b, Lisp_Object val) 189bset_bidi_display_reordering (struct buffer *b, Lisp_Object val)
190{ 190{
191 b->INTERNAL_FIELD (bidi_display_reordering) = val; 191 b->INTERNAL_FIELD (bidi_display_reordering) = val;
192} 192}
193static inline void 193static void
194bset_buffer_file_coding_system (struct buffer *b, Lisp_Object val) 194bset_buffer_file_coding_system (struct buffer *b, Lisp_Object val)
195{ 195{
196 b->INTERNAL_FIELD (buffer_file_coding_system) = val; 196 b->INTERNAL_FIELD (buffer_file_coding_system) = val;
197} 197}
198static inline void 198static void
199bset_cache_long_line_scans (struct buffer *b, Lisp_Object val) 199bset_cache_long_line_scans (struct buffer *b, Lisp_Object val)
200{ 200{
201 b->INTERNAL_FIELD (cache_long_line_scans) = val; 201 b->INTERNAL_FIELD (cache_long_line_scans) = val;
202} 202}
203static inline void 203static void
204bset_case_fold_search (struct buffer *b, Lisp_Object val) 204bset_case_fold_search (struct buffer *b, Lisp_Object val)
205{ 205{
206 b->INTERNAL_FIELD (case_fold_search) = val; 206 b->INTERNAL_FIELD (case_fold_search) = val;
207} 207}
208static inline void 208static void
209bset_ctl_arrow (struct buffer *b, Lisp_Object val) 209bset_ctl_arrow (struct buffer *b, Lisp_Object val)
210{ 210{
211 b->INTERNAL_FIELD (ctl_arrow) = val; 211 b->INTERNAL_FIELD (ctl_arrow) = val;
212} 212}
213static inline void 213static void
214bset_cursor_in_non_selected_windows (struct buffer *b, Lisp_Object val) 214bset_cursor_in_non_selected_windows (struct buffer *b, Lisp_Object val)
215{ 215{
216 b->INTERNAL_FIELD (cursor_in_non_selected_windows) = val; 216 b->INTERNAL_FIELD (cursor_in_non_selected_windows) = val;
217} 217}
218static inline void 218static void
219bset_cursor_type (struct buffer *b, Lisp_Object val) 219bset_cursor_type (struct buffer *b, Lisp_Object val)
220{ 220{
221 b->INTERNAL_FIELD (cursor_type) = val; 221 b->INTERNAL_FIELD (cursor_type) = val;
222} 222}
223static inline void 223static void
224bset_display_table (struct buffer *b, Lisp_Object val) 224bset_display_table (struct buffer *b, Lisp_Object val)
225{ 225{
226 b->INTERNAL_FIELD (display_table) = val; 226 b->INTERNAL_FIELD (display_table) = val;
227} 227}
228static inline void 228static void
229bset_extra_line_spacing (struct buffer *b, Lisp_Object val) 229bset_extra_line_spacing (struct buffer *b, Lisp_Object val)
230{ 230{
231 b->INTERNAL_FIELD (extra_line_spacing) = val; 231 b->INTERNAL_FIELD (extra_line_spacing) = val;
232} 232}
233static inline void 233static void
234bset_file_format (struct buffer *b, Lisp_Object val) 234bset_file_format (struct buffer *b, Lisp_Object val)
235{ 235{
236 b->INTERNAL_FIELD (file_format) = val; 236 b->INTERNAL_FIELD (file_format) = val;
237} 237}
238static inline void 238static void
239bset_file_truename (struct buffer *b, Lisp_Object val) 239bset_file_truename (struct buffer *b, Lisp_Object val)
240{ 240{
241 b->INTERNAL_FIELD (file_truename) = val; 241 b->INTERNAL_FIELD (file_truename) = val;
242} 242}
243static inline void 243static void
244bset_fringe_cursor_alist (struct buffer *b, Lisp_Object val) 244bset_fringe_cursor_alist (struct buffer *b, Lisp_Object val)
245{ 245{
246 b->INTERNAL_FIELD (fringe_cursor_alist) = val; 246 b->INTERNAL_FIELD (fringe_cursor_alist) = val;
247} 247}
248static inline void 248static void
249bset_fringe_indicator_alist (struct buffer *b, Lisp_Object val) 249bset_fringe_indicator_alist (struct buffer *b, Lisp_Object val)
250{ 250{
251 b->INTERNAL_FIELD (fringe_indicator_alist) = val; 251 b->INTERNAL_FIELD (fringe_indicator_alist) = val;
252} 252}
253static inline void 253static void
254bset_fringes_outside_margins (struct buffer *b, Lisp_Object val) 254bset_fringes_outside_margins (struct buffer *b, Lisp_Object val)
255{ 255{
256 b->INTERNAL_FIELD (fringes_outside_margins) = val; 256 b->INTERNAL_FIELD (fringes_outside_margins) = val;
257} 257}
258static inline void 258static void
259bset_header_line_format (struct buffer *b, Lisp_Object val) 259bset_header_line_format (struct buffer *b, Lisp_Object val)
260{ 260{
261 b->INTERNAL_FIELD (header_line_format) = val; 261 b->INTERNAL_FIELD (header_line_format) = val;
262} 262}
263static inline void 263static void
264bset_indicate_buffer_boundaries (struct buffer *b, Lisp_Object val) 264bset_indicate_buffer_boundaries (struct buffer *b, Lisp_Object val)
265{ 265{
266 b->INTERNAL_FIELD (indicate_buffer_boundaries) = val; 266 b->INTERNAL_FIELD (indicate_buffer_boundaries) = val;
267} 267}
268static inline void 268static void
269bset_indicate_empty_lines (struct buffer *b, Lisp_Object val) 269bset_indicate_empty_lines (struct buffer *b, Lisp_Object val)
270{ 270{
271 b->INTERNAL_FIELD (indicate_empty_lines) = val; 271 b->INTERNAL_FIELD (indicate_empty_lines) = val;
272} 272}
273static inline void 273static void
274bset_invisibility_spec (struct buffer *b, Lisp_Object val) 274bset_invisibility_spec (struct buffer *b, Lisp_Object val)
275{ 275{
276 b->INTERNAL_FIELD (invisibility_spec) = val; 276 b->INTERNAL_FIELD (invisibility_spec) = val;
277} 277}
278static inline void 278static void
279bset_left_fringe_width (struct buffer *b, Lisp_Object val) 279bset_left_fringe_width (struct buffer *b, Lisp_Object val)
280{ 280{
281 b->INTERNAL_FIELD (left_fringe_width) = val; 281 b->INTERNAL_FIELD (left_fringe_width) = val;
282} 282}
283static inline void 283static void
284bset_major_mode (struct buffer *b, Lisp_Object val) 284bset_major_mode (struct buffer *b, Lisp_Object val)
285{ 285{
286 b->INTERNAL_FIELD (major_mode) = val; 286 b->INTERNAL_FIELD (major_mode) = val;
287} 287}
288static inline void 288static void
289bset_mark (struct buffer *b, Lisp_Object val) 289bset_mark (struct buffer *b, Lisp_Object val)
290{ 290{
291 b->INTERNAL_FIELD (mark) = val; 291 b->INTERNAL_FIELD (mark) = val;
292} 292}
293static inline void 293static void
294bset_minor_modes (struct buffer *b, Lisp_Object val) 294bset_minor_modes (struct buffer *b, Lisp_Object val)
295{ 295{
296 b->INTERNAL_FIELD (minor_modes) = val; 296 b->INTERNAL_FIELD (minor_modes) = val;
297} 297}
298static inline void 298static void
299bset_mode_line_format (struct buffer *b, Lisp_Object val) 299bset_mode_line_format (struct buffer *b, Lisp_Object val)
300{ 300{
301 b->INTERNAL_FIELD (mode_line_format) = val; 301 b->INTERNAL_FIELD (mode_line_format) = val;
302} 302}
303static inline void 303static void
304bset_mode_name (struct buffer *b, Lisp_Object val) 304bset_mode_name (struct buffer *b, Lisp_Object val)
305{ 305{
306 b->INTERNAL_FIELD (mode_name) = val; 306 b->INTERNAL_FIELD (mode_name) = val;
307} 307}
308static inline void 308static void
309bset_name (struct buffer *b, Lisp_Object val) 309bset_name (struct buffer *b, Lisp_Object val)
310{ 310{
311 b->INTERNAL_FIELD (name) = val; 311 b->INTERNAL_FIELD (name) = val;
312} 312}
313static inline void 313static void
314bset_overwrite_mode (struct buffer *b, Lisp_Object val) 314bset_overwrite_mode (struct buffer *b, Lisp_Object val)
315{ 315{
316 b->INTERNAL_FIELD (overwrite_mode) = val; 316 b->INTERNAL_FIELD (overwrite_mode) = val;
317} 317}
318static inline void 318static void
319bset_pt_marker (struct buffer *b, Lisp_Object val) 319bset_pt_marker (struct buffer *b, Lisp_Object val)
320{ 320{
321 b->INTERNAL_FIELD (pt_marker) = val; 321 b->INTERNAL_FIELD (pt_marker) = val;
322} 322}
323static inline void 323static void
324bset_right_fringe_width (struct buffer *b, Lisp_Object val) 324bset_right_fringe_width (struct buffer *b, Lisp_Object val)
325{ 325{
326 b->INTERNAL_FIELD (right_fringe_width) = val; 326 b->INTERNAL_FIELD (right_fringe_width) = val;
327} 327}
328static inline void 328static void
329bset_save_length (struct buffer *b, Lisp_Object val) 329bset_save_length (struct buffer *b, Lisp_Object val)
330{ 330{
331 b->INTERNAL_FIELD (save_length) = val; 331 b->INTERNAL_FIELD (save_length) = val;
332} 332}
333static inline void 333static void
334bset_scroll_bar_width (struct buffer *b, Lisp_Object val) 334bset_scroll_bar_width (struct buffer *b, Lisp_Object val)
335{ 335{
336 b->INTERNAL_FIELD (scroll_bar_width) = val; 336 b->INTERNAL_FIELD (scroll_bar_width) = val;
337} 337}
338static inline void 338static void
339bset_scroll_down_aggressively (struct buffer *b, Lisp_Object val) 339bset_scroll_down_aggressively (struct buffer *b, Lisp_Object val)
340{ 340{
341 b->INTERNAL_FIELD (scroll_down_aggressively) = val; 341 b->INTERNAL_FIELD (scroll_down_aggressively) = val;
342} 342}
343static inline void 343static void
344bset_scroll_up_aggressively (struct buffer *b, Lisp_Object val) 344bset_scroll_up_aggressively (struct buffer *b, Lisp_Object val)
345{ 345{
346 b->INTERNAL_FIELD (scroll_up_aggressively) = val; 346 b->INTERNAL_FIELD (scroll_up_aggressively) = val;
347} 347}
348static inline void 348static void
349bset_selective_display (struct buffer *b, Lisp_Object val) 349bset_selective_display (struct buffer *b, Lisp_Object val)
350{ 350{
351 b->INTERNAL_FIELD (selective_display) = val; 351 b->INTERNAL_FIELD (selective_display) = val;
352} 352}
353static inline void 353static void
354bset_selective_display_ellipses (struct buffer *b, Lisp_Object val) 354bset_selective_display_ellipses (struct buffer *b, Lisp_Object val)
355{ 355{
356 b->INTERNAL_FIELD (selective_display_ellipses) = val; 356 b->INTERNAL_FIELD (selective_display_ellipses) = val;
357} 357}
358static inline void 358static void
359bset_vertical_scroll_bar_type (struct buffer *b, Lisp_Object val) 359bset_vertical_scroll_bar_type (struct buffer *b, Lisp_Object val)
360{ 360{
361 b->INTERNAL_FIELD (vertical_scroll_bar_type) = val; 361 b->INTERNAL_FIELD (vertical_scroll_bar_type) = val;
362} 362}
363static inline void 363static void
364bset_word_wrap (struct buffer *b, Lisp_Object val) 364bset_word_wrap (struct buffer *b, Lisp_Object val)
365{ 365{
366 b->INTERNAL_FIELD (word_wrap) = val; 366 b->INTERNAL_FIELD (word_wrap) = val;
367} 367}
368static inline void 368static void
369bset_zv_marker (struct buffer *b, Lisp_Object val) 369bset_zv_marker (struct buffer *b, Lisp_Object val)
370{ 370{
371 b->INTERNAL_FIELD (zv_marker) = val; 371 b->INTERNAL_FIELD (zv_marker) = val;
@@ -651,13 +651,13 @@ copy_overlays (struct buffer *b, struct Lisp_Overlay *list)
651 651
652/* Set an appropriate overlay of B. */ 652/* Set an appropriate overlay of B. */
653 653
654static inline void 654static void
655set_buffer_overlays_before (struct buffer *b, struct Lisp_Overlay *o) 655set_buffer_overlays_before (struct buffer *b, struct Lisp_Overlay *o)
656{ 656{
657 b->overlays_before = o; 657 b->overlays_before = o;
658} 658}
659 659
660static inline void 660static void
661set_buffer_overlays_after (struct buffer *b, struct Lisp_Overlay *o) 661set_buffer_overlays_after (struct buffer *b, struct Lisp_Overlay *o)
662{ 662{
663 b->overlays_after = o; 663 b->overlays_after = o;
@@ -2464,7 +2464,7 @@ current buffer is cleared. */)
2464 begv = BEGV, zv = ZV; 2464 begv = BEGV, zv = ZV;
2465 2465
2466 if (narrowed) 2466 if (narrowed)
2467 Fwiden (); 2467 error ("Changing multibyteness in a narrowed buffer");
2468 2468
2469 if (NILP (flag)) 2469 if (NILP (flag))
2470 { 2470 {
@@ -3689,7 +3689,6 @@ fix_start_end_in_overlays (register ptrdiff_t start, register ptrdiff_t end)
3689 beforep->next = current_buffer->overlays_before; 3689 beforep->next = current_buffer->overlays_before;
3690 set_buffer_overlays_before (current_buffer, before_list); 3690 set_buffer_overlays_before (current_buffer, before_list);
3691 } 3691 }
3692 recenter_overlay_lists (current_buffer, current_buffer->overlay_center);
3693 3692
3694 if (afterp) 3693 if (afterp)
3695 { 3694 {
@@ -3847,17 +3846,16 @@ for the rear of the overlay advance when text is inserted there
3847 end = OVERLAY_END (overlay); 3846 end = OVERLAY_END (overlay);
3848 if (OVERLAY_POSITION (end) < b->overlay_center) 3847 if (OVERLAY_POSITION (end) < b->overlay_center)
3849 { 3848 {
3850 if (b->overlays_after) 3849 eassert (b->overlays_after || (XOVERLAY (overlay)->next == NULL));
3851 XOVERLAY (overlay)->next = b->overlays_after; 3850 XOVERLAY (overlay)->next = b->overlays_after;
3852 set_buffer_overlays_after (b, XOVERLAY (overlay)); 3851 set_buffer_overlays_after (b, XOVERLAY (overlay));
3853 } 3852 }
3854 else 3853 else
3855 { 3854 {
3856 if (b->overlays_before) 3855 eassert (b->overlays_before || (XOVERLAY (overlay)->next == NULL));
3857 XOVERLAY (overlay)->next = b->overlays_before; 3856 XOVERLAY (overlay)->next = b->overlays_before;
3858 set_buffer_overlays_before (b, XOVERLAY (overlay)); 3857 set_buffer_overlays_before (b, XOVERLAY (overlay));
3859 } 3858 }
3860
3861 /* This puts it in the right list, and in the right order. */ 3859 /* This puts it in the right list, and in the right order. */
3862 recenter_overlay_lists (b, b->overlay_center); 3860 recenter_overlay_lists (b, b->overlay_center);
3863 3861
@@ -4141,7 +4139,7 @@ DEFUN ("overlays-at", Foverlays_at, Soverlays_at, 1, 1, 0,
4141 /* Put all the overlays we want in a vector in overlay_vec. 4139 /* Put all the overlays we want in a vector in overlay_vec.
4142 Store the length in len. */ 4140 Store the length in len. */
4143 noverlays = overlays_at (XINT (pos), 1, &overlay_vec, &len, 4141 noverlays = overlays_at (XINT (pos), 1, &overlay_vec, &len,
4144 0, 0, 0); 4142 NULL, NULL, 0);
4145 4143
4146 /* Make a list of them all. */ 4144 /* Make a list of them all. */
4147 result = Flist (noverlays, overlay_vec); 4145 result = Flist (noverlays, overlay_vec);
diff --git a/src/category.c b/src/category.c
index 01a6f54ad17..fe02303f679 100644
--- a/src/category.c
+++ b/src/category.c
@@ -40,7 +40,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
40#include "keymap.h" 40#include "keymap.h"
41 41
42/* This setter is used only in this file, so it can be private. */ 42/* This setter is used only in this file, so it can be private. */
43static inline void 43static void
44bset_category_table (struct buffer *b, Lisp_Object val) 44bset_category_table (struct buffer *b, Lisp_Object val)
45{ 45{
46 b->INTERNAL_FIELD (category_table) = val; 46 b->INTERNAL_FIELD (category_table) = val;
diff --git a/src/charset.c b/src/charset.c
index b0915ffde9c..6b999824dab 100644
--- a/src/charset.c
+++ b/src/charset.c
@@ -421,7 +421,7 @@ load_charset_map (struct charset *charset, struct charset_map_entries *entries,
421/* Read a hexadecimal number (preceded by "0x") from the file FP while 421/* Read a hexadecimal number (preceded by "0x") from the file FP while
422 paying attention to comment character '#'. */ 422 paying attention to comment character '#'. */
423 423
424static inline unsigned 424static unsigned
425read_hex (FILE *fp, bool *eof, bool *overflow) 425read_hex (FILE *fp, bool *eof, bool *overflow)
426{ 426{
427 int c; 427 int c;
diff --git a/src/coding.c b/src/coding.c
index 32d300b9923..d9606cf5710 100644
--- a/src/coding.c
+++ b/src/coding.c
@@ -6822,7 +6822,7 @@ produce_chars (struct coding_system *coding, Lisp_Object translation_table,
6822 [ -LENGTH ANNOTATION_MASK NCHARS NBYTES METHOD [ COMPONENTS... ] ] 6822 [ -LENGTH ANNOTATION_MASK NCHARS NBYTES METHOD [ COMPONENTS... ] ]
6823 */ 6823 */
6824 6824
6825static inline void 6825static void
6826produce_composition (struct coding_system *coding, int *charbuf, ptrdiff_t pos) 6826produce_composition (struct coding_system *coding, int *charbuf, ptrdiff_t pos)
6827{ 6827{
6828 int len; 6828 int len;
@@ -6866,7 +6866,7 @@ produce_composition (struct coding_system *coding, int *charbuf, ptrdiff_t pos)
6866 [ -LENGTH ANNOTATION_MASK NCHARS CHARSET-ID ] 6866 [ -LENGTH ANNOTATION_MASK NCHARS CHARSET-ID ]
6867 */ 6867 */
6868 6868
6869static inline void 6869static void
6870produce_charset (struct coding_system *coding, int *charbuf, ptrdiff_t pos) 6870produce_charset (struct coding_system *coding, int *charbuf, ptrdiff_t pos)
6871{ 6871{
6872 ptrdiff_t from = pos - charbuf[2]; 6872 ptrdiff_t from = pos - charbuf[2];
@@ -7101,7 +7101,7 @@ decode_coding (struct coding_system *coding)
7101 position of a composition after POS (if any) or to LIMIT, and 7101 position of a composition after POS (if any) or to LIMIT, and
7102 return BUF. */ 7102 return BUF. */
7103 7103
7104static inline int * 7104static int *
7105handle_composition_annotation (ptrdiff_t pos, ptrdiff_t limit, 7105handle_composition_annotation (ptrdiff_t pos, ptrdiff_t limit,
7106 struct coding_system *coding, int *buf, 7106 struct coding_system *coding, int *buf,
7107 ptrdiff_t *stop) 7107 ptrdiff_t *stop)
@@ -7184,7 +7184,7 @@ handle_composition_annotation (ptrdiff_t pos, ptrdiff_t limit,
7184 If the property value is nil, set *STOP to the position where the 7184 If the property value is nil, set *STOP to the position where the
7185 property value is non-nil (limiting by LIMIT), and return BUF. */ 7185 property value is non-nil (limiting by LIMIT), and return BUF. */
7186 7186
7187static inline int * 7187static int *
7188handle_charset_annotation (ptrdiff_t pos, ptrdiff_t limit, 7188handle_charset_annotation (ptrdiff_t pos, ptrdiff_t limit,
7189 struct coding_system *coding, int *buf, 7189 struct coding_system *coding, int *buf,
7190 ptrdiff_t *stop) 7190 ptrdiff_t *stop)
@@ -8429,7 +8429,7 @@ highest priority. */)
8429} 8429}
8430 8430
8431 8431
8432static inline bool 8432static bool
8433char_encodable_p (int c, Lisp_Object attrs) 8433char_encodable_p (int c, Lisp_Object attrs)
8434{ 8434{
8435 Lisp_Object tail; 8435 Lisp_Object tail;
diff --git a/src/coding.h b/src/coding.h
index c45d2ef86e2..989552bf667 100644
--- a/src/coding.h
+++ b/src/coding.h
@@ -646,10 +646,8 @@ struct coding_system
646 for file names, if any. */ 646 for file names, if any. */
647#define ENCODE_FILE(name) \ 647#define ENCODE_FILE(name) \
648 (! NILP (Vfile_name_coding_system) \ 648 (! NILP (Vfile_name_coding_system) \
649 && !EQ (Vfile_name_coding_system, make_number (0)) \
650 ? code_convert_string_norecord (name, Vfile_name_coding_system, 1) \ 649 ? code_convert_string_norecord (name, Vfile_name_coding_system, 1) \
651 : (! NILP (Vdefault_file_name_coding_system) \ 650 : (! NILP (Vdefault_file_name_coding_system) \
652 && !EQ (Vdefault_file_name_coding_system, make_number (0)) \
653 ? code_convert_string_norecord (name, Vdefault_file_name_coding_system, 1) \ 651 ? code_convert_string_norecord (name, Vdefault_file_name_coding_system, 1) \
654 : name)) 652 : name))
655 653
@@ -658,10 +656,8 @@ struct coding_system
658 for file names, if any. */ 656 for file names, if any. */
659#define DECODE_FILE(name) \ 657#define DECODE_FILE(name) \
660 (! NILP (Vfile_name_coding_system) \ 658 (! NILP (Vfile_name_coding_system) \
661 && !EQ (Vfile_name_coding_system, make_number (0)) \
662 ? code_convert_string_norecord (name, Vfile_name_coding_system, 0) \ 659 ? code_convert_string_norecord (name, Vfile_name_coding_system, 0) \
663 : (! NILP (Vdefault_file_name_coding_system) \ 660 : (! NILP (Vdefault_file_name_coding_system) \
664 && !EQ (Vdefault_file_name_coding_system, make_number (0)) \
665 ? code_convert_string_norecord (name, Vdefault_file_name_coding_system, 0) \ 661 ? code_convert_string_norecord (name, Vdefault_file_name_coding_system, 0) \
666 : name)) 662 : name))
667 663
@@ -670,7 +666,6 @@ struct coding_system
670 for system functions, if any. */ 666 for system functions, if any. */
671#define ENCODE_SYSTEM(str) \ 667#define ENCODE_SYSTEM(str) \
672 (! NILP (Vlocale_coding_system) \ 668 (! NILP (Vlocale_coding_system) \
673 && !EQ (Vlocale_coding_system, make_number (0)) \
674 ? code_convert_string_norecord (str, Vlocale_coding_system, 1) \ 669 ? code_convert_string_norecord (str, Vlocale_coding_system, 1) \
675 : str) 670 : str)
676 671
@@ -678,7 +673,6 @@ struct coding_system
678 for system functions, if any. */ 673 for system functions, if any. */
679#define DECODE_SYSTEM(str) \ 674#define DECODE_SYSTEM(str) \
680 (! NILP (Vlocale_coding_system) \ 675 (! NILP (Vlocale_coding_system) \
681 && !EQ (Vlocale_coding_system, make_number (0)) \
682 ? code_convert_string_norecord (str, Vlocale_coding_system, 0) \ 676 ? code_convert_string_norecord (str, Vlocale_coding_system, 0) \
683 : str) 677 : str)
684 678
diff --git a/src/dispextern.h b/src/dispextern.h
index 3c42d7abb9d..f1ea8e97ee8 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -3157,7 +3157,7 @@ extern unsigned row_hash (struct glyph_row *);
3157 3157
3158extern int x_bitmap_height (struct frame *, ptrdiff_t); 3158extern int x_bitmap_height (struct frame *, ptrdiff_t);
3159extern int x_bitmap_width (struct frame *, ptrdiff_t); 3159extern int x_bitmap_width (struct frame *, ptrdiff_t);
3160extern int x_bitmap_pixmap (struct frame *, ptrdiff_t); 3160extern ptrdiff_t x_bitmap_pixmap (struct frame *, ptrdiff_t);
3161extern void x_reference_bitmap (struct frame *, ptrdiff_t); 3161extern void x_reference_bitmap (struct frame *, ptrdiff_t);
3162extern ptrdiff_t x_create_bitmap_from_data (struct frame *, char *, 3162extern ptrdiff_t x_create_bitmap_from_data (struct frame *, char *,
3163 unsigned int, unsigned int); 3163 unsigned int, unsigned int);
diff --git a/src/dispnew.c b/src/dispnew.c
index 555136d785c..6f8fb10b41d 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -1028,7 +1028,7 @@ swap_glyphs_in_rows (struct glyph_row *a, struct glyph_row *b)
1028 these should all go together for the row's hash value to be 1028 these should all go together for the row's hash value to be
1029 correct. */ 1029 correct. */
1030 1030
1031static inline void 1031static void
1032swap_glyph_pointers (struct glyph_row *a, struct glyph_row *b) 1032swap_glyph_pointers (struct glyph_row *a, struct glyph_row *b)
1033{ 1033{
1034 int i; 1034 int i;
@@ -1057,7 +1057,7 @@ swap_glyph_pointers (struct glyph_row *a, struct glyph_row *b)
1057 that glyph pointers, the `used' counts, and the hash values in the 1057 that glyph pointers, the `used' counts, and the hash values in the
1058 structures are left unchanged. */ 1058 structures are left unchanged. */
1059 1059
1060static inline void 1060static void
1061copy_row_except_pointers (struct glyph_row *to, struct glyph_row *from) 1061copy_row_except_pointers (struct glyph_row *to, struct glyph_row *from)
1062{ 1062{
1063 struct glyph *pointers[1 + LAST_AREA]; 1063 struct glyph *pointers[1 + LAST_AREA];
@@ -1084,7 +1084,7 @@ copy_row_except_pointers (struct glyph_row *to, struct glyph_row *from)
1084 exchanged between TO and FROM. Pointers must be exchanged to avoid 1084 exchanged between TO and FROM. Pointers must be exchanged to avoid
1085 a memory leak. */ 1085 a memory leak. */
1086 1086
1087static inline void 1087static void
1088assign_row (struct glyph_row *to, struct glyph_row *from) 1088assign_row (struct glyph_row *to, struct glyph_row *from)
1089{ 1089{
1090 swap_glyph_pointers (to, from); 1090 swap_glyph_pointers (to, from);
@@ -1249,7 +1249,7 @@ line_draw_cost (struct glyph_matrix *matrix, int vpos)
1249/* Return true if the glyph rows A and B have equal contents. 1249/* Return true if the glyph rows A and B have equal contents.
1250 MOUSE_FACE_P means compare the mouse_face_p flags of A and B, too. */ 1250 MOUSE_FACE_P means compare the mouse_face_p flags of A and B, too. */
1251 1251
1252static inline bool 1252static bool
1253row_equal_p (struct glyph_row *a, struct glyph_row *b, bool mouse_face_p) 1253row_equal_p (struct glyph_row *a, struct glyph_row *b, bool mouse_face_p)
1254{ 1254{
1255 eassert (verify_row_hash (a)); 1255 eassert (verify_row_hash (a));
@@ -2657,7 +2657,7 @@ fill_up_frame_row_with_spaces (struct glyph_row *row, int upto)
2657 function must be called before updates to make explicit that we are 2657 function must be called before updates to make explicit that we are
2658 working on frame matrices or not. */ 2658 working on frame matrices or not. */
2659 2659
2660static inline void 2660static void
2661set_frame_matrix_frame (struct frame *f) 2661set_frame_matrix_frame (struct frame *f)
2662{ 2662{
2663 frame_matrix_frame = f; 2663 frame_matrix_frame = f;
@@ -2672,7 +2672,7 @@ set_frame_matrix_frame (struct frame *f)
2672 done in frame matrices, and that we have to perform analogous 2672 done in frame matrices, and that we have to perform analogous
2673 operations in window matrices of frame_matrix_frame. */ 2673 operations in window matrices of frame_matrix_frame. */
2674 2674
2675static inline void 2675static void
2676make_current (struct glyph_matrix *desired_matrix, struct glyph_matrix *current_matrix, int row) 2676make_current (struct glyph_matrix *desired_matrix, struct glyph_matrix *current_matrix, int row)
2677{ 2677{
2678 struct glyph_row *current_row = MATRIX_ROW (current_matrix, row); 2678 struct glyph_row *current_row = MATRIX_ROW (current_matrix, row);
@@ -4158,7 +4158,7 @@ static struct run **runs;
4158 4158
4159/* Add glyph row ROW to the scrolling hash table. */ 4159/* Add glyph row ROW to the scrolling hash table. */
4160 4160
4161static inline struct row_entry * 4161static struct row_entry *
4162add_row_entry (struct glyph_row *row) 4162add_row_entry (struct glyph_row *row)
4163{ 4163{
4164 struct row_entry *entry; 4164 struct row_entry *entry;
diff --git a/src/emacs.c b/src/emacs.c
index 05affeefde7..bc54f56b98a 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -31,10 +31,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
31 31
32#include "lisp.h" 32#include "lisp.h"
33 33
34#ifdef HAVE_WINDOW_SYSTEM
35#include TERM_HEADER
36#endif /* HAVE_WINDOW_SYSTEM */
37
38#ifdef WINDOWSNT 34#ifdef WINDOWSNT
39#include <fcntl.h> 35#include <fcntl.h>
40#include <windows.h> /* just for w32.h */ 36#include <windows.h> /* just for w32.h */
@@ -42,6 +38,10 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
42#include "w32heap.h" /* for prototype of sbrk */ 38#include "w32heap.h" /* for prototype of sbrk */
43#endif 39#endif
44 40
41#ifdef HAVE_WINDOW_SYSTEM
42#include TERM_HEADER
43#endif /* HAVE_WINDOW_SYSTEM */
44
45#ifdef NS_IMPL_GNUSTEP 45#ifdef NS_IMPL_GNUSTEP
46/* At least under Debian, GSConfig is in a subdirectory. --Stef */ 46/* At least under Debian, GSConfig is in a subdirectory. --Stef */
47#include <GNUstepBase/GSConfig.h> 47#include <GNUstepBase/GSConfig.h>
@@ -1886,7 +1886,7 @@ shut_down_emacs (int sig, Lisp_Object stuff)
1886 static char const format[] = "Fatal error %d: "; 1886 static char const format[] = "Fatal error %d: ";
1887 char buf[sizeof format - 2 + INT_STRLEN_BOUND (int)]; 1887 char buf[sizeof format - 2 + INT_STRLEN_BOUND (int)];
1888 int buflen = sprintf (buf, format, sig); 1888 int buflen = sprintf (buf, format, sig);
1889 char const *sig_desc = strsignal (sig); 1889 char const *sig_desc = safe_strsignal (sig);
1890 ignore_value (write (STDERR_FILENO, buf, buflen)); 1890 ignore_value (write (STDERR_FILENO, buf, buflen));
1891 ignore_value (write (STDERR_FILENO, sig_desc, strlen (sig_desc))); 1891 ignore_value (write (STDERR_FILENO, sig_desc, strlen (sig_desc)));
1892 } 1892 }
@@ -1912,10 +1912,6 @@ shut_down_emacs (int sig, Lisp_Object stuff)
1912 unrequest_sigio (); 1912 unrequest_sigio ();
1913 ignore_sigio (); 1913 ignore_sigio ();
1914 1914
1915#ifdef WINDOWSNT
1916 term_ntproc (0);
1917#endif
1918
1919 /* Do this only if terminating normally, we want glyph matrices 1915 /* Do this only if terminating normally, we want glyph matrices
1920 etc. in a core dump. */ 1916 etc. in a core dump. */
1921 if (sig == 0 || sig == SIGTERM) 1917 if (sig == 0 || sig == SIGTERM)
@@ -1935,6 +1931,10 @@ shut_down_emacs (int sig, Lisp_Object stuff)
1935#ifdef HAVE_LIBXML2 1931#ifdef HAVE_LIBXML2
1936 xml_cleanup_parser (); 1932 xml_cleanup_parser ();
1937#endif 1933#endif
1934
1935#ifdef WINDOWSNT
1936 term_ntproc (0);
1937#endif
1938} 1938}
1939 1939
1940 1940
diff --git a/src/eval.c b/src/eval.c
index 561ba922482..4d200fbc2bd 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -119,13 +119,13 @@ static Lisp_Object apply_lambda (Lisp_Object fun, Lisp_Object args);
119 119
120/* Functions to set Lisp_Object slots of struct specbinding. */ 120/* Functions to set Lisp_Object slots of struct specbinding. */
121 121
122static inline void 122static void
123set_specpdl_symbol (Lisp_Object symbol) 123set_specpdl_symbol (Lisp_Object symbol)
124{ 124{
125 specpdl_ptr->symbol = symbol; 125 specpdl_ptr->symbol = symbol;
126} 126}
127 127
128static inline void 128static void
129set_specpdl_old_value (Lisp_Object oldval) 129set_specpdl_old_value (Lisp_Object oldval)
130{ 130{
131 specpdl_ptr->old_value = oldval; 131 specpdl_ptr->old_value = oldval;
diff --git a/src/fileio.c b/src/fileio.c
index 9ce9e7b8395..b4eda01afcc 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -3034,7 +3034,7 @@ Use the current time if TIMESTAMP is nil. TIMESTAMP is in the format of
3034 { 3034 {
3035 if (set_file_times (-1, SSDATA (encoded_absname), t, t)) 3035 if (set_file_times (-1, SSDATA (encoded_absname), t, t))
3036 { 3036 {
3037#ifdef DOS_NT 3037#ifdef MSDOS
3038 struct stat st; 3038 struct stat st;
3039 3039
3040 /* Setting times on a directory always fails. */ 3040 /* Setting times on a directory always fails. */
diff --git a/src/fns.c b/src/fns.c
index 6d6f019b311..c999b5b08b9 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -3337,14 +3337,6 @@ Lisp_Object Qeq, Qeql, Qequal;
3337Lisp_Object QCtest, QCsize, QCrehash_size, QCrehash_threshold, QCweakness; 3337Lisp_Object QCtest, QCsize, QCrehash_size, QCrehash_threshold, QCweakness;
3338static Lisp_Object Qhash_table_test, Qkey_or_value, Qkey_and_value; 3338static Lisp_Object Qhash_table_test, Qkey_or_value, Qkey_and_value;
3339 3339
3340/* Function prototypes. */
3341
3342static struct Lisp_Hash_Table *check_hash_table (Lisp_Object);
3343static ptrdiff_t get_key_arg (Lisp_Object, ptrdiff_t, Lisp_Object *, char *);
3344static void maybe_resize_hash_table (struct Lisp_Hash_Table *);
3345static bool sweep_weak_table (struct Lisp_Hash_Table *, bool);
3346
3347
3348 3340
3349/*********************************************************************** 3341/***********************************************************************
3350 Utilities 3342 Utilities
@@ -3695,7 +3687,7 @@ copy_hash_table (struct Lisp_Hash_Table *h1)
3695/* Resize hash table H if it's too full. If H cannot be resized 3687/* Resize hash table H if it's too full. If H cannot be resized
3696 because it's already too large, throw an error. */ 3688 because it's already too large, throw an error. */
3697 3689
3698static inline void 3690static void
3699maybe_resize_hash_table (struct Lisp_Hash_Table *h) 3691maybe_resize_hash_table (struct Lisp_Hash_Table *h)
3700{ 3692{
3701 if (NILP (h->next_free)) 3693 if (NILP (h->next_free))
diff --git a/src/frame.c b/src/frame.c
index 4bcacef39c5..2fcf7275f9c 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -120,12 +120,12 @@ static void x_report_frame_params (struct frame *, Lisp_Object *);
120#endif 120#endif
121 121
122/* These setters are used only in this file, so they can be private. */ 122/* These setters are used only in this file, so they can be private. */
123static inline void 123static void
124fset_buffer_predicate (struct frame *f, Lisp_Object val) 124fset_buffer_predicate (struct frame *f, Lisp_Object val)
125{ 125{
126 f->buffer_predicate = val; 126 f->buffer_predicate = val;
127} 127}
128static inline void 128static void
129fset_minibuffer_window (struct frame *f, Lisp_Object val) 129fset_minibuffer_window (struct frame *f, Lisp_Object val)
130{ 130{
131 f->minibuffer_window = val; 131 f->minibuffer_window = val;
@@ -632,7 +632,7 @@ affects all frames on the same terminal device. */)
632 Lisp_Object terminal; 632 Lisp_Object terminal;
633 633
634 terminal = Fassq (Qterminal, parms); 634 terminal = Fassq (Qterminal, parms);
635 if (!NILP (terminal)) 635 if (CONSP (terminal))
636 { 636 {
637 terminal = XCDR (terminal); 637 terminal = XCDR (terminal);
638 t = get_terminal (terminal, 1); 638 t = get_terminal (terminal, 1);
@@ -3028,9 +3028,9 @@ x_set_frame_parameters (FRAME_PTR f, Lisp_Object alist)
3028void 3028void
3029x_report_frame_params (struct frame *f, Lisp_Object *alistptr) 3029x_report_frame_params (struct frame *f, Lisp_Object *alistptr)
3030{ 3030{
3031 char buf[16];
3032 Lisp_Object tem; 3031 Lisp_Object tem;
3033 unsigned long w; 3032 uprintmax_t w;
3033 char buf[INT_BUFSIZE_BOUND (w)];
3034 3034
3035 /* Represent negative positions (off the top or left screen edge) 3035 /* Represent negative positions (off the top or left screen edge)
3036 in a way that Fmodify_frame_parameters will understand correctly. */ 3036 in a way that Fmodify_frame_parameters will understand correctly. */
@@ -3067,17 +3067,17 @@ x_report_frame_params (struct frame *f, Lisp_Object *alistptr)
3067 MS-Windows it returns a value whose type is HANDLE, which is 3067 MS-Windows it returns a value whose type is HANDLE, which is
3068 actually a pointer. Explicit casting avoids compiler 3068 actually a pointer. Explicit casting avoids compiler
3069 warnings. */ 3069 warnings. */
3070 w = (unsigned long) FRAME_X_WINDOW (f); 3070 w = (uintptr_t) FRAME_X_WINDOW (f);
3071 store_in_alist (alistptr, Qwindow_id, 3071 store_in_alist (alistptr, Qwindow_id,
3072 make_formatted_string (buf, "%lu", w)); 3072 make_formatted_string (buf, "%"pMu, w));
3073#ifdef HAVE_X_WINDOWS 3073#ifdef HAVE_X_WINDOWS
3074#ifdef USE_X_TOOLKIT 3074#ifdef USE_X_TOOLKIT
3075 /* Tooltip frame may not have this widget. */ 3075 /* Tooltip frame may not have this widget. */
3076 if (FRAME_X_OUTPUT (f)->widget) 3076 if (FRAME_X_OUTPUT (f)->widget)
3077#endif 3077#endif
3078 w = (unsigned long) FRAME_OUTER_WINDOW (f); 3078 w = (uintptr_t) FRAME_OUTER_WINDOW (f);
3079 store_in_alist (alistptr, Qouter_window_id, 3079 store_in_alist (alistptr, Qouter_window_id,
3080 make_formatted_string (buf, "%lu", w)); 3080 make_formatted_string (buf, "%"pMu, w));
3081#endif 3081#endif
3082 store_in_alist (alistptr, Qicon_name, f->icon_name); 3082 store_in_alist (alistptr, Qicon_name, f->icon_name);
3083 FRAME_SAMPLE_VISIBILITY (f); 3083 FRAME_SAMPLE_VISIBILITY (f);
diff --git a/src/gmalloc.c b/src/gmalloc.c
index 78d6934755b..dc584955661 100644
--- a/src/gmalloc.c
+++ b/src/gmalloc.c
@@ -36,6 +36,10 @@ Fifth Floor, Boston, MA 02110-1301, USA.
36#include <pthread.h> 36#include <pthread.h>
37#endif 37#endif
38 38
39#ifdef WINDOWSNT
40#include <w32heap.h> /* for sbrk */
41#endif
42
39#ifdef __cplusplus 43#ifdef __cplusplus
40extern "C" 44extern "C"
41{ 45{
@@ -460,7 +464,7 @@ get_contiguous_space (ptrdiff_t size, void *position)
460/* This is called when `_heapinfo' and `heapsize' have just 464/* This is called when `_heapinfo' and `heapsize' have just
461 been set to describe a new info table. Set up the table 465 been set to describe a new info table. Set up the table
462 to describe itself and account for it in the statistics. */ 466 to describe itself and account for it in the statistics. */
463static inline void 467static void
464register_heapinfo (void) 468register_heapinfo (void)
465{ 469{
466 size_t block, blocks; 470 size_t block, blocks;
@@ -1289,7 +1293,9 @@ Fifth Floor, Boston, MA 02110-1301, USA.
1289 The author may be reached (Email) at the address mike@ai.mit.edu, 1293 The author may be reached (Email) at the address mike@ai.mit.edu,
1290 or (US mail) as Mike Haertel c/o Free Software Foundation. */ 1294 or (US mail) as Mike Haertel c/o Free Software Foundation. */
1291 1295
1296#ifndef min
1292#define min(A, B) ((A) < (B) ? (A) : (B)) 1297#define min(A, B) ((A) < (B) ? (A) : (B))
1298#endif
1293 1299
1294/* On Cygwin the dumped emacs may try to realloc storage allocated in 1300/* On Cygwin the dumped emacs may try to realloc storage allocated in
1295 the static heap. We just malloc space in the new heap and copy the 1301 the static heap. We just malloc space in the new heap and copy the
diff --git a/src/image.c b/src/image.c
index 7901b95f236..91eeb91920c 100644
--- a/src/image.c
+++ b/src/image.c
@@ -186,11 +186,11 @@ x_bitmap_width (FRAME_PTR f, ptrdiff_t id)
186} 186}
187 187
188#if defined (HAVE_X_WINDOWS) || defined (HAVE_NTGUI) 188#if defined (HAVE_X_WINDOWS) || defined (HAVE_NTGUI)
189int 189ptrdiff_t
190x_bitmap_pixmap (FRAME_PTR f, ptrdiff_t id) 190x_bitmap_pixmap (FRAME_PTR f, ptrdiff_t id)
191{ 191{
192 /* HAVE_NTGUI needs the explicit cast here. */ 192 /* HAVE_NTGUI needs the explicit cast here. */
193 return (int) FRAME_X_DISPLAY_INFO (f)->bitmaps[id - 1].pixmap; 193 return (ptrdiff_t) FRAME_X_DISPLAY_INFO (f)->bitmaps[id - 1].pixmap;
194} 194}
195#endif 195#endif
196 196
diff --git a/src/intervals.c b/src/intervals.c
index 584ee1e923d..1ed93e1302d 100644
--- a/src/intervals.c
+++ b/src/intervals.c
@@ -64,7 +64,7 @@ static INTERVAL reproduce_tree (INTERVAL, INTERVAL);
64/* Use these functions to set Lisp_Object 64/* Use these functions to set Lisp_Object
65 or pointer slots of struct interval. */ 65 or pointer slots of struct interval. */
66 66
67static inline void 67static void
68set_interval_object (INTERVAL i, Lisp_Object obj) 68set_interval_object (INTERVAL i, Lisp_Object obj)
69{ 69{
70 eassert (BUFFERP (obj) || STRINGP (obj)); 70 eassert (BUFFERP (obj) || STRINGP (obj));
@@ -72,13 +72,13 @@ set_interval_object (INTERVAL i, Lisp_Object obj)
72 i->up.obj = obj; 72 i->up.obj = obj;
73} 73}
74 74
75static inline void 75static void
76set_interval_left (INTERVAL i, INTERVAL left) 76set_interval_left (INTERVAL i, INTERVAL left)
77{ 77{
78 i->left = left; 78 i->left = left;
79} 79}
80 80
81static inline void 81static void
82set_interval_right (INTERVAL i, INTERVAL right) 82set_interval_right (INTERVAL i, INTERVAL right)
83{ 83{
84 i->right = right; 84 i->right = right;
@@ -87,7 +87,7 @@ set_interval_right (INTERVAL i, INTERVAL right)
87/* Make the parent of D be whatever the parent of S is, regardless 87/* Make the parent of D be whatever the parent of S is, regardless
88 of the type. This is used when balancing an interval tree. */ 88 of the type. This is used when balancing an interval tree. */
89 89
90static inline void 90static void
91copy_interval_parent (INTERVAL d, INTERVAL s) 91copy_interval_parent (INTERVAL d, INTERVAL s)
92{ 92{
93 d->up = s->up; 93 d->up = s->up;
@@ -341,7 +341,7 @@ root_interval (INTERVAL interval)
341 c c 341 c c
342*/ 342*/
343 343
344static inline INTERVAL 344static INTERVAL
345rotate_right (INTERVAL interval) 345rotate_right (INTERVAL interval)
346{ 346{
347 INTERVAL i; 347 INTERVAL i;
@@ -388,7 +388,7 @@ rotate_right (INTERVAL interval)
388 c c 388 c c
389*/ 389*/
390 390
391static inline INTERVAL 391static INTERVAL
392rotate_left (INTERVAL interval) 392rotate_left (INTERVAL interval)
393{ 393{
394 INTERVAL i; 394 INTERVAL i;
@@ -466,7 +466,7 @@ balance_an_interval (INTERVAL i)
466/* Balance INTERVAL, potentially stuffing it back into its parent 466/* Balance INTERVAL, potentially stuffing it back into its parent
467 Lisp Object. */ 467 Lisp Object. */
468 468
469static inline INTERVAL 469static INTERVAL
470balance_possible_root_interval (INTERVAL interval) 470balance_possible_root_interval (INTERVAL interval)
471{ 471{
472 Lisp_Object parent; 472 Lisp_Object parent;
diff --git a/src/keyboard.c b/src/keyboard.c
index f3d7df5e98f..d06b02024c5 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -76,9 +76,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
76/* Positive if interrupt input is blocked right now. */ 76/* Positive if interrupt input is blocked right now. */
77volatile int interrupt_input_blocked; 77volatile int interrupt_input_blocked;
78 78
79/* Nonzero means an input interrupt or alarm signal has arrived. 79/* True means an input interrupt or alarm signal has arrived.
80 The QUIT macro checks this. */ 80 The QUIT macro checks this. */
81volatile int pending_signals; 81volatile bool pending_signals;
82 82
83#define KBD_BUFFER_SIZE 4096 83#define KBD_BUFFER_SIZE 4096
84 84
@@ -448,47 +448,47 @@ static char *find_user_signal_name (int);
448static void store_user_signal_events (void); 448static void store_user_signal_events (void);
449 449
450/* These setters are used only in this file, so they can be private. */ 450/* These setters are used only in this file, so they can be private. */
451static inline void 451static void
452kset_echo_string (struct kboard *kb, Lisp_Object val) 452kset_echo_string (struct kboard *kb, Lisp_Object val)
453{ 453{
454 kb->INTERNAL_FIELD (echo_string) = val; 454 kb->INTERNAL_FIELD (echo_string) = val;
455} 455}
456static inline void 456static void
457kset_kbd_queue (struct kboard *kb, Lisp_Object val) 457kset_kbd_queue (struct kboard *kb, Lisp_Object val)
458{ 458{
459 kb->INTERNAL_FIELD (kbd_queue) = val; 459 kb->INTERNAL_FIELD (kbd_queue) = val;
460} 460}
461static inline void 461static void
462kset_keyboard_translate_table (struct kboard *kb, Lisp_Object val) 462kset_keyboard_translate_table (struct kboard *kb, Lisp_Object val)
463{ 463{
464 kb->INTERNAL_FIELD (Vkeyboard_translate_table) = val; 464 kb->INTERNAL_FIELD (Vkeyboard_translate_table) = val;
465} 465}
466static inline void 466static void
467kset_last_prefix_arg (struct kboard *kb, Lisp_Object val) 467kset_last_prefix_arg (struct kboard *kb, Lisp_Object val)
468{ 468{
469 kb->INTERNAL_FIELD (Vlast_prefix_arg) = val; 469 kb->INTERNAL_FIELD (Vlast_prefix_arg) = val;
470} 470}
471static inline void 471static void
472kset_last_repeatable_command (struct kboard *kb, Lisp_Object val) 472kset_last_repeatable_command (struct kboard *kb, Lisp_Object val)
473{ 473{
474 kb->INTERNAL_FIELD (Vlast_repeatable_command) = val; 474 kb->INTERNAL_FIELD (Vlast_repeatable_command) = val;
475} 475}
476static inline void 476static void
477kset_local_function_key_map (struct kboard *kb, Lisp_Object val) 477kset_local_function_key_map (struct kboard *kb, Lisp_Object val)
478{ 478{
479 kb->INTERNAL_FIELD (Vlocal_function_key_map) = val; 479 kb->INTERNAL_FIELD (Vlocal_function_key_map) = val;
480} 480}
481static inline void 481static void
482kset_overriding_terminal_local_map (struct kboard *kb, Lisp_Object val) 482kset_overriding_terminal_local_map (struct kboard *kb, Lisp_Object val)
483{ 483{
484 kb->INTERNAL_FIELD (Voverriding_terminal_local_map) = val; 484 kb->INTERNAL_FIELD (Voverriding_terminal_local_map) = val;
485} 485}
486static inline void 486static void
487kset_real_last_command (struct kboard *kb, Lisp_Object val) 487kset_real_last_command (struct kboard *kb, Lisp_Object val)
488{ 488{
489 kb->INTERNAL_FIELD (Vreal_last_command) = val; 489 kb->INTERNAL_FIELD (Vreal_last_command) = val;
490} 490}
491static inline void 491static void
492kset_system_key_syms (struct kboard *kb, Lisp_Object val) 492kset_system_key_syms (struct kboard *kb, Lisp_Object val)
493{ 493{
494 kb->INTERNAL_FIELD (system_key_syms) = val; 494 kb->INTERNAL_FIELD (system_key_syms) = val;
@@ -2283,11 +2283,10 @@ read_char (int commandflag, ptrdiff_t nmaps, Lisp_Object *maps,
2283 Lisp_Object prev_event, 2283 Lisp_Object prev_event,
2284 int *used_mouse_menu, EMACS_TIME *end_time) 2284 int *used_mouse_menu, EMACS_TIME *end_time)
2285{ 2285{
2286 volatile Lisp_Object c; 2286 Lisp_Object c;
2287 ptrdiff_t jmpcount; 2287 ptrdiff_t jmpcount;
2288 sys_jmp_buf local_getcjmp; 2288 sys_jmp_buf local_getcjmp;
2289 sys_jmp_buf save_jump; 2289 sys_jmp_buf save_jump;
2290 volatile int key_already_recorded = 0;
2291 Lisp_Object tem, save; 2290 Lisp_Object tem, save;
2292 volatile Lisp_Object previous_echo_area_message; 2291 volatile Lisp_Object previous_echo_area_message;
2293 volatile Lisp_Object also_record; 2292 volatile Lisp_Object also_record;
@@ -2519,10 +2518,7 @@ read_char (int commandflag, ptrdiff_t nmaps, Lisp_Object *maps,
2519 return c; /* wrong_kboard_jmpbuf */ 2518 return c; /* wrong_kboard_jmpbuf */
2520 2519
2521 if (! NILP (c)) 2520 if (! NILP (c))
2522 { 2521 goto exit;
2523 key_already_recorded = 1;
2524 goto non_reread_1;
2525 }
2526 } 2522 }
2527 2523
2528 /* Make a longjmp point for quits to use, but don't alter getcjmp just yet. 2524 /* Make a longjmp point for quits to use, but don't alter getcjmp just yet.
@@ -2850,12 +2846,10 @@ read_char (int commandflag, ptrdiff_t nmaps, Lisp_Object *maps,
2850 goto wrong_kboard; 2846 goto wrong_kboard;
2851 } 2847 }
2852 2848
2853 non_reread_1:
2854
2855 /* Buffer switch events are only for internal wakeups 2849 /* Buffer switch events are only for internal wakeups
2856 so don't show them to the user. 2850 so don't show them to the user.
2857 Also, don't record a key if we already did. */ 2851 Also, don't record a key if we already did. */
2858 if (BUFFERP (c) || key_already_recorded) 2852 if (BUFFERP (c))
2859 goto exit; 2853 goto exit;
2860 2854
2861 /* Process special events within read_char 2855 /* Process special events within read_char
@@ -3749,7 +3743,7 @@ kbd_buffer_events_waiting (int discard)
3749 3743
3750/* Clear input event EVENT. */ 3744/* Clear input event EVENT. */
3751 3745
3752static inline void 3746static void
3753clear_event (struct input_event *event) 3747clear_event (struct input_event *event)
3754{ 3748{
3755 event->kind = NO_EVENT; 3749 event->kind = NO_EVENT;
@@ -8054,7 +8048,7 @@ process_tool_bar_item (Lisp_Object key, Lisp_Object def, Lisp_Object data, void
8054 8048
8055/* Access slot with index IDX of vector tool_bar_item_properties. */ 8049/* Access slot with index IDX of vector tool_bar_item_properties. */
8056#define PROP(IDX) AREF (tool_bar_item_properties, (IDX)) 8050#define PROP(IDX) AREF (tool_bar_item_properties, (IDX))
8057static inline void 8051static void
8058set_prop (ptrdiff_t idx, Lisp_Object val) 8052set_prop (ptrdiff_t idx, Lisp_Object val)
8059{ 8053{
8060 ASET (tool_bar_item_properties, idx, val); 8054 ASET (tool_bar_item_properties, idx, val);
diff --git a/src/lisp.h b/src/lisp.h
index c3cabe0af29..2a647e593a8 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -2131,7 +2131,7 @@ extern char *stack_bottom;
2131 a request to exit Emacs when it is safe to do. */ 2131 a request to exit Emacs when it is safe to do. */
2132 2132
2133extern void process_pending_signals (void); 2133extern void process_pending_signals (void);
2134extern int volatile pending_signals; 2134extern bool volatile pending_signals;
2135 2135
2136extern void process_quit_flag (void); 2136extern void process_quit_flag (void);
2137#define QUIT \ 2137#define QUIT \
diff --git a/src/lread.c b/src/lread.c
index d22011be7c8..a2b6d1f26d9 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -1700,7 +1700,7 @@ readevalloop (Lisp_Object readcharfun,
1700 if (NILP (Ffboundp (macroexpand)) 1700 if (NILP (Ffboundp (macroexpand))
1701 /* Don't macroexpand in .elc files, since it should have been done 1701 /* Don't macroexpand in .elc files, since it should have been done
1702 already. We actually don't know whether we're in a .elc file or not, 1702 already. We actually don't know whether we're in a .elc file or not,
1703 so we use circumstancial evidence: .el files normally go through 1703 so we use circumstantial evidence: .el files normally go through
1704 Vload_source_file_function -> load-with-code-conversion 1704 Vload_source_file_function -> load-with-code-conversion
1705 -> eval-buffer. */ 1705 -> eval-buffer. */
1706 || EQ (readcharfun, Qget_file_char) 1706 || EQ (readcharfun, Qget_file_char)
@@ -2283,7 +2283,7 @@ read_escape (Lisp_Object readcharfun, int stringp)
2283/* Return the digit that CHARACTER stands for in the given BASE. 2283/* Return the digit that CHARACTER stands for in the given BASE.
2284 Return -1 if CHARACTER is out of range for BASE, 2284 Return -1 if CHARACTER is out of range for BASE,
2285 and -2 if CHARACTER is not valid for any supported BASE. */ 2285 and -2 if CHARACTER is not valid for any supported BASE. */
2286static inline int 2286static int
2287digit_to_number (int character, int base) 2287digit_to_number (int character, int base)
2288{ 2288{
2289 int digit; 2289 int digit;
diff --git a/src/makefile.w32-in b/src/makefile.w32-in
index 3d1464cc742..c6fbf59fb5a 100644
--- a/src/makefile.w32-in
+++ b/src/makefile.w32-in
@@ -25,7 +25,7 @@ ALL = emacs
25EMACSLOADPATH=$(CURDIR)/../lisp 25EMACSLOADPATH=$(CURDIR)/../lisp
26 26
27# Size in MBs of the static heap in temacs.exe. 27# Size in MBs of the static heap in temacs.exe.
28HEAPSIZE = 27 28HEAPSIZE = $(EMACS_HEAPSIZE)
29 29
30LOCAL_FLAGS = -Demacs=1 -I../lib -I../nt/inc -DHAVE_NTGUI=1 $(EMACS_EXTRA_C_FLAGS) 30LOCAL_FLAGS = -Demacs=1 -I../lib -I../nt/inc -DHAVE_NTGUI=1 $(EMACS_EXTRA_C_FLAGS)
31 31
@@ -247,10 +247,10 @@ bootstrap: bootstrap-emacs
247# WARNING: Do NOT split the part inside $(ARGQUOTE)s into multiple lines as 247# WARNING: Do NOT split the part inside $(ARGQUOTE)s into multiple lines as
248# this can break with GNU Make 3.81 and later if sh.exe is used. 248# this can break with GNU Make 3.81 and later if sh.exe is used.
249bootstrap-temacs-CMD: 249bootstrap-temacs-CMD:
250 $(MAKE) $(MFLAGS) $(XMFLAGS) temacs CFLAGS=$(ARGQUOTE)$(ESC_CFLAGS) -DPURESIZE=5000000$(ARGQUOTE) 250 $(MAKE) $(MFLAGS) $(XMFLAGS) temacs CFLAGS=$(ARGQUOTE)$(ESC_CFLAGS) -DPURESIZE=$(EMACS_PURESIZE)$(ARGQUOTE)
251 251
252bootstrap-temacs-SH: 252bootstrap-temacs-SH:
253 $(MAKE) $(MFLAGS) $(XMFLAGS) temacs CFLAGS=$(ARGQUOTE)$(CFLAGS) -DPURESIZE=5000000$(ARGQUOTE) 253 $(MAKE) $(MFLAGS) $(XMFLAGS) temacs CFLAGS=$(ARGQUOTE)$(CFLAGS) -DPURESIZE=$(EMACS_PURESIZE)$(ARGQUOTE)
254 254
255bootstrap-temacs: 255bootstrap-temacs:
256 $(MAKE) $(MFLAGS) bootstrap-temacs-$(SHELLTYPE) 256 $(MAKE) $(MFLAGS) bootstrap-temacs-$(SHELLTYPE)
@@ -485,6 +485,7 @@ $(BLD)/alloc.$(O) : \
485 $(SRC)/blockinput.h \ 485 $(SRC)/blockinput.h \
486 $(SRC)/puresize.h \ 486 $(SRC)/puresize.h \
487 $(SRC)/w32.h \ 487 $(SRC)/w32.h \
488 $(SRC)/w32heap.h \
488 $(NT_INC)/unistd.h \ 489 $(NT_INC)/unistd.h \
489 $(GNU_LIB)/verify.h \ 490 $(GNU_LIB)/verify.h \
490 $(BUFFER_H) \ 491 $(BUFFER_H) \
@@ -955,6 +956,7 @@ $(BLD)/fringe.$(O) : \
955 956
956$(BLD)/gmalloc.$(O) : \ 957$(BLD)/gmalloc.$(O) : \
957 $(SRC)/gmalloc.c \ 958 $(SRC)/gmalloc.c \
959 $(SRC)/w32heap.h \
958 $(NT_INC)/stdint.h \ 960 $(NT_INC)/stdint.h \
959 $(NT_INC)/unistd.h \ 961 $(NT_INC)/unistd.h \
960 $(CONFIG_H) 962 $(CONFIG_H)
diff --git a/src/marker.c b/src/marker.c
index 0c4e8cb3b55..e01647bdb2a 100644
--- a/src/marker.c
+++ b/src/marker.c
@@ -427,7 +427,7 @@ Returns nil if MARKER points nowhere. */)
427 427
428/* Change M so it points to B at CHARPOS and BYTEPOS. */ 428/* Change M so it points to B at CHARPOS and BYTEPOS. */
429 429
430static inline void 430static void
431attach_marker (struct Lisp_Marker *m, struct buffer *b, 431attach_marker (struct Lisp_Marker *m, struct buffer *b,
432 ptrdiff_t charpos, ptrdiff_t bytepos) 432 ptrdiff_t charpos, ptrdiff_t bytepos)
433{ 433{
@@ -454,7 +454,7 @@ attach_marker (struct Lisp_Marker *m, struct buffer *b,
454 whether BUFFER is a buffer object and return buffer pointer 454 whether BUFFER is a buffer object and return buffer pointer
455 corresponding to BUFFER if BUFFER is live, or NULL otherwise. */ 455 corresponding to BUFFER if BUFFER is live, or NULL otherwise. */
456 456
457static inline struct buffer * 457static struct buffer *
458live_buffer (Lisp_Object buffer) 458live_buffer (Lisp_Object buffer)
459{ 459{
460 struct buffer *b; 460 struct buffer *b;
@@ -477,7 +477,7 @@ live_buffer (Lisp_Object buffer)
477/* Internal function to set MARKER in BUFFER at POSITION. Non-zero 477/* Internal function to set MARKER in BUFFER at POSITION. Non-zero
478 RESTRICTED means limit the POSITION by the visible part of BUFFER. */ 478 RESTRICTED means limit the POSITION by the visible part of BUFFER. */
479 479
480static inline Lisp_Object 480static Lisp_Object
481set_marker_internal (Lisp_Object marker, Lisp_Object position, 481set_marker_internal (Lisp_Object marker, Lisp_Object position,
482 Lisp_Object buffer, int restricted) 482 Lisp_Object buffer, int restricted)
483{ 483{
diff --git a/src/minibuf.c b/src/minibuf.c
index 6f9c61dcfb1..dd4ca34c3fb 100644
--- a/src/minibuf.c
+++ b/src/minibuf.c
@@ -1703,7 +1703,7 @@ If INITIAL-INPUT is non-nil, insert it in the minibuffer initially,
1703 functions, which use one-indexing for POSITION.) This feature is 1703 functions, which use one-indexing for POSITION.) This feature is
1704 deprecated--it is best to pass nil for INITIAL-INPUT and supply the 1704 deprecated--it is best to pass nil for INITIAL-INPUT and supply the
1705 default value DEF instead. The user can yank the default value into 1705 default value DEF instead. The user can yank the default value into
1706 the minibuffer easily using \\[next-history-element]. 1706 the minibuffer easily using \\<minibuffer-local-map>\\[next-history-element].
1707 1707
1708HIST, if non-nil, specifies a history list and optionally the initial 1708HIST, if non-nil, specifies a history list and optionally the initial
1709 position in the list. It can be a symbol, which is the history list 1709 position in the list. It can be a symbol, which is the history list
diff --git a/src/nsterm.m b/src/nsterm.m
index d41c38f4e40..2df0e1a1ad5 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -2171,7 +2171,7 @@ ns_shift_glyphs_for_insert (struct frame *f,
2171 ========================================================================== */ 2171 ========================================================================== */
2172 2172
2173 2173
2174static inline void 2174static void
2175ns_compute_glyph_string_overhangs (struct glyph_string *s) 2175ns_compute_glyph_string_overhangs (struct glyph_string *s)
2176/* -------------------------------------------------------------------------- 2176/* --------------------------------------------------------------------------
2177 External (RIF); compute left/right overhang of whole string and set in s 2177 External (RIF); compute left/right overhang of whole string and set in s
@@ -5871,7 +5871,6 @@ not_in_argv (NSString *arg)
5871{ 5871{
5872 [self setFSValue: FULLSCREEN_BOTH]; 5872 [self setFSValue: FULLSCREEN_BOTH];
5873#ifndef NEW_STYLE_FS 5873#ifndef NEW_STYLE_FS
5874 fprintf(stderr, "%s %d\n", __func__, FRAME_PIXEL_WIDTH (emacsframe));
5875 [self windowDidBecomeKey:notification]; 5874 [self windowDidBecomeKey:notification];
5876#endif 5875#endif
5877} 5876}
diff --git a/src/process.c b/src/process.c
index ab215766c07..92bea0d3a27 100644
--- a/src/process.c
+++ b/src/process.c
@@ -335,82 +335,82 @@ static struct sockaddr_and_len {
335static int pty_max_bytes; 335static int pty_max_bytes;
336 336
337/* These setters are used only in this file, so they can be private. */ 337/* These setters are used only in this file, so they can be private. */
338static inline void 338static void
339pset_buffer (struct Lisp_Process *p, Lisp_Object val) 339pset_buffer (struct Lisp_Process *p, Lisp_Object val)
340{ 340{
341 p->buffer = val; 341 p->buffer = val;
342} 342}
343static inline void 343static void
344pset_command (struct Lisp_Process *p, Lisp_Object val) 344pset_command (struct Lisp_Process *p, Lisp_Object val)
345{ 345{
346 p->command = val; 346 p->command = val;
347} 347}
348static inline void 348static void
349pset_decode_coding_system (struct Lisp_Process *p, Lisp_Object val) 349pset_decode_coding_system (struct Lisp_Process *p, Lisp_Object val)
350{ 350{
351 p->decode_coding_system = val; 351 p->decode_coding_system = val;
352} 352}
353static inline void 353static void
354pset_decoding_buf (struct Lisp_Process *p, Lisp_Object val) 354pset_decoding_buf (struct Lisp_Process *p, Lisp_Object val)
355{ 355{
356 p->decoding_buf = val; 356 p->decoding_buf = val;
357} 357}
358static inline void 358static void
359pset_encode_coding_system (struct Lisp_Process *p, Lisp_Object val) 359pset_encode_coding_system (struct Lisp_Process *p, Lisp_Object val)
360{ 360{
361 p->encode_coding_system = val; 361 p->encode_coding_system = val;
362} 362}
363static inline void 363static void
364pset_encoding_buf (struct Lisp_Process *p, Lisp_Object val) 364pset_encoding_buf (struct Lisp_Process *p, Lisp_Object val)
365{ 365{
366 p->encoding_buf = val; 366 p->encoding_buf = val;
367} 367}
368static inline void 368static void
369pset_filter (struct Lisp_Process *p, Lisp_Object val) 369pset_filter (struct Lisp_Process *p, Lisp_Object val)
370{ 370{
371 p->filter = val; 371 p->filter = val;
372} 372}
373static inline void 373static void
374pset_log (struct Lisp_Process *p, Lisp_Object val) 374pset_log (struct Lisp_Process *p, Lisp_Object val)
375{ 375{
376 p->log = val; 376 p->log = val;
377} 377}
378static inline void 378static void
379pset_mark (struct Lisp_Process *p, Lisp_Object val) 379pset_mark (struct Lisp_Process *p, Lisp_Object val)
380{ 380{
381 p->mark = val; 381 p->mark = val;
382} 382}
383static inline void 383static void
384pset_name (struct Lisp_Process *p, Lisp_Object val) 384pset_name (struct Lisp_Process *p, Lisp_Object val)
385{ 385{
386 p->name = val; 386 p->name = val;
387} 387}
388static inline void 388static void
389pset_plist (struct Lisp_Process *p, Lisp_Object val) 389pset_plist (struct Lisp_Process *p, Lisp_Object val)
390{ 390{
391 p->plist = val; 391 p->plist = val;
392} 392}
393static inline void 393static void
394pset_sentinel (struct Lisp_Process *p, Lisp_Object val) 394pset_sentinel (struct Lisp_Process *p, Lisp_Object val)
395{ 395{
396 p->sentinel = val; 396 p->sentinel = val;
397} 397}
398static inline void 398static void
399pset_status (struct Lisp_Process *p, Lisp_Object val) 399pset_status (struct Lisp_Process *p, Lisp_Object val)
400{ 400{
401 p->status = val; 401 p->status = val;
402} 402}
403static inline void 403static void
404pset_tty_name (struct Lisp_Process *p, Lisp_Object val) 404pset_tty_name (struct Lisp_Process *p, Lisp_Object val)
405{ 405{
406 p->tty_name = val; 406 p->tty_name = val;
407} 407}
408static inline void 408static void
409pset_type (struct Lisp_Process *p, Lisp_Object val) 409pset_type (struct Lisp_Process *p, Lisp_Object val)
410{ 410{
411 p->type = val; 411 p->type = val;
412} 412}
413static inline void 413static void
414pset_write_queue (struct Lisp_Process *p, Lisp_Object val) 414pset_write_queue (struct Lisp_Process *p, Lisp_Object val)
415{ 415{
416 p->write_queue = val; 416 p->write_queue = val;
@@ -570,7 +570,7 @@ status_message (struct Lisp_Process *p)
570 570
571 if (EQ (symbol, Qsignal) || EQ (symbol, Qstop)) 571 if (EQ (symbol, Qsignal) || EQ (symbol, Qstop))
572 { 572 {
573 char *signame; 573 char const *signame;
574 synchronize_system_messages_locale (); 574 synchronize_system_messages_locale ();
575 signame = strsignal (code); 575 signame = strsignal (code);
576 if (signame == 0) 576 if (signame == 0)
diff --git a/src/profiler.c b/src/profiler.c
index 90a85c5230e..51580710f28 100644
--- a/src/profiler.c
+++ b/src/profiler.c
@@ -128,8 +128,8 @@ static void evict_lower_half (log_t *log)
128} 128}
129 129
130/* Record the current backtrace in LOG. COUNT is the weight of this 130/* Record the current backtrace in LOG. COUNT is the weight of this
131 current backtrace: milliseconds for CPU counts, and the allocation 131 current backtrace: interrupt counts for CPU, and the allocation
132 size for memory logs. */ 132 size for memory. */
133 133
134static void 134static void
135record_backtrace (log_t *log, EMACS_INT count) 135record_backtrace (log_t *log, EMACS_INT count)
@@ -198,15 +198,13 @@ record_backtrace (log_t *log, EMACS_INT count)
198 } 198 }
199} 199}
200 200
201/* Sample profiler. */ 201/* Sampling profiler. */
202
203/* FIXME: Add support for the CPU profiler in W32. */
204 202
205#ifdef PROFILER_CPU_SUPPORT 203#ifdef PROFILER_CPU_SUPPORT
206 204
207/* The profiler timer and whether it was properly initialized, if 205/* The profiler timer and whether it was properly initialized, if
208 POSIX timers are available. */ 206 POSIX timers are available. */
209#ifdef HAVE_TIMER_SETTIME 207#ifdef HAVE_ITIMERSPEC
210static timer_t profiler_timer; 208static timer_t profiler_timer;
211static bool profiler_timer_ok; 209static bool profiler_timer_ok;
212#endif 210#endif
@@ -222,10 +220,10 @@ static Lisp_Object cpu_log;
222/* Separate counter for the time spent in the GC. */ 220/* Separate counter for the time spent in the GC. */
223static EMACS_INT cpu_gc_count; 221static EMACS_INT cpu_gc_count;
224 222
225/* The current sample interval in milliseconds. */ 223/* The current sampling interval in nanoseconds. */
226static EMACS_INT current_sample_interval; 224static EMACS_INT current_sampling_interval;
227 225
228/* Signal handler for sample profiler. */ 226/* Signal handler for sampling profiler. */
229 227
230static void 228static void
231handle_profiler_signal (int signal) 229handle_profiler_signal (int signal)
@@ -237,11 +235,33 @@ handle_profiler_signal (int signal)
237 not expect the ARRAY_MARK_FLAG to be set. We could try and 235 not expect the ARRAY_MARK_FLAG to be set. We could try and
238 harden the hash-table code, but it doesn't seem worth the 236 harden the hash-table code, but it doesn't seem worth the
239 effort. */ 237 effort. */
240 cpu_gc_count = saturated_add (cpu_gc_count, current_sample_interval); 238 cpu_gc_count = saturated_add (cpu_gc_count, 1);
241 else 239 else
242 { 240 {
241 Lisp_Object oquit;
242 bool saved_pending_signals;
243 EMACS_INT count = 1;
244#ifdef HAVE_ITIMERSPEC
245 if (profiler_timer_ok)
246 {
247 int overruns = timer_getoverrun (profiler_timer);
248 eassert (0 <= overruns);
249 count += overruns;
250 }
251#endif
252 /* record_backtrace uses hash functions that call Fequal, which
253 uses QUIT, which can call malloc, which can cause disaster in
254 a signal handler. So inhibit QUIT. */
255 oquit = Vinhibit_quit;
256 saved_pending_signals = pending_signals;
257 Vinhibit_quit = Qt;
258 pending_signals = 0;
259
243 eassert (HASH_TABLE_P (cpu_log)); 260 eassert (HASH_TABLE_P (cpu_log));
244 record_backtrace (XHASH_TABLE (cpu_log), current_sample_interval); 261 record_backtrace (XHASH_TABLE (cpu_log), count);
262
263 Vinhibit_quit = oquit;
264 pending_signals = saved_pending_signals;
245 } 265 }
246} 266}
247 267
@@ -252,25 +272,27 @@ deliver_profiler_signal (int signal)
252} 272}
253 273
254static enum profiler_cpu_running 274static enum profiler_cpu_running
255setup_cpu_timer (Lisp_Object sample_interval) 275setup_cpu_timer (Lisp_Object sampling_interval)
256{ 276{
257 struct sigaction action; 277 struct sigaction action;
258 struct itimerval timer; 278 struct itimerval timer;
259 struct timespec interval; 279 struct timespec interval;
280 int billion = 1000000000;
260 281
261 if (! RANGED_INTEGERP (1, sample_interval, 282 if (! RANGED_INTEGERP (1, sampling_interval,
262 (TYPE_MAXIMUM (time_t) < EMACS_INT_MAX / 1000 283 (TYPE_MAXIMUM (time_t) < EMACS_INT_MAX / billion
263 ? (EMACS_INT) TYPE_MAXIMUM (time_t) * 1000 + 999 284 ? ((EMACS_INT) TYPE_MAXIMUM (time_t) * billion
285 + (billion - 1))
264 : EMACS_INT_MAX))) 286 : EMACS_INT_MAX)))
265 return NOT_RUNNING; 287 return NOT_RUNNING;
266 288
267 current_sample_interval = XINT (sample_interval); 289 current_sampling_interval = XINT (sampling_interval);
268 interval = make_emacs_time (current_sample_interval / 1000, 290 interval = make_emacs_time (current_sampling_interval / billion,
269 current_sample_interval % 1000 * 1000000); 291 current_sampling_interval % billion);
270 emacs_sigaction_init (&action, deliver_profiler_signal); 292 emacs_sigaction_init (&action, deliver_profiler_signal);
271 sigaction (SIGPROF, &action, 0); 293 sigaction (SIGPROF, &action, 0);
272 294
273#ifdef HAVE_TIMER_SETTIME 295#ifdef HAVE_ITIMERSPEC
274 if (! profiler_timer_ok) 296 if (! profiler_timer_ok)
275 { 297 {
276 /* System clocks to try, in decreasing order of desirability. */ 298 /* System clocks to try, in decreasing order of desirability. */
@@ -304,25 +326,29 @@ setup_cpu_timer (Lisp_Object sample_interval)
304 { 326 {
305 struct itimerspec ispec; 327 struct itimerspec ispec;
306 ispec.it_value = ispec.it_interval = interval; 328 ispec.it_value = ispec.it_interval = interval;
307 timer_settime (profiler_timer, 0, &ispec, 0); 329 if (timer_settime (profiler_timer, 0, &ispec, 0) == 0)
308 return TIMER_SETTIME_RUNNING; 330 return TIMER_SETTIME_RUNNING;
309 } 331 }
310#endif 332#endif
311 333
334#ifdef HAVE_SETITIMER
312 timer.it_value = timer.it_interval = make_timeval (interval); 335 timer.it_value = timer.it_interval = make_timeval (interval);
313 setitimer (ITIMER_PROF, &timer, 0); 336 if (setitimer (ITIMER_PROF, &timer, 0) == 0)
314 return SETITIMER_RUNNING; 337 return SETITIMER_RUNNING;
338#endif
339
340 return NOT_RUNNING;
315} 341}
316 342
317DEFUN ("profiler-cpu-start", Fprofiler_cpu_start, Sprofiler_cpu_start, 343DEFUN ("profiler-cpu-start", Fprofiler_cpu_start, Sprofiler_cpu_start,
318 1, 1, 0, 344 1, 1, 0,
319 doc: /* Start or restart the cpu profiler. 345 doc: /* Start or restart the cpu profiler.
320It takes call-stack samples each SAMPLE-INTERVAL milliseconds. 346It takes call-stack samples each SAMPLING-INTERVAL nanoseconds, approximately.
321See also `profiler-log-size' and `profiler-max-stack-depth'. */) 347See also `profiler-log-size' and `profiler-max-stack-depth'. */)
322 (Lisp_Object sample_interval) 348 (Lisp_Object sampling_interval)
323{ 349{
324 if (profiler_cpu_running) 350 if (profiler_cpu_running)
325 error ("Sample profiler is already running"); 351 error ("CPU profiler is already running");
326 352
327 if (NILP (cpu_log)) 353 if (NILP (cpu_log))
328 { 354 {
@@ -331,9 +357,9 @@ See also `profiler-log-size' and `profiler-max-stack-depth'. */)
331 profiler_max_stack_depth); 357 profiler_max_stack_depth);
332 } 358 }
333 359
334 profiler_cpu_running = setup_cpu_timer (sample_interval); 360 profiler_cpu_running = setup_cpu_timer (sampling_interval);
335 if (! profiler_cpu_running) 361 if (! profiler_cpu_running)
336 error ("Invalid sample interval"); 362 error ("Invalid sampling interval");
337 363
338 return Qt; 364 return Qt;
339} 365}
@@ -349,7 +375,7 @@ Return non-nil if the profiler was running. */)
349 case NOT_RUNNING: 375 case NOT_RUNNING:
350 return Qnil; 376 return Qnil;
351 377
352#ifdef HAVE_TIMER_SETTIME 378#ifdef HAVE_ITIMERSPEC
353 case TIMER_SETTIME_RUNNING: 379 case TIMER_SETTIME_RUNNING:
354 { 380 {
355 struct itimerspec disable; 381 struct itimerspec disable;
@@ -359,6 +385,7 @@ Return non-nil if the profiler was running. */)
359 break; 385 break;
360#endif 386#endif
361 387
388#ifdef HAVE_SETITIMER
362 case SETITIMER_RUNNING: 389 case SETITIMER_RUNNING:
363 { 390 {
364 struct itimerval disable; 391 struct itimerval disable;
@@ -366,6 +393,7 @@ Return non-nil if the profiler was running. */)
366 setitimer (ITIMER_PROF, &disable, 0); 393 setitimer (ITIMER_PROF, &disable, 0);
367 } 394 }
368 break; 395 break;
396#endif
369 } 397 }
370 398
371 signal (SIGPROF, SIG_IGN); 399 signal (SIGPROF, SIG_IGN);
diff --git a/src/ralloc.c b/src/ralloc.c
index ab91baae5b5..e4a8fe9c6da 100644
--- a/src/ralloc.c
+++ b/src/ralloc.c
@@ -72,7 +72,7 @@ static void r_alloc_init (void);
72/* Declarations for working with the malloc, ralloc, and system breaks. */ 72/* Declarations for working with the malloc, ralloc, and system breaks. */
73 73
74/* Function to set the real break value. */ 74/* Function to set the real break value. */
75POINTER (*real_morecore) (long int); 75POINTER (*real_morecore) (ptrdiff_t);
76 76
77/* The break value, as seen by malloc. */ 77/* The break value, as seen by malloc. */
78static POINTER virtual_break_value; 78static POINTER virtual_break_value;
@@ -91,18 +91,18 @@ static int extra_bytes;
91/* Macros for rounding. Note that rounding to any value is possible 91/* Macros for rounding. Note that rounding to any value is possible
92 by changing the definition of PAGE. */ 92 by changing the definition of PAGE. */
93#define PAGE (getpagesize ()) 93#define PAGE (getpagesize ())
94#define ROUNDUP(size) (((unsigned long int) (size) + page_size - 1) \ 94#define ROUNDUP(size) (((size_t) (size) + page_size - 1) \
95 & ~(page_size - 1)) 95 & ~((size_t)(page_size - 1)))
96 96
97#define MEM_ALIGN sizeof (double) 97#define MEM_ALIGN sizeof (double)
98#define MEM_ROUNDUP(addr) (((unsigned long int)(addr) + MEM_ALIGN - 1) \ 98#define MEM_ROUNDUP(addr) (((size_t)(addr) + MEM_ALIGN - 1) \
99 & ~(MEM_ALIGN - 1)) 99 & ~(MEM_ALIGN - 1))
100 100
101/* The hook `malloc' uses for the function which gets more space 101/* The hook `malloc' uses for the function which gets more space
102 from the system. */ 102 from the system. */
103 103
104#ifndef SYSTEM_MALLOC 104#ifndef SYSTEM_MALLOC
105extern POINTER (*__morecore) (long int); 105extern POINTER (*__morecore) (ptrdiff_t);
106#endif 106#endif
107 107
108 108
@@ -308,7 +308,7 @@ static void
308relinquish (void) 308relinquish (void)
309{ 309{
310 register heap_ptr h; 310 register heap_ptr h;
311 long excess = 0; 311 ptrdiff_t excess = 0;
312 312
313 /* Add the amount of space beyond break_value 313 /* Add the amount of space beyond break_value
314 in all heaps which have extend beyond break_value at all. */ 314 in all heaps which have extend beyond break_value at all. */
@@ -752,7 +752,7 @@ free_bloc (bloc_ptr bloc)
752 GNU malloc package. */ 752 GNU malloc package. */
753 753
754static POINTER 754static POINTER
755r_alloc_sbrk (long int size) 755r_alloc_sbrk (ptrdiff_t size)
756{ 756{
757 register bloc_ptr b; 757 register bloc_ptr b;
758 POINTER address; 758 POINTER address;
diff --git a/src/syntax.c b/src/syntax.c
index 91ef4e66663..d3cafcc472e 100644
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -151,7 +151,7 @@ static void scan_sexps_forward (struct lisp_parse_state *,
151static int in_classes (int, Lisp_Object); 151static int in_classes (int, Lisp_Object);
152 152
153/* This setter is used only in this file, so it can be private. */ 153/* This setter is used only in this file, so it can be private. */
154static inline void 154static void
155bset_syntax_table (struct buffer *b, Lisp_Object val) 155bset_syntax_table (struct buffer *b, Lisp_Object val)
156{ 156{
157 b->INTERNAL_FIELD (syntax_table) = val; 157 b->INTERNAL_FIELD (syntax_table) = val;
@@ -372,7 +372,7 @@ char_quoted (ptrdiff_t charpos, ptrdiff_t bytepos)
372/* Return the bytepos one character before BYTEPOS. 372/* Return the bytepos one character before BYTEPOS.
373 We assume that BYTEPOS is not at the start of the buffer. */ 373 We assume that BYTEPOS is not at the start of the buffer. */
374 374
375static inline ptrdiff_t 375static ptrdiff_t
376dec_bytepos (ptrdiff_t bytepos) 376dec_bytepos (ptrdiff_t bytepos)
377{ 377{
378 if (NILP (BVAR (current_buffer, enable_multibyte_characters))) 378 if (NILP (BVAR (current_buffer, enable_multibyte_characters)))
diff --git a/src/sysdep.c b/src/sysdep.c
index b7141011d05..74617fcaf0f 100644
--- a/src/sysdep.c
+++ b/src/sysdep.c
@@ -54,6 +54,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
54#ifdef WINDOWSNT 54#ifdef WINDOWSNT
55#define read sys_read 55#define read sys_read
56#define write sys_write 56#define write sys_write
57#ifndef STDERR_FILENO
58#define STDERR_FILENO fileno(GetStdHandle(STD_ERROR_HANDLE))
59#endif
57#include <windows.h> 60#include <windows.h>
58#endif /* not WINDOWSNT */ 61#endif /* not WINDOWSNT */
59 62
@@ -1540,12 +1543,10 @@ deliver_thread_signal (int sig, signal_handler_t handler)
1540 errno = old_errno; 1543 errno = old_errno;
1541} 1544}
1542 1545
1543#if !defined HAVE_STRSIGNAL && !HAVE_DECL_SYS_SIGLIST 1546#if !HAVE_DECL_SYS_SIGLIST
1544static char *my_sys_siglist[NSIG]; 1547# undef sys_siglist
1545# ifdef sys_siglist
1546# undef sys_siglist
1547# endif
1548# define sys_siglist my_sys_siglist 1548# define sys_siglist my_sys_siglist
1549static char const *sys_siglist[NSIG];
1549#endif 1550#endif
1550 1551
1551/* Handle bus errors, invalid instruction, etc. */ 1552/* Handle bus errors, invalid instruction, etc. */
@@ -1608,7 +1609,7 @@ init_signals (bool dumping)
1608 main_thread = pthread_self (); 1609 main_thread = pthread_self ();
1609#endif 1610#endif
1610 1611
1611#if !defined HAVE_STRSIGNAL && !HAVE_DECL_SYS_SIGLIST 1612#if !HAVE_DECL_SYS_SIGLIST
1612 if (! initialized) 1613 if (! initialized)
1613 { 1614 {
1614 sys_siglist[SIGABRT] = "Aborted"; 1615 sys_siglist[SIGABRT] = "Aborted";
@@ -1756,7 +1757,7 @@ init_signals (bool dumping)
1756 sys_siglist[SIGXFSZ] = "File size limit exceeded"; 1757 sys_siglist[SIGXFSZ] = "File size limit exceeded";
1757# endif 1758# endif
1758 } 1759 }
1759#endif /* !defined HAVE_STRSIGNAL && !defined HAVE_DECL_SYS_SIGLIST */ 1760#endif /* !HAVE_DECL_SYS_SIGLIST */
1760 1761
1761 /* Don't alter signal handlers if dumping. On some machines, 1762 /* Don't alter signal handlers if dumping. On some machines,
1762 changing signal handlers sets static data that would make signals 1763 changing signal handlers sets static data that would make signals
@@ -2277,21 +2278,20 @@ set_file_times (int fd, const char *filename,
2277 return fdutimens (fd, filename, timespec); 2278 return fdutimens (fd, filename, timespec);
2278} 2279}
2279 2280
2280#ifndef HAVE_STRSIGNAL 2281/* Like strsignal, except async-signal-safe, and this function typically
2281char * 2282 returns a string in the C locale rather than the current locale. */
2282strsignal (int code) 2283char const *
2284safe_strsignal (int code)
2283{ 2285{
2284 char *signame = 0; 2286 char const *signame = 0;
2285 2287
2286 if (0 <= code && code < NSIG) 2288 if (0 <= code && code < NSIG)
2287 { 2289 signame = sys_siglist[code];
2288 /* Cast to suppress warning if the table has const char *. */ 2290 if (! signame)
2289 signame = (char *) sys_siglist[code]; 2291 signame = "Unknown signal";
2290 }
2291 2292
2292 return signame; 2293 return signame;
2293} 2294}
2294#endif /* HAVE_STRSIGNAL */
2295 2295
2296#ifndef DOS_NT 2296#ifndef DOS_NT
2297/* For make-serial-process */ 2297/* For make-serial-process */
diff --git a/src/syssignal.h b/src/syssignal.h
index ece2515dec9..83ab19698dd 100644
--- a/src/syssignal.h
+++ b/src/syssignal.h
@@ -29,8 +29,12 @@ extern void init_signals (bool);
29#define FORWARD_SIGNAL_TO_MAIN_THREAD 29#define FORWARD_SIGNAL_TO_MAIN_THREAD
30#endif 30#endif
31 31
32#if (defined SIGPROF && (defined HAVE_TIMER_SETTIME || defined HAVE_SETITIMER) \ 32#if defined HAVE_TIMER_SETTIME && defined SIGEV_SIGNAL
33 && !defined PROFILING) 33# define HAVE_ITIMERSPEC
34#endif
35
36#if (defined SIGPROF && !defined PROFILING \
37 && (defined HAVE_SETITIMER || defined HAVE_ITIMERSPEC))
34# define PROFILER_CPU_SUPPORT 38# define PROFILER_CPU_SUPPORT
35#endif 39#endif
36 40
@@ -39,6 +43,7 @@ extern sigset_t empty_mask;
39typedef void (*signal_handler_t) (int); 43typedef void (*signal_handler_t) (int);
40 44
41extern void emacs_sigaction_init (struct sigaction *, signal_handler_t); 45extern void emacs_sigaction_init (struct sigaction *, signal_handler_t);
46char const *safe_strsignal (int);
42 47
43#if NSIG < NSIG_MINIMUM 48#if NSIG < NSIG_MINIMUM
44# undef NSIG 49# undef NSIG
@@ -70,8 +75,7 @@ extern void emacs_sigaction_init (struct sigaction *, signal_handler_t);
70#endif /* ! defined (SIGCLD) */ 75#endif /* ! defined (SIGCLD) */
71 76
72#ifndef HAVE_STRSIGNAL 77#ifndef HAVE_STRSIGNAL
73/* strsignal is in sysdep.c */ 78# define strsignal(sig) safe_strsignal (sig)
74char *strsignal (int);
75#endif 79#endif
76 80
77void deliver_process_signal (int, signal_handler_t); 81void deliver_process_signal (int, signal_handler_t);
diff --git a/src/terminal.c b/src/terminal.c
index 719c2a36111..2c0c60e7345 100644
--- a/src/terminal.c
+++ b/src/terminal.c
@@ -42,7 +42,7 @@ struct terminal *initial_terminal;
42static void delete_initial_terminal (struct terminal *); 42static void delete_initial_terminal (struct terminal *);
43 43
44/* This setter is used only in this file, so it can be private. */ 44/* This setter is used only in this file, so it can be private. */
45static inline void 45static void
46tset_param_alist (struct terminal *t, Lisp_Object val) 46tset_param_alist (struct terminal *t, Lisp_Object val)
47{ 47{
48 t->param_alist = val; 48 t->param_alist = val;
diff --git a/src/textprop.c b/src/textprop.c
index 872912ea706..379eafb73f7 100644
--- a/src/textprop.c
+++ b/src/textprop.c
@@ -241,7 +241,7 @@ interval_has_all_properties (Lisp_Object plist, INTERVAL i)
241/* Return nonzero if the plist of interval I has any of the 241/* Return nonzero if the plist of interval I has any of the
242 properties of PLIST, regardless of their values. */ 242 properties of PLIST, regardless of their values. */
243 243
244static inline int 244static int
245interval_has_some_properties (Lisp_Object plist, INTERVAL i) 245interval_has_some_properties (Lisp_Object plist, INTERVAL i)
246{ 246{
247 register Lisp_Object tail1, tail2, sym; 247 register Lisp_Object tail1, tail2, sym;
@@ -263,7 +263,7 @@ interval_has_some_properties (Lisp_Object plist, INTERVAL i)
263/* Return nonzero if the plist of interval I has any of the 263/* Return nonzero if the plist of interval I has any of the
264 property names in LIST, regardless of their values. */ 264 property names in LIST, regardless of their values. */
265 265
266static inline int 266static int
267interval_has_some_properties_list (Lisp_Object list, INTERVAL i) 267interval_has_some_properties_list (Lisp_Object list, INTERVAL i)
268{ 268{
269 register Lisp_Object tail1, tail2, sym; 269 register Lisp_Object tail1, tail2, sym;
diff --git a/src/unexmacosx.c b/src/unexmacosx.c
index d38b91e955a..d304e85d490 100644
--- a/src/unexmacosx.c
+++ b/src/unexmacosx.c
@@ -119,7 +119,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
119 119
120/* LC_DATA_IN_CODE is not defined in mach-o/loader.h on OS X 10.7. 120/* LC_DATA_IN_CODE is not defined in mach-o/loader.h on OS X 10.7.
121 But it is used if we build with "Command Line Tools for Xcode 4.5 121 But it is used if we build with "Command Line Tools for Xcode 4.5
122 (OS X Lion) - Septemper 2012". */ 122 (OS X Lion) - September 2012". */
123#ifndef LC_DATA_IN_CODE 123#ifndef LC_DATA_IN_CODE
124#define LC_DATA_IN_CODE 0x29 /* table of non-instructions in __text */ 124#define LC_DATA_IN_CODE 0x29 /* table of non-instructions in __text */
125#endif 125#endif
diff --git a/src/unexw32.c b/src/unexw32.c
index 52b2ec4bf2b..3eefc9ce058 100644
--- a/src/unexw32.c
+++ b/src/unexw32.c
@@ -67,18 +67,18 @@ void dump_bss_and_heap (file_data *p_infile, file_data *p_outfile);
67/* Cached info about the .data section in the executable. */ 67/* Cached info about the .data section in the executable. */
68PIMAGE_SECTION_HEADER data_section; 68PIMAGE_SECTION_HEADER data_section;
69PCHAR data_start = 0; 69PCHAR data_start = 0;
70DWORD data_size = 0; 70DWORD_PTR data_size = 0;
71 71
72/* Cached info about the .bss section in the executable. */ 72/* Cached info about the .bss section in the executable. */
73PIMAGE_SECTION_HEADER bss_section; 73PIMAGE_SECTION_HEADER bss_section;
74PCHAR bss_start = 0; 74PCHAR bss_start = 0;
75DWORD bss_size = 0; 75DWORD_PTR bss_size = 0;
76DWORD extra_bss_size = 0; 76DWORD_PTR extra_bss_size = 0;
77/* bss data that is static might be discontiguous from non-static. */ 77/* bss data that is static might be discontiguous from non-static. */
78PIMAGE_SECTION_HEADER bss_section_static; 78PIMAGE_SECTION_HEADER bss_section_static;
79PCHAR bss_start_static = 0; 79PCHAR bss_start_static = 0;
80DWORD bss_size_static = 0; 80DWORD_PTR bss_size_static = 0;
81DWORD extra_bss_size_static = 0; 81DWORD_PTR extra_bss_size_static = 0;
82 82
83PIMAGE_SECTION_HEADER heap_section; 83PIMAGE_SECTION_HEADER heap_section;
84 84
@@ -231,7 +231,7 @@ find_section (char * name, IMAGE_NT_HEADERS * nt_header)
231/* Return pointer to section header for section containing the given 231/* Return pointer to section header for section containing the given
232 relative virtual address. */ 232 relative virtual address. */
233IMAGE_SECTION_HEADER * 233IMAGE_SECTION_HEADER *
234rva_to_section (DWORD rva, IMAGE_NT_HEADERS * nt_header) 234rva_to_section (DWORD_PTR rva, IMAGE_NT_HEADERS * nt_header)
235{ 235{
236 PIMAGE_SECTION_HEADER section; 236 PIMAGE_SECTION_HEADER section;
237 int i; 237 int i;
@@ -246,7 +246,7 @@ rva_to_section (DWORD rva, IMAGE_NT_HEADERS * nt_header)
246 some very old exes (eg. gzip dated Dec 1993). Since 246 some very old exes (eg. gzip dated Dec 1993). Since
247 w32_executable_type relies on this function to work reliably, 247 w32_executable_type relies on this function to work reliably,
248 we need to cope with this. */ 248 we need to cope with this. */
249 DWORD real_size = max (section->SizeOfRawData, 249 DWORD_PTR real_size = max (section->SizeOfRawData,
250 section->Misc.VirtualSize); 250 section->Misc.VirtualSize);
251 if (rva >= section->VirtualAddress 251 if (rva >= section->VirtualAddress
252 && rva < section->VirtualAddress + real_size) 252 && rva < section->VirtualAddress + real_size)
@@ -259,7 +259,7 @@ rva_to_section (DWORD rva, IMAGE_NT_HEADERS * nt_header)
259/* Return pointer to section header for section containing the given 259/* Return pointer to section header for section containing the given
260 offset in its raw data area. */ 260 offset in its raw data area. */
261IMAGE_SECTION_HEADER * 261IMAGE_SECTION_HEADER *
262offset_to_section (DWORD offset, IMAGE_NT_HEADERS * nt_header) 262offset_to_section (DWORD_PTR offset, IMAGE_NT_HEADERS * nt_header)
263{ 263{
264 PIMAGE_SECTION_HEADER section; 264 PIMAGE_SECTION_HEADER section;
265 int i; 265 int i;
@@ -279,8 +279,8 @@ offset_to_section (DWORD offset, IMAGE_NT_HEADERS * nt_header)
279/* Return offset to an object in dst, given offset in src. We assume 279/* Return offset to an object in dst, given offset in src. We assume
280 there is at least one section in both src and dst images, and that 280 there is at least one section in both src and dst images, and that
281 the some sections may have been added to dst (after sections in src). */ 281 the some sections may have been added to dst (after sections in src). */
282DWORD 282DWORD_PTR
283relocate_offset (DWORD offset, 283relocate_offset (DWORD_PTR offset,
284 IMAGE_NT_HEADERS * src_nt_header, 284 IMAGE_NT_HEADERS * src_nt_header,
285 IMAGE_NT_HEADERS * dst_nt_header) 285 IMAGE_NT_HEADERS * dst_nt_header)
286{ 286{
@@ -314,25 +314,25 @@ relocate_offset (DWORD offset,
314} 314}
315 315
316#define OFFSET_TO_RVA(offset, section) \ 316#define OFFSET_TO_RVA(offset, section) \
317 (section->VirtualAddress + ((DWORD)(offset) - section->PointerToRawData)) 317 ((section)->VirtualAddress + ((DWORD_PTR)(offset) - (section)->PointerToRawData))
318 318
319#define RVA_TO_OFFSET(rva, section) \ 319#define RVA_TO_OFFSET(rva, section) \
320 (section->PointerToRawData + ((DWORD)(rva) - section->VirtualAddress)) 320 ((section)->PointerToRawData + ((DWORD_PTR)(rva) - (section)->VirtualAddress))
321 321
322#define RVA_TO_SECTION_OFFSET(rva, section) \ 322#define RVA_TO_SECTION_OFFSET(rva, section) \
323 ((DWORD)(rva) - section->VirtualAddress) 323 ((DWORD_PTR)(rva) - (section)->VirtualAddress)
324 324
325/* Convert address in executing image to RVA. */ 325/* Convert address in executing image to RVA. */
326#define PTR_TO_RVA(ptr) ((DWORD)(ptr) - (DWORD) GetModuleHandle (NULL)) 326#define PTR_TO_RVA(ptr) ((DWORD_PTR)(ptr) - (DWORD_PTR) GetModuleHandle (NULL))
327 327
328#define RVA_TO_PTR(var,section,filedata) \ 328#define RVA_TO_PTR(var,section,filedata) \
329 ((void *)(RVA_TO_OFFSET (var,section) + (filedata).file_base)) 329 ((unsigned char *)(RVA_TO_OFFSET (var,section) + (filedata).file_base))
330 330
331#define PTR_TO_OFFSET(ptr, pfile_data) \ 331#define PTR_TO_OFFSET(ptr, pfile_data) \
332 ((unsigned char *)(ptr) - (pfile_data)->file_base) 332 ((unsigned char *)(ptr) - (pfile_data)->file_base)
333 333
334#define OFFSET_TO_PTR(offset, pfile_data) \ 334#define OFFSET_TO_PTR(offset, pfile_data) \
335 ((pfile_data)->file_base + (DWORD)(offset)) 335 ((pfile_data)->file_base + (DWORD_PTR)(offset))
336 336
337 337
338/* Flip through the executable and cache the info necessary for dumping. */ 338/* Flip through the executable and cache the info necessary for dumping. */
@@ -349,7 +349,7 @@ get_section_info (file_data *p_infile)
349 printf ("Unknown EXE header in %s...bailing.\n", p_infile->name); 349 printf ("Unknown EXE header in %s...bailing.\n", p_infile->name);
350 exit (1); 350 exit (1);
351 } 351 }
352 nt_header = (PIMAGE_NT_HEADERS) (((unsigned long) dos_header) + 352 nt_header = (PIMAGE_NT_HEADERS) (((DWORD_PTR) dos_header) +
353 dos_header->e_lfanew); 353 dos_header->e_lfanew);
354 if (nt_header == NULL) 354 if (nt_header == NULL)
355 { 355 {
@@ -488,7 +488,7 @@ copy_executable_and_dump_data (file_data *p_infile,
488 PIMAGE_NT_HEADERS dst_nt_header; 488 PIMAGE_NT_HEADERS dst_nt_header;
489 PIMAGE_SECTION_HEADER section; 489 PIMAGE_SECTION_HEADER section;
490 PIMAGE_SECTION_HEADER dst_section; 490 PIMAGE_SECTION_HEADER dst_section;
491 DWORD offset; 491 DWORD_PTR offset;
492 int i; 492 int i;
493 int be_verbose = GetEnvironmentVariable ("DEBUG_DUMP", NULL, 0) > 0; 493 int be_verbose = GetEnvironmentVariable ("DEBUG_DUMP", NULL, 0) > 0;
494 494
@@ -541,17 +541,17 @@ copy_executable_and_dump_data (file_data *p_infile,
541 Note that dst is updated implicitly by each COPY_CHUNK. */ 541 Note that dst is updated implicitly by each COPY_CHUNK. */
542 542
543 dos_header = (PIMAGE_DOS_HEADER) p_infile->file_base; 543 dos_header = (PIMAGE_DOS_HEADER) p_infile->file_base;
544 nt_header = (PIMAGE_NT_HEADERS) (((unsigned long) dos_header) + 544 nt_header = (PIMAGE_NT_HEADERS) (((DWORD_PTR) dos_header) +
545 dos_header->e_lfanew); 545 dos_header->e_lfanew);
546 section = IMAGE_FIRST_SECTION (nt_header); 546 section = IMAGE_FIRST_SECTION (nt_header);
547 547
548 dst = (unsigned char *) p_outfile->file_base; 548 dst = (unsigned char *) p_outfile->file_base;
549 549
550 COPY_CHUNK ("Copying DOS header...", dos_header, 550 COPY_CHUNK ("Copying DOS header...", dos_header,
551 (DWORD) nt_header - (DWORD) dos_header, be_verbose); 551 (DWORD_PTR) nt_header - (DWORD_PTR) dos_header, be_verbose);
552 dst_nt_header = (PIMAGE_NT_HEADERS) dst; 552 dst_nt_header = (PIMAGE_NT_HEADERS) dst;
553 COPY_CHUNK ("Copying NT header...", nt_header, 553 COPY_CHUNK ("Copying NT header...", nt_header,
554 (DWORD) section - (DWORD) nt_header, be_verbose); 554 (DWORD_PTR) section - (DWORD_PTR) nt_header, be_verbose);
555 dst_section = (PIMAGE_SECTION_HEADER) dst; 555 dst_section = (PIMAGE_SECTION_HEADER) dst;
556 COPY_CHUNK ("Copying section table...", section, 556 COPY_CHUNK ("Copying section table...", section,
557 nt_header->FileHeader.NumberOfSections * sizeof (*section), 557 nt_header->FileHeader.NumberOfSections * sizeof (*section),
@@ -627,8 +627,8 @@ copy_executable_and_dump_data (file_data *p_infile,
627 } 627 }
628 if (section == heap_section) 628 if (section == heap_section)
629 { 629 {
630 DWORD heap_start = (DWORD) get_heap_start (); 630 DWORD_PTR heap_start = (DWORD_PTR) get_heap_start ();
631 DWORD heap_size = get_committed_heap_size (); 631 DWORD_PTR heap_size = get_committed_heap_size ();
632 632
633 /* Dump the used portion of the predump heap, adjusting the 633 /* Dump the used portion of the predump heap, adjusting the
634 section's size to the appropriate size. */ 634 section's size to the appropriate size. */
diff --git a/src/vm-limit.c b/src/vm-limit.c
index 8de0acd1bb2..3020b84858a 100644
--- a/src/vm-limit.c
+++ b/src/vm-limit.c
@@ -41,7 +41,7 @@ static void (*warn_function) (const char *);
41static POINTER data_space_start; 41static POINTER data_space_start;
42 42
43/* Number of bytes of writable memory we can expect to be able to get. */ 43/* Number of bytes of writable memory we can expect to be able to get. */
44static unsigned long lim_data; 44static size_t lim_data;
45 45
46 46
47#if defined (HAVE_GETRLIMIT) && defined (RLIMIT_AS) 47#if defined (HAVE_GETRLIMIT) && defined (RLIMIT_AS)
@@ -88,7 +88,7 @@ get_lim_data (void)
88static void 88static void
89get_lim_data (void) 89get_lim_data (void)
90{ 90{
91 extern unsigned long reserved_heap_size; 91 extern size_t reserved_heap_size;
92 lim_data = reserved_heap_size; 92 lim_data = reserved_heap_size;
93} 93}
94 94
@@ -166,13 +166,13 @@ static void
166check_memory_limits (void) 166check_memory_limits (void)
167{ 167{
168#ifdef REL_ALLOC 168#ifdef REL_ALLOC
169 extern POINTER (*real_morecore) (long); 169 extern POINTER (*real_morecore) (ptrdiff_t);
170#endif 170#endif
171 extern POINTER (*__morecore) (long); 171 extern POINTER (*__morecore) (ptrdiff_t);
172 172
173 register POINTER cp; 173 register POINTER cp;
174 unsigned long five_percent; 174 size_t five_percent;
175 unsigned long data_size; 175 size_t data_size;
176 enum warnlevel new_warnlevel; 176 enum warnlevel new_warnlevel;
177 177
178 if (lim_data == 0) 178 if (lim_data == 0)
diff --git a/src/w32.c b/src/w32.c
index 3154c725abf..f17c06ea807 100644
--- a/src/w32.c
+++ b/src/w32.c
@@ -1528,52 +1528,6 @@ is_unc_volume (const char *filename)
1528 return 1; 1528 return 1;
1529} 1529}
1530 1530
1531/* Routines that are no-ops on NT but are defined to get Emacs to compile. */
1532int
1533sigemptyset (sigset_t *set)
1534{
1535 *set = 0;
1536 return 0;
1537}
1538
1539int
1540sigaddset (sigset_t *set, int signo)
1541{
1542 return 0;
1543}
1544
1545int
1546sigfillset (sigset_t *set)
1547{
1548 return 0;
1549}
1550
1551int
1552sigprocmask (int how, const sigset_t *set, sigset_t *oset)
1553{
1554 return 0;
1555}
1556
1557int
1558pthread_sigmask (int how, const sigset_t *set, sigset_t *oset)
1559{
1560 if (sigprocmask (how, set, oset) == -1)
1561 return EINVAL;
1562 return 0;
1563}
1564
1565int
1566setpgrp (int pid, int gid)
1567{
1568 return 0;
1569}
1570
1571int
1572alarm (int seconds)
1573{
1574 return 0;
1575}
1576
1577#define REG_ROOT "SOFTWARE\\GNU\\Emacs" 1531#define REG_ROOT "SOFTWARE\\GNU\\Emacs"
1578 1532
1579LPBYTE 1533LPBYTE
@@ -1784,7 +1738,8 @@ init_environment (char ** argv)
1784 /* FIXME: should use substring of get_emacs_configuration (). 1738 /* FIXME: should use substring of get_emacs_configuration ().
1785 But I don't think the Windows build supports alpha, mips etc 1739 But I don't think the Windows build supports alpha, mips etc
1786 anymore, so have taken the easy option for now. */ 1740 anymore, so have taken the easy option for now. */
1787 else if (p && xstrcasecmp (p, "\\i386") == 0) 1741 else if (p && (xstrcasecmp (p, "\\i386") == 0
1742 || xstrcasecmp (p, "\\AMD64") == 0))
1788 { 1743 {
1789 *p = 0; 1744 *p = 0;
1790 p = strrchr (modname, '\\'); 1745 p = strrchr (modname, '\\');
@@ -1932,7 +1887,16 @@ get_emacs_configuration (void)
1932 case PROCESSOR_INTEL_386: 1887 case PROCESSOR_INTEL_386:
1933 case PROCESSOR_INTEL_486: 1888 case PROCESSOR_INTEL_486:
1934 case PROCESSOR_INTEL_PENTIUM: 1889 case PROCESSOR_INTEL_PENTIUM:
1890#ifdef _WIN64
1891 arch = "amd64";
1892#else
1935 arch = "i386"; 1893 arch = "i386";
1894#endif
1895 break;
1896#endif
1897#ifdef PROCESSOR_AMD_X8664
1898 case PROCESSOR_AMD_X8664:
1899 arch = "amd64";
1936 break; 1900 break;
1937#endif 1901#endif
1938 1902
@@ -3988,9 +3952,13 @@ utime (const char *name, struct utimbuf *times)
3988 } 3952 }
3989 3953
3990 /* Need write access to set times. */ 3954 /* Need write access to set times. */
3991 fh = CreateFile (name, GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, 3955 fh = CreateFile (name, FILE_WRITE_ATTRIBUTES,
3992 0, OPEN_EXISTING, 0, NULL); 3956 /* If NAME specifies a directory, FILE_SHARE_DELETE
3993 if (fh) 3957 allows other processes to delete files inside it,
3958 while we have the directory open. */
3959 FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
3960 0, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL);
3961 if (fh != INVALID_HANDLE_VALUE)
3994 { 3962 {
3995 convert_from_time_t (times->actime, &atime); 3963 convert_from_time_t (times->actime, &atime);
3996 convert_from_time_t (times->modtime, &mtime); 3964 convert_from_time_t (times->modtime, &mtime);
@@ -6623,6 +6591,9 @@ void
6623term_ntproc (int ignored) 6591term_ntproc (int ignored)
6624{ 6592{
6625 (void)ignored; 6593 (void)ignored;
6594
6595 term_timers ();
6596
6626 /* shutdown the socket interface if necessary */ 6597 /* shutdown the socket interface if necessary */
6627 term_winsock (); 6598 term_winsock ();
6628 6599
@@ -6632,6 +6603,8 @@ term_ntproc (int ignored)
6632void 6603void
6633init_ntproc (int dumping) 6604init_ntproc (int dumping)
6634{ 6605{
6606 sigset_t initial_mask = 0;
6607
6635 /* Initialize the socket interface now if available and requested by 6608 /* Initialize the socket interface now if available and requested by
6636 the user by defining PRELOAD_WINSOCK; otherwise loading will be 6609 the user by defining PRELOAD_WINSOCK; otherwise loading will be
6637 delayed until open-network-stream is called (w32-has-winsock can 6610 delayed until open-network-stream is called (w32-has-winsock can
@@ -6687,19 +6660,19 @@ init_ntproc (int dumping)
6687 fclose (stderr); 6660 fclose (stderr);
6688 6661
6689 if (stdin_save != INVALID_HANDLE_VALUE) 6662 if (stdin_save != INVALID_HANDLE_VALUE)
6690 _open_osfhandle ((long) stdin_save, O_TEXT); 6663 _open_osfhandle ((intptr_t) stdin_save, O_TEXT);
6691 else 6664 else
6692 _open ("nul", O_TEXT | O_NOINHERIT | O_RDONLY); 6665 _open ("nul", O_TEXT | O_NOINHERIT | O_RDONLY);
6693 _fdopen (0, "r"); 6666 _fdopen (0, "r");
6694 6667
6695 if (stdout_save != INVALID_HANDLE_VALUE) 6668 if (stdout_save != INVALID_HANDLE_VALUE)
6696 _open_osfhandle ((long) stdout_save, O_TEXT); 6669 _open_osfhandle ((intptr_t) stdout_save, O_TEXT);
6697 else 6670 else
6698 _open ("nul", O_TEXT | O_NOINHERIT | O_WRONLY); 6671 _open ("nul", O_TEXT | O_NOINHERIT | O_WRONLY);
6699 _fdopen (1, "w"); 6672 _fdopen (1, "w");
6700 6673
6701 if (stderr_save != INVALID_HANDLE_VALUE) 6674 if (stderr_save != INVALID_HANDLE_VALUE)
6702 _open_osfhandle ((long) stderr_save, O_TEXT); 6675 _open_osfhandle ((intptr_t) stderr_save, O_TEXT);
6703 else 6676 else
6704 _open ("nul", O_TEXT | O_NOINHERIT | O_WRONLY); 6677 _open ("nul", O_TEXT | O_NOINHERIT | O_WRONLY);
6705 _fdopen (2, "w"); 6678 _fdopen (2, "w");
@@ -6708,7 +6681,12 @@ init_ntproc (int dumping)
6708 /* unfortunately, atexit depends on implementation of malloc */ 6681 /* unfortunately, atexit depends on implementation of malloc */
6709 /* atexit (term_ntproc); */ 6682 /* atexit (term_ntproc); */
6710 if (!dumping) 6683 if (!dumping)
6711 signal (SIGABRT, term_ntproc); 6684 {
6685 /* Make sure we start with all signals unblocked. */
6686 sigprocmask (SIG_SETMASK, &initial_mask, NULL);
6687 signal (SIGABRT, term_ntproc);
6688 }
6689 init_timers ();
6712 6690
6713 /* determine which drives are fixed, for GetCachedVolumeInformation */ 6691 /* determine which drives are fixed, for GetCachedVolumeInformation */
6714 { 6692 {
@@ -6815,7 +6793,7 @@ serial_open (char *port)
6815 OPEN_EXISTING, FILE_FLAG_OVERLAPPED, 0); 6793 OPEN_EXISTING, FILE_FLAG_OVERLAPPED, 0);
6816 if (hnd == INVALID_HANDLE_VALUE) 6794 if (hnd == INVALID_HANDLE_VALUE)
6817 error ("Could not open %s", port); 6795 error ("Could not open %s", port);
6818 fd = (int) _open_osfhandle ((int) hnd, 0); 6796 fd = (int) _open_osfhandle ((intptr_t) hnd, 0);
6819 if (fd == -1) 6797 if (fd == -1)
6820 error ("Could not open %s", port); 6798 error ("Could not open %s", port);
6821 6799
diff --git a/src/w32.h b/src/w32.h
index a833c8f4315..2e2315e245d 100644
--- a/src/w32.h
+++ b/src/w32.h
@@ -142,6 +142,9 @@ extern void syms_of_fontset (void);
142extern void syms_of_w32font (void); 142extern void syms_of_w32font (void);
143extern void check_windows_init_file (void); 143extern void check_windows_init_file (void);
144 144
145extern void term_timers (void);
146extern void init_timers (void);
147
145extern int _sys_read_ahead (int fd); 148extern int _sys_read_ahead (int fd);
146extern int _sys_wait_accept (int fd); 149extern int _sys_wait_accept (int fd);
147 150
diff --git a/src/w32fns.c b/src/w32fns.c
index d7b45e263b3..6d5d6822354 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -79,9 +79,7 @@ extern void w32_menu_display_help (HWND, HMENU, UINT, UINT);
79extern void w32_free_menu_strings (HWND); 79extern void w32_free_menu_strings (HWND);
80extern const char *map_w32_filename (const char *, const char **); 80extern const char *map_w32_filename (const char *, const char **);
81 81
82/* If non-zero, a w32 timer that, when it expires, displays an 82/* If non-NULL, a handle to a frame where to display the hourglass cursor. */
83 hourglass cursor on all frames. */
84static unsigned hourglass_timer = 0;
85static HWND hourglass_hwnd = NULL; 83static HWND hourglass_hwnd = NULL;
86 84
87#ifndef IDC_HAND 85#ifndef IDC_HAND
@@ -139,7 +137,7 @@ struct MONITOR_INFO
139}; 137};
140 138
141/* Reportedly, MSVC does not have this in its headers. */ 139/* Reportedly, MSVC does not have this in its headers. */
142#ifdef _MSC_VER 140#if defined (_MSC_VER) && _WIN32_WINNT < 0x0500
143DECLARE_HANDLE(HMONITOR); 141DECLARE_HANDLE(HMONITOR);
144#endif 142#endif
145 143
@@ -175,7 +173,6 @@ unsigned int msh_mousewheel = 0;
175#define MOUSE_BUTTON_ID 1 173#define MOUSE_BUTTON_ID 1
176#define MOUSE_MOVE_ID 2 174#define MOUSE_MOVE_ID 2
177#define MENU_FREE_ID 3 175#define MENU_FREE_ID 3
178#define HOURGLASS_ID 4
179/* The delay (milliseconds) before a menu is freed after WM_EXITMENULOOP 176/* The delay (milliseconds) before a menu is freed after WM_EXITMENULOOP
180 is received. */ 177 is received. */
181#define MENU_FREE_DELAY 1000 178#define MENU_FREE_DELAY 1000
@@ -2255,7 +2252,7 @@ static void
2255w32_msg_pump (deferred_msg * msg_buf) 2252w32_msg_pump (deferred_msg * msg_buf)
2256{ 2253{
2257 MSG msg; 2254 MSG msg;
2258 int result; 2255 WPARAM result;
2259 HWND focus_window; 2256 HWND focus_window;
2260 2257
2261 msh_mousewheel = RegisterWindowMessage (MSH_MOUSEWHEEL); 2258 msh_mousewheel = RegisterWindowMessage (MSH_MOUSEWHEEL);
@@ -2286,7 +2283,7 @@ w32_msg_pump (deferred_msg * msg_buf)
2286 /* Reply is not expected. */ 2283 /* Reply is not expected. */
2287 break; 2284 break;
2288 case WM_EMACS_SETKEYBOARDLAYOUT: 2285 case WM_EMACS_SETKEYBOARDLAYOUT:
2289 result = (int) ActivateKeyboardLayout ((HKL) msg.wParam, 0); 2286 result = (WPARAM) ActivateKeyboardLayout ((HKL) msg.wParam, 0);
2290 if (!PostThreadMessage (dwMainThreadId, WM_EMACS_DONE, 2287 if (!PostThreadMessage (dwMainThreadId, WM_EMACS_DONE,
2291 result, 0)) 2288 result, 0))
2292 emacs_abort (); 2289 emacs_abort ();
@@ -3313,12 +3310,6 @@ w32_wnd_proc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
3313 menubar_in_use = 0; 3310 menubar_in_use = 0;
3314 } 3311 }
3315 } 3312 }
3316 else if (wParam == hourglass_timer)
3317 {
3318 KillTimer (hwnd, hourglass_timer);
3319 hourglass_timer = 0;
3320 w32_show_hourglass (x_window_to_frame (dpyinfo, hwnd));
3321 }
3322 return 0; 3313 return 0;
3323 3314
3324 case WM_NCACTIVATE: 3315 case WM_NCACTIVATE:
@@ -5040,66 +5031,50 @@ no value of TYPE (always string in the MS Windows case). */)
5040 Busy cursor 5031 Busy cursor
5041 ***********************************************************************/ 5032 ***********************************************************************/
5042 5033
5043/* Default number of seconds to wait before displaying an hourglass
5044 cursor. Duplicated from xdisp.c, but cannot use the version there
5045 due to lack of atimers on w32. */
5046#define DEFAULT_HOURGLASS_DELAY 1
5047
5048/* Cancel a currently active hourglass timer, and start a new one. */
5049
5050void 5034void
5051start_hourglass (void) 5035w32_note_current_window (void)
5052{ 5036{
5053 DWORD delay;
5054 int secs, msecs = 0;
5055 struct frame * f = SELECTED_FRAME (); 5037 struct frame * f = SELECTED_FRAME ();
5056 5038
5057 /* No cursors on non GUI frames. */
5058 if (!FRAME_W32_P (f)) 5039 if (!FRAME_W32_P (f))
5059 return; 5040 return;
5060 5041
5061 cancel_hourglass ();
5062
5063 if (INTEGERP (Vhourglass_delay)
5064 && XINT (Vhourglass_delay) > 0)
5065 secs = XFASTINT (Vhourglass_delay);
5066 else if (FLOATP (Vhourglass_delay)
5067 && XFLOAT_DATA (Vhourglass_delay) > 0)
5068 {
5069 Lisp_Object tem;
5070 tem = Ftruncate (Vhourglass_delay, Qnil);
5071 secs = XFASTINT (tem);
5072 msecs = (XFLOAT_DATA (Vhourglass_delay) - secs) * 1000;
5073 }
5074 else
5075 secs = DEFAULT_HOURGLASS_DELAY;
5076
5077 delay = secs * 1000 + msecs;
5078 hourglass_hwnd = FRAME_W32_WINDOW (f); 5042 hourglass_hwnd = FRAME_W32_WINDOW (f);
5079 hourglass_timer = SetTimer (hourglass_hwnd, HOURGLASS_ID, delay, NULL);
5080} 5043}
5081 5044
5082
5083/* Cancel the hourglass cursor timer if active, hide an hourglass
5084 cursor if shown. */
5085
5086void 5045void
5087cancel_hourglass (void) 5046show_hourglass (struct atimer *timer)
5088{ 5047{
5089 if (hourglass_timer) 5048 struct frame *f;
5090 {
5091 KillTimer (hourglass_hwnd, hourglass_timer);
5092 hourglass_timer = 0;
5093 }
5094 5049
5095 if (hourglass_shown_p) 5050 hourglass_atimer = NULL;
5096 w32_hide_hourglass (); 5051
5052 block_input ();
5053 f = x_window_to_frame (&one_w32_display_info,
5054 hourglass_hwnd);
5055
5056 if (f)
5057 f->output_data.w32->hourglass_p = 0;
5058 else
5059 f = SELECTED_FRAME ();
5060
5061 if (!FRAME_W32_P (f))
5062 return;
5063
5064 w32_show_hourglass (f);
5065 unblock_input ();
5097} 5066}
5098 5067
5068void
5069hide_hourglass (void)
5070{
5071 block_input ();
5072 w32_hide_hourglass ();
5073 unblock_input ();
5074}
5099 5075
5100/* Timer function of hourglass_timer.
5101 5076
5102 Display an hourglass cursor. Set the hourglass_p flag in display info 5077/* Display an hourglass cursor. Set the hourglass_p flag in display info
5103 to indicate that an hourglass cursor is shown. */ 5078 to indicate that an hourglass cursor is shown. */
5104 5079
5105static void 5080static void
@@ -7123,8 +7098,6 @@ only be necessary if the default setting causes problems. */);
7123 7098
7124 check_window_system_func = check_w32; 7099 check_window_system_func = check_w32;
7125 7100
7126
7127 hourglass_timer = 0;
7128 hourglass_hwnd = NULL; 7101 hourglass_hwnd = NULL;
7129 7102
7130 defsubr (&Sx_show_tip); 7103 defsubr (&Sx_show_tip);
diff --git a/src/w32heap.c b/src/w32heap.c
index dc65198f90b..8b9b19ea35d 100644
--- a/src/w32heap.c
+++ b/src/w32heap.c
@@ -26,7 +26,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
26#include "w32heap.h" 26#include "w32heap.h"
27#include "lisp.h" /* for VALMASK */ 27#include "lisp.h" /* for VALMASK */
28 28
29#define RVA_TO_PTR(rva) ((unsigned char *)((DWORD)(rva) + (DWORD)GetModuleHandle (NULL))) 29#define RVA_TO_PTR(rva) ((unsigned char *)((DWORD_PTR)(rva) + (DWORD_PTR)GetModuleHandle (NULL)))
30 30
31/* This gives us the page size and the size of the allocation unit on NT. */ 31/* This gives us the page size and the size of the allocation unit on NT. */
32SYSTEM_INFO sysinfo_cache; 32SYSTEM_INFO sysinfo_cache;
@@ -34,7 +34,7 @@ SYSTEM_INFO sysinfo_cache;
34/* This gives us version, build, and platform identification. */ 34/* This gives us version, build, and platform identification. */
35OSVERSIONINFO osinfo_cache; 35OSVERSIONINFO osinfo_cache;
36 36
37unsigned long syspage_mask = 0; 37size_t syspage_mask = 0;
38 38
39/* The major and minor versions of NT. */ 39/* The major and minor versions of NT. */
40int w32_major_version; 40int w32_major_version;
@@ -97,7 +97,7 @@ PIMAGE_SECTION_HEADER preload_heap_section;
97unsigned char *data_region_base = NULL; 97unsigned char *data_region_base = NULL;
98unsigned char *data_region_end = NULL; 98unsigned char *data_region_end = NULL;
99unsigned char *real_data_region_end = NULL; 99unsigned char *real_data_region_end = NULL;
100unsigned long reserved_heap_size = 0; 100size_t reserved_heap_size = 0;
101 101
102/* The start of the data segment. */ 102/* The start of the data segment. */
103unsigned char * 103unsigned char *
@@ -121,16 +121,20 @@ allocate_heap (void)
121 the preload heap section up to the usable address limit. Since GNU 121 the preload heap section up to the usable address limit. Since GNU
122 malloc can handle gaps in the memory it gets from sbrk, we can 122 malloc can handle gaps in the memory it gets from sbrk, we can
123 simply set the sbrk pointer to the base of the new heap region. */ 123 simply set the sbrk pointer to the base of the new heap region. */
124 unsigned long base = 124 DWORD_PTR base =
125 ROUND_UP ((RVA_TO_PTR (preload_heap_section->VirtualAddress) 125 ROUND_UP ((RVA_TO_PTR (preload_heap_section->VirtualAddress)
126 + preload_heap_section->Misc.VirtualSize), 126 + preload_heap_section->Misc.VirtualSize),
127 get_allocation_unit ()); 127 get_allocation_unit ());
128 unsigned long end = 1 << VALBITS; /* 256MB */ 128 DWORD_PTR end = ((unsigned __int64)1) << VALBITS; /* 256MB */
129 void *ptr = NULL; 129 void *ptr = NULL;
130 130
131 while (!ptr && (base < end)) 131 while (!ptr && (base < end))
132 { 132 {
133#ifdef _WIN64
134 reserved_heap_size = min(end - base, 0x4000000000i64); /* Limit to 256Gb */
135#else
133 reserved_heap_size = end - base; 136 reserved_heap_size = end - base;
137#endif
134 ptr = VirtualAlloc ((void *) base, 138 ptr = VirtualAlloc ((void *) base,
135 get_reserved_heap_size (), 139 get_reserved_heap_size (),
136 MEM_RESERVE, 140 MEM_RESERVE,
@@ -144,7 +148,11 @@ allocate_heap (void)
144static char * 148static char *
145allocate_heap (void) 149allocate_heap (void)
146{ 150{
147 unsigned long size = 0x80000000; /* start by asking for 2GB */ 151#ifdef _WIN64
152 size_t size = 0x4000000000i64; /* start by asking for 32GB */
153#else
154 size_t size = 0x80000000; /* start by asking for 2GB */
155#endif
148 void *ptr = NULL; 156 void *ptr = NULL;
149 157
150 while (!ptr && size > 0x00100000) 158 while (!ptr && size > 0x00100000)
@@ -166,17 +174,17 @@ allocate_heap (void)
166 be the address of the _start_ (not end) of the new block in case of 174 be the address of the _start_ (not end) of the new block in case of
167 success, and zero (not -1) in case of failure. */ 175 success, and zero (not -1) in case of failure. */
168void * 176void *
169sbrk (unsigned long increment) 177sbrk (ptrdiff_t increment)
170{ 178{
171 void *result; 179 void *result;
172 long size = (long) increment; 180 ptrdiff_t size = increment;
173 181
174 result = data_region_end; 182 result = data_region_end;
175 183
176 /* If size is negative, shrink the heap by decommitting pages. */ 184 /* If size is negative, shrink the heap by decommitting pages. */
177 if (size < 0) 185 if (size < 0)
178 { 186 {
179 int new_size; 187 ptrdiff_t new_size;
180 unsigned char *new_data_region_end; 188 unsigned char *new_data_region_end;
181 189
182 size = -size; 190 size = -size;
@@ -189,7 +197,7 @@ sbrk (unsigned long increment)
189 partial deallocation [cga]. */ 197 partial deallocation [cga]. */
190 new_data_region_end = (data_region_end - size); 198 new_data_region_end = (data_region_end - size);
191 new_data_region_end = (unsigned char *) 199 new_data_region_end = (unsigned char *)
192 ((long) (new_data_region_end + syspage_mask) & ~syspage_mask); 200 ((DWORD_PTR) (new_data_region_end + syspage_mask) & ~syspage_mask);
193 new_size = real_data_region_end - new_data_region_end; 201 new_size = real_data_region_end - new_data_region_end;
194 real_data_region_end = new_data_region_end; 202 real_data_region_end = new_data_region_end;
195 if (new_size > 0) 203 if (new_size > 0)
@@ -220,7 +228,7 @@ sbrk (unsigned long increment)
220 /* We really only commit full pages, so record where 228 /* We really only commit full pages, so record where
221 the real end of committed memory is [cga]. */ 229 the real end of committed memory is [cga]. */
222 real_data_region_end = (unsigned char *) 230 real_data_region_end = (unsigned char *)
223 ((long) (data_region_end + syspage_mask) & ~syspage_mask); 231 ((DWORD_PTR) (data_region_end + syspage_mask) & ~syspage_mask);
224 } 232 }
225 233
226 return result; 234 return result;
@@ -245,7 +253,7 @@ init_heap (void)
245 PIMAGE_NT_HEADERS nt_header; 253 PIMAGE_NT_HEADERS nt_header;
246 254
247 dos_header = (PIMAGE_DOS_HEADER) RVA_TO_PTR (0); 255 dos_header = (PIMAGE_DOS_HEADER) RVA_TO_PTR (0);
248 nt_header = (PIMAGE_NT_HEADERS) (((unsigned long) dos_header) + 256 nt_header = (PIMAGE_NT_HEADERS) (((DWORD_PTR) dos_header) +
249 dos_header->e_lfanew); 257 dos_header->e_lfanew);
250 preload_heap_section = find_section ("EMHEAP", nt_header); 258 preload_heap_section = find_section ("EMHEAP", nt_header);
251 259
@@ -261,7 +269,7 @@ init_heap (void)
261#if !USE_LSB_TAG 269#if !USE_LSB_TAG
262 /* Ensure that the addresses don't use the upper tag bits since 270 /* Ensure that the addresses don't use the upper tag bits since
263 the Lisp type goes there. */ 271 the Lisp type goes there. */
264 if (((unsigned long) data_region_base & ~VALMASK) != 0) 272 if (((DWORD_PTR) data_region_base & ~VALMASK) != 0)
265 { 273 {
266 printf ("Error: The heap was allocated in upper memory.\n"); 274 printf ("Error: The heap was allocated in upper memory.\n");
267 exit (1); 275 exit (1);
@@ -284,13 +292,13 @@ init_heap (void)
284 292
285/* Round the heap up to the given alignment. */ 293/* Round the heap up to the given alignment. */
286void 294void
287round_heap (unsigned long align) 295round_heap (size_t align)
288{ 296{
289 unsigned long needs_to_be; 297 DWORD_PTR needs_to_be;
290 unsigned long need_to_alloc; 298 DWORD_PTR need_to_alloc;
291 299
292 needs_to_be = (unsigned long) ROUND_UP (get_heap_end (), align); 300 needs_to_be = (DWORD_PTR) ROUND_UP (get_heap_end (), align);
293 need_to_alloc = needs_to_be - (unsigned long) get_heap_end (); 301 need_to_alloc = needs_to_be - (DWORD_PTR) get_heap_end ();
294 302
295 if (need_to_alloc) 303 if (need_to_alloc)
296 sbrk (need_to_alloc); 304 sbrk (need_to_alloc);
diff --git a/src/w32heap.h b/src/w32heap.h
index fda3c58bf01..aae4845b4cc 100644
--- a/src/w32heap.h
+++ b/src/w32heap.h
@@ -24,8 +24,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
24 24
25#include <windows.h> 25#include <windows.h>
26 26
27#define ROUND_UP(p, align) (((DWORD)(p) + (align)-1) & ~((align)-1)) 27#define ROUND_UP(p, align) (((DWORD_PTR)(p) + (align)-1) & ~((DWORD_PTR)(align)-1))
28#define ROUND_DOWN(p, align) ((DWORD)(p) & ~((align)-1)) 28#define ROUND_DOWN(p, align) ((DWORD_PTR)(p) & ~((DWORD_PTR)(align)-1))
29 29
30/* 30/*
31 * Heap related stuff. 31 * Heap related stuff.
@@ -42,7 +42,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
42 42
43extern unsigned char *get_data_start (void); 43extern unsigned char *get_data_start (void);
44extern unsigned char *get_data_end (void); 44extern unsigned char *get_data_end (void);
45extern unsigned long reserved_heap_size; 45extern size_t reserved_heap_size;
46extern SYSTEM_INFO sysinfo_cache; 46extern SYSTEM_INFO sysinfo_cache;
47extern OSVERSIONINFO osinfo_cache; 47extern OSVERSIONINFO osinfo_cache;
48extern BOOL using_dynamic_heap; 48extern BOOL using_dynamic_heap;
@@ -58,13 +58,13 @@ enum {
58extern int os_subtype; 58extern int os_subtype;
59 59
60/* Emulation of Unix sbrk(). */ 60/* Emulation of Unix sbrk(). */
61extern void *sbrk (unsigned long size); 61extern void *sbrk (ptrdiff_t size);
62 62
63/* Initialize heap structures for sbrk on startup. */ 63/* Initialize heap structures for sbrk on startup. */
64extern void init_heap (void); 64extern void init_heap (void);
65 65
66/* Round the heap to this size. */ 66/* Round the heap to this size. */
67extern void round_heap (unsigned long size); 67extern void round_heap (size_t size);
68 68
69/* Cache system info, e.g., the NT page size. */ 69/* Cache system info, e.g., the NT page size. */
70extern void cache_system_info (void); 70extern void cache_system_info (void);
@@ -89,6 +89,6 @@ IMAGE_SECTION_HEADER * find_section (char * name, IMAGE_NT_HEADERS * nt_header);
89 89
90/* Return pointer to section header for section containing the given 90/* Return pointer to section header for section containing the given
91 relative virtual address. */ 91 relative virtual address. */
92IMAGE_SECTION_HEADER * rva_to_section (DWORD rva, IMAGE_NT_HEADERS * nt_header); 92IMAGE_SECTION_HEADER * rva_to_section (DWORD_PTR rva, IMAGE_NT_HEADERS * nt_header);
93 93
94#endif /* NTHEAP_H_ */ 94#endif /* NTHEAP_H_ */
diff --git a/src/w32menu.c b/src/w32menu.c
index fb1cb606940..0a10f1f0893 100644
--- a/src/w32menu.c
+++ b/src/w32menu.c
@@ -1483,8 +1483,8 @@ add_menu_item (HMENU menu, widget_value *wv, HMENU item)
1483 1483
1484 utf8to16 (out_string, utf8_len, utf16_string); 1484 utf8to16 (out_string, utf8_len, utf16_string);
1485 return_value = unicode_append_menu (menu, fuFlags, 1485 return_value = unicode_append_menu (menu, fuFlags,
1486 item != NULL ? (UINT) item 1486 item != NULL ? (UINT_PTR) item
1487 : (UINT) wv->call_data, 1487 : (UINT_PTR) wv->call_data,
1488 utf16_string); 1488 utf16_string);
1489 if (!return_value) 1489 if (!return_value)
1490 { 1490 {
@@ -1496,7 +1496,7 @@ add_menu_item (HMENU menu, widget_value *wv, HMENU item)
1496 of minor importance compared with menus not working at all. */ 1496 of minor importance compared with menus not working at all. */
1497 return_value = 1497 return_value =
1498 AppendMenu (menu, fuFlags, 1498 AppendMenu (menu, fuFlags,
1499 item != NULL ? (UINT) item: (UINT) wv->call_data, 1499 item != NULL ? (UINT_PTR) item: (UINT_PTR) wv->call_data,
1500 out_string); 1500 out_string);
1501 /* Don't use Unicode menus in future, unless this is Windows 1501 /* Don't use Unicode menus in future, unless this is Windows
1502 NT or later, where a failure of AppendMenuW does NOT mean 1502 NT or later, where a failure of AppendMenuW does NOT mean
@@ -1513,7 +1513,7 @@ add_menu_item (HMENU menu, widget_value *wv, HMENU item)
1513 return_value = 1513 return_value =
1514 AppendMenu (menu, 1514 AppendMenu (menu,
1515 fuFlags, 1515 fuFlags,
1516 item != NULL ? (UINT) item : (UINT) wv->call_data, 1516 item != NULL ? (UINT_PTR) item : (UINT_PTR) wv->call_data,
1517 out_string ); 1517 out_string );
1518 } 1518 }
1519 1519
@@ -1550,7 +1550,7 @@ add_menu_item (HMENU menu, widget_value *wv, HMENU item)
1550 } 1550 }
1551 1551
1552 set_menu_item_info (menu, 1552 set_menu_item_info (menu,
1553 item != NULL ? (UINT) item : (UINT) wv->call_data, 1553 item != NULL ? (UINT_PTR) item : (UINT_PTR) wv->call_data,
1554 FALSE, &info); 1554 FALSE, &info);
1555 } 1555 }
1556 } 1556 }
diff --git a/src/w32proc.c b/src/w32proc.c
index b367b42d8c6..d032b21c59e 100644
--- a/src/w32proc.c
+++ b/src/w32proc.c
@@ -62,7 +62,7 @@ extern BOOL WINAPI IsValidLocale (LCID, DWORD);
62 62
63#define RVA_TO_PTR(var,section,filedata) \ 63#define RVA_TO_PTR(var,section,filedata) \
64 ((void *)((section)->PointerToRawData \ 64 ((void *)((section)->PointerToRawData \
65 + ((DWORD)(var) - (section)->VirtualAddress) \ 65 + ((DWORD_PTR)(var) - (section)->VirtualAddress) \
66 + (filedata).file_base)) 66 + (filedata).file_base))
67 67
68Lisp_Object Qhigh, Qlow; 68Lisp_Object Qhigh, Qlow;
@@ -86,18 +86,23 @@ typedef void (_CALLBACK_ *signal_handler) (int);
86/* Signal handlers...SIG_DFL == 0 so this is initialized correctly. */ 86/* Signal handlers...SIG_DFL == 0 so this is initialized correctly. */
87static signal_handler sig_handlers[NSIG]; 87static signal_handler sig_handlers[NSIG];
88 88
89static sigset_t sig_mask;
90
91static CRITICAL_SECTION crit_sig;
92
89/* Improve on the CRT 'signal' implementation so that we could record 93/* Improve on the CRT 'signal' implementation so that we could record
90 the SIGCHLD handler. */ 94 the SIGCHLD handler and fake interval timers. */
91signal_handler 95signal_handler
92sys_signal (int sig, signal_handler handler) 96sys_signal (int sig, signal_handler handler)
93{ 97{
94 signal_handler old; 98 signal_handler old;
95 99
96 /* SIGCHLD is needed for supporting subprocesses, see sys_kill 100 /* SIGCHLD is needed for supporting subprocesses, see sys_kill
97 below. All the others are the only ones supported by the MS 101 below. SIGALRM and SIGPROF are used by setitimer. All the
98 runtime. */ 102 others are the only ones supported by the MS runtime. */
99 if (!(sig == SIGCHLD || sig == SIGSEGV || sig == SIGILL 103 if (!(sig == SIGCHLD || sig == SIGSEGV || sig == SIGILL
100 || sig == SIGFPE || sig == SIGABRT || sig == SIGTERM)) 104 || sig == SIGFPE || sig == SIGABRT || sig == SIGTERM
105 || sig == SIGALRM || sig == SIGPROF))
101 { 106 {
102 errno = EINVAL; 107 errno = EINVAL;
103 return SIG_ERR; 108 return SIG_ERR;
@@ -111,7 +116,7 @@ sys_signal (int sig, signal_handler handler)
111 if (!(sig == SIGABRT && old == term_ntproc)) 116 if (!(sig == SIGABRT && old == term_ntproc))
112 { 117 {
113 sig_handlers[sig] = handler; 118 sig_handlers[sig] = handler;
114 if (sig != SIGCHLD) 119 if (!(sig == SIGCHLD || sig == SIGALRM || sig == SIGPROF))
115 signal (sig, handler); 120 signal (sig, handler);
116 } 121 }
117 return old; 122 return old;
@@ -143,6 +148,540 @@ sigaction (int sig, const struct sigaction *act, struct sigaction *oact)
143 return retval; 148 return retval;
144} 149}
145 150
151/* Emulate signal sets and blocking of signals used by timers. */
152
153int
154sigemptyset (sigset_t *set)
155{
156 *set = 0;
157 return 0;
158}
159
160int
161sigaddset (sigset_t *set, int signo)
162{
163 if (!set)
164 {
165 errno = EINVAL;
166 return -1;
167 }
168 if (signo < 0 || signo >= NSIG)
169 {
170 errno = EINVAL;
171 return -1;
172 }
173
174 *set |= (1U << signo);
175
176 return 0;
177}
178
179int
180sigfillset (sigset_t *set)
181{
182 if (!set)
183 {
184 errno = EINVAL;
185 return -1;
186 }
187
188 *set = 0xFFFFFFFF;
189 return 0;
190}
191
192int
193sigprocmask (int how, const sigset_t *set, sigset_t *oset)
194{
195 if (!(how == SIG_BLOCK || how == SIG_UNBLOCK || how == SIG_SETMASK))
196 {
197 errno = EINVAL;
198 return -1;
199 }
200
201 if (oset)
202 *oset = sig_mask;
203
204 if (!set)
205 return 0;
206
207 switch (how)
208 {
209 case SIG_BLOCK:
210 sig_mask |= *set;
211 break;
212 case SIG_SETMASK:
213 sig_mask = *set;
214 break;
215 case SIG_UNBLOCK:
216 /* FIXME: Catch signals that are blocked and reissue them when
217 they are unblocked. Important for SIGALRM and SIGPROF only. */
218 sig_mask &= ~(*set);
219 break;
220 }
221
222 return 0;
223}
224
225int
226pthread_sigmask (int how, const sigset_t *set, sigset_t *oset)
227{
228 if (sigprocmask (how, set, oset) == -1)
229 return EINVAL;
230 return 0;
231}
232
233int
234sigismember (const sigset_t *set, int signo)
235{
236 if (signo < 0 || signo >= NSIG)
237 {
238 errno = EINVAL;
239 return -1;
240 }
241 if (signo > sizeof (*set) * BITS_PER_CHAR)
242 emacs_abort ();
243
244 return (*set & (1U << signo)) != 0;
245}
246
247int
248setpgrp (int pid, int gid)
249{
250 return 0;
251}
252
253/* Emulations of interval timers.
254
255 Limitations: only ITIMER_REAL and ITIMER_PROF are supported.
256
257 Implementation: a separate thread is started for each timer type,
258 the thread calls the appropriate signal handler when the timer
259 expires, after stopping the thread which installed the timer. */
260
261/* FIXME: clock_t counts overflow after 49 days, need to handle the
262 wrap-around. */
263struct itimer_data {
264 clock_t expire;
265 clock_t reload;
266 int terminate;
267 int type;
268 HANDLE caller_thread;
269 HANDLE timer_thread;
270};
271
272static clock_t ticks_now;
273static struct itimer_data real_itimer, prof_itimer;
274static clock_t clocks_min;
275/* If non-zero, itimers are disabled. Used during shutdown, when we
276 delete the critical sections used by the timer threads. */
277static int disable_itimers;
278
279static CRITICAL_SECTION crit_real, crit_prof;
280
281#define MAX_SINGLE_SLEEP 30
282
283static DWORD WINAPI
284timer_loop (LPVOID arg)
285{
286 struct itimer_data *itimer = (struct itimer_data *)arg;
287 int which = itimer->type;
288 int sig = (which == ITIMER_REAL) ? SIGALRM : SIGPROF;
289 CRITICAL_SECTION *crit = (which == ITIMER_REAL) ? &crit_real : &crit_prof;
290 const DWORD max_sleep = MAX_SINGLE_SLEEP * 1000 / CLOCKS_PER_SEC;
291 int new_count = 0;
292
293 while (1)
294 {
295 DWORD sleep_time;
296 signal_handler handler;
297 clock_t now, expire, reload;
298
299 /* Load new values if requested by setitimer. */
300 EnterCriticalSection (crit);
301 expire = itimer->expire;
302 reload = itimer->reload;
303 LeaveCriticalSection (crit);
304 if (itimer->terminate)
305 return 0;
306
307 if (itimer->expire == 0)
308 {
309 /* We are idle. */
310 Sleep (max_sleep);
311 continue;
312 }
313
314 expire = itimer->expire;
315 if (expire > (now = clock ()))
316 sleep_time = expire - now;
317 else
318 sleep_time = 0;
319 /* Don't sleep too long at a time, to be able to see the
320 termination flag without too long a delay. */
321 while (sleep_time > max_sleep)
322 {
323 if (itimer->terminate)
324 return 0;
325 Sleep (max_sleep);
326 expire = itimer->expire;
327 sleep_time = (expire > (now = clock ())) ? expire - now : 0;
328 }
329 if (itimer->terminate)
330 return 0;
331 if (sleep_time > 0)
332 {
333 Sleep (sleep_time * 1000 / CLOCKS_PER_SEC);
334 /* Always sleep past the expiration time, to make sure we
335 never call the handler _before_ the expiration time,
336 always slightly after it. Sleep(5) makes sure we don't
337 hog the CPU by calling 'clock' with high frequency, and
338 also let other threads work. */
339 while (clock () < expire)
340 Sleep (5);
341 }
342
343 if (itimer->expire == 0)
344 continue;
345
346 /* Time's up. */
347 handler = sig_handlers[sig];
348 if (!(handler == SIG_DFL || handler == SIG_IGN || handler == SIG_ERR)
349 /* FIXME: Don't ignore masked signals. Instead, record that
350 they happened and reissue them when the signal is
351 unblocked. */
352 && !sigismember (&sig_mask, sig)
353 /* Simulate masking of SIGALRM and SIGPROF when processing
354 fatal signals. */
355 && !fatal_error_in_progress
356 && itimer->caller_thread)
357 {
358 /* Simulate a signal delivered to the thread which installed
359 the timer, by suspending that thread while the handler
360 runs. */
361 DWORD result = SuspendThread (itimer->caller_thread);
362
363 if (result == (DWORD)-1)
364 return 2;
365
366 handler (sig);
367 ResumeThread (itimer->caller_thread);
368 }
369
370 if (itimer->expire == 0)
371 continue;
372
373 /* Update expiration time and loop. */
374 EnterCriticalSection (crit);
375 expire = itimer->expire;
376 reload = itimer->reload;
377 if (reload > 0)
378 {
379 now = clock ();
380 if (expire <= now)
381 {
382 clock_t lag = now - expire;
383
384 /* If we missed some opportunities (presumably while
385 sleeping or while the signal handler ran), skip
386 them. */
387 if (lag > reload)
388 expire = now - (lag % reload);
389
390 expire += reload;
391 }
392 }
393 else
394 expire = 0; /* become idle */
395 itimer->expire = expire;
396 LeaveCriticalSection (crit);
397 }
398 return 0;
399}
400
401static void
402stop_timer_thread (int which)
403{
404 struct itimer_data *itimer =
405 (which == ITIMER_REAL) ? &real_itimer : &prof_itimer;
406 int i;
407 DWORD err, exit_code = 255;
408 BOOL status;
409
410 /* Signal the thread that it should terminate. */
411 itimer->terminate = 1;
412
413 if (itimer->timer_thread == NULL)
414 return;
415
416 /* Wait for the timer thread to terminate voluntarily, then kill it
417 if it doesn't. This loop waits twice more than the maximum
418 amount of time a timer thread sleeps, see above. */
419 for (i = 0; i < MAX_SINGLE_SLEEP / 5; i++)
420 {
421 if (!((status = GetExitCodeThread (itimer->timer_thread, &exit_code))
422 && exit_code == STILL_ACTIVE))
423 break;
424 Sleep (10);
425 }
426 if ((status == FALSE && (err = GetLastError ()) == ERROR_INVALID_HANDLE)
427 || exit_code == STILL_ACTIVE)
428 {
429 if (!(status == FALSE && err == ERROR_INVALID_HANDLE))
430 TerminateThread (itimer->timer_thread, 0);
431 }
432
433 /* Clean up. */
434 CloseHandle (itimer->timer_thread);
435 itimer->timer_thread = NULL;
436 if (itimer->caller_thread)
437 {
438 CloseHandle (itimer->caller_thread);
439 itimer->caller_thread = NULL;
440 }
441}
442
443/* This is called at shutdown time from term_ntproc. */
444void
445term_timers (void)
446{
447 if (real_itimer.timer_thread)
448 stop_timer_thread (ITIMER_REAL);
449 if (prof_itimer.timer_thread)
450 stop_timer_thread (ITIMER_PROF);
451
452 /* We are going to delete the critical sections, so timers cannot
453 work after this. */
454 disable_itimers = 1;
455
456 DeleteCriticalSection (&crit_real);
457 DeleteCriticalSection (&crit_prof);
458 DeleteCriticalSection (&crit_sig);
459}
460
461/* This is called at initialization time from init_ntproc. */
462void
463init_timers (void)
464{
465 /* Make sure we start with zeroed out itimer structures, since
466 dumping may have left there traces of threads long dead. */
467 memset (&real_itimer, 0, sizeof real_itimer);
468 memset (&prof_itimer, 0, sizeof prof_itimer);
469
470 InitializeCriticalSection (&crit_real);
471 InitializeCriticalSection (&crit_prof);
472 InitializeCriticalSection (&crit_sig);
473
474 disable_itimers = 0;
475}
476
477static int
478start_timer_thread (int which)
479{
480 DWORD exit_code;
481 struct itimer_data *itimer =
482 (which == ITIMER_REAL) ? &real_itimer : &prof_itimer;
483
484 if (itimer->timer_thread
485 && GetExitCodeThread (itimer->timer_thread, &exit_code)
486 && exit_code == STILL_ACTIVE)
487 return 0;
488
489 /* Start a new thread. */
490 if (!DuplicateHandle (GetCurrentProcess (), GetCurrentThread (),
491 GetCurrentProcess (), &itimer->caller_thread, 0,
492 FALSE, DUPLICATE_SAME_ACCESS))
493 {
494 errno = ESRCH;
495 return -1;
496 }
497
498 itimer->terminate = 0;
499 itimer->type = which;
500 /* Request that no more than 64KB of stack be reserved for this
501 thread, to avoid reserving too much memory, which would get in
502 the way of threads we start to wait for subprocesses. See also
503 new_child below. */
504 itimer->timer_thread = CreateThread (NULL, 64 * 1024, timer_loop,
505 (void *)itimer, 0x00010000, NULL);
506
507 if (!itimer->timer_thread)
508 {
509 CloseHandle (itimer->caller_thread);
510 itimer->caller_thread = NULL;
511 errno = EAGAIN;
512 return -1;
513 }
514
515 /* This is needed to make sure that the timer thread running for
516 profiling gets CPU as soon as the Sleep call terminates. */
517 if (which == ITIMER_PROF)
518 SetThreadPriority (itimer->caller_thread, THREAD_PRIORITY_TIME_CRITICAL);
519
520 return 0;
521}
522
523/* Most of the code of getitimer and setitimer (but not of their
524 subroutines) was shamelessly stolen from itimer.c in the DJGPP
525 library, see www.delorie.com/djgpp. */
526int
527getitimer (int which, struct itimerval *value)
528{
529 volatile clock_t *t_expire;
530 volatile clock_t *t_reload;
531 clock_t expire, reload;
532 __int64 usecs;
533 CRITICAL_SECTION *crit;
534
535 if (disable_itimers)
536 return -1;
537
538 ticks_now = clock ();
539
540 if (!value)
541 {
542 errno = EFAULT;
543 return -1;
544 }
545
546 if (which != ITIMER_REAL && which != ITIMER_PROF)
547 {
548 errno = EINVAL;
549 return -1;
550 }
551
552 t_expire = (which == ITIMER_REAL) ? &real_itimer.expire: &prof_itimer.expire;
553 t_reload = (which == ITIMER_REAL) ? &real_itimer.reload: &prof_itimer.reload;
554 crit = (which == ITIMER_REAL) ? &crit_real : &crit_prof;
555
556 EnterCriticalSection (crit);
557 reload = *t_reload;
558 expire = *t_expire;
559 LeaveCriticalSection (crit);
560
561 if (expire)
562 expire -= ticks_now;
563
564 value->it_value.tv_sec = expire / CLOCKS_PER_SEC;
565 usecs = (expire % CLOCKS_PER_SEC) * (__int64)1000000 / CLOCKS_PER_SEC;
566 value->it_value.tv_usec = usecs;
567 value->it_interval.tv_sec = reload / CLOCKS_PER_SEC;
568 usecs = (reload % CLOCKS_PER_SEC) * (__int64)1000000 / CLOCKS_PER_SEC;
569 value->it_interval.tv_usec= usecs;
570
571 return 0;
572}
573
574int
575setitimer(int which, struct itimerval *value, struct itimerval *ovalue)
576{
577 volatile clock_t *t_expire, *t_reload;
578 clock_t expire, reload, expire_old, reload_old;
579 __int64 usecs;
580 CRITICAL_SECTION *crit;
581
582 if (disable_itimers)
583 return -1;
584
585 /* Posix systems expect timer values smaller than the resolution of
586 the system clock be rounded up to the clock resolution. First
587 time we are called, measure the clock tick resolution. */
588 if (!clocks_min)
589 {
590 clock_t t1, t2;
591
592 for (t1 = clock (); (t2 = clock ()) == t1; )
593 ;
594 clocks_min = t2 - t1;
595 }
596
597 if (ovalue)
598 {
599 if (getitimer (which, ovalue)) /* also sets ticks_now */
600 return -1; /* errno already set */
601 }
602 else
603 ticks_now = clock ();
604
605 if (which != ITIMER_REAL && which != ITIMER_PROF)
606 {
607 errno = EINVAL;
608 return -1;
609 }
610
611 t_expire =
612 (which == ITIMER_REAL) ? &real_itimer.expire : &prof_itimer.expire;
613 t_reload =
614 (which == ITIMER_REAL) ? &real_itimer.reload : &prof_itimer.reload;
615
616 crit = (which == ITIMER_REAL) ? &crit_real : &crit_prof;
617
618 if (!value
619 || (value->it_value.tv_sec == 0 && value->it_value.tv_usec == 0))
620 {
621 EnterCriticalSection (crit);
622 /* Disable the timer. */
623 *t_expire = 0;
624 *t_reload = 0;
625 LeaveCriticalSection (crit);
626 return 0;
627 }
628
629 reload = value->it_interval.tv_sec * CLOCKS_PER_SEC;
630
631 usecs = value->it_interval.tv_usec;
632 if (value->it_interval.tv_sec == 0
633 && usecs && usecs * CLOCKS_PER_SEC < clocks_min * 1000000)
634 reload = clocks_min;
635 else
636 {
637 usecs *= CLOCKS_PER_SEC;
638 reload += usecs / 1000000;
639 }
640
641 expire = value->it_value.tv_sec * CLOCKS_PER_SEC;
642 usecs = value->it_value.tv_usec;
643 if (value->it_value.tv_sec == 0
644 && usecs * CLOCKS_PER_SEC < clocks_min * 1000000)
645 expire = clocks_min;
646 else
647 {
648 usecs *= CLOCKS_PER_SEC;
649 expire += usecs / 1000000;
650 }
651
652 expire += ticks_now;
653
654 EnterCriticalSection (crit);
655 expire_old = *t_expire;
656 reload_old = *t_reload;
657 if (!(expire == expire_old && reload == reload_old))
658 {
659 *t_reload = reload;
660 *t_expire = expire;
661 }
662 LeaveCriticalSection (crit);
663
664 return start_timer_thread (which);
665}
666
667int
668alarm (int seconds)
669{
670#ifdef HAVE_SETITIMER
671 struct itimerval new_values, old_values;
672
673 new_values.it_value.tv_sec = seconds;
674 new_values.it_value.tv_usec = 0;
675 new_values.it_interval.tv_sec = new_values.it_interval.tv_usec = 0;
676
677 if (setitimer (ITIMER_REAL, &new_values, &old_values) < 0)
678 return 0;
679 return old_values.it_value.tv_sec;
680#else
681 return seconds;
682#endif
683}
684
146/* Defined in <process.h> which conflicts with the local copy */ 685/* Defined in <process.h> which conflicts with the local copy */
147#define _P_NOWAIT 1 686#define _P_NOWAIT 1
148 687
@@ -593,7 +1132,7 @@ get_result:
593 else if (WIFSIGNALED (retval)) 1132 else if (WIFSIGNALED (retval))
594 { 1133 {
595 int code = WTERMSIG (retval); 1134 int code = WTERMSIG (retval);
596 char *signame; 1135 const char *signame;
597 1136
598 synchronize_system_messages_locale (); 1137 synchronize_system_messages_locale ();
599 signame = strsignal (code); 1138 signame = strsignal (code);
@@ -668,7 +1207,7 @@ w32_executable_type (char * filename,
668 if (dos_header->e_magic != IMAGE_DOS_SIGNATURE) 1207 if (dos_header->e_magic != IMAGE_DOS_SIGNATURE)
669 goto unwind; 1208 goto unwind;
670 1209
671 nt_header = (PIMAGE_NT_HEADERS) ((char *) dos_header + dos_header->e_lfanew); 1210 nt_header = (PIMAGE_NT_HEADERS) ((unsigned char *) dos_header + dos_header->e_lfanew);
672 1211
673 if ((char *) nt_header > (char *) dos_header + executable.size) 1212 if ((char *) nt_header > (char *) dos_header + executable.size)
674 { 1213 {
diff --git a/src/w32term.c b/src/w32term.c
index 5d5e572c475..1cc8bd2adef 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -102,7 +102,7 @@ struct w32_display_info *x_display_list;
102Lisp_Object w32_display_name_list; 102Lisp_Object w32_display_name_list;
103 103
104 104
105#ifndef GLYPHSET 105#if _WIN32_WINNT < 0x0500
106/* Pre Windows 2000, this was not available, but define it here so 106/* Pre Windows 2000, this was not available, but define it here so
107 that Emacs compiled on such a platform will run on newer versions. */ 107 that Emacs compiled on such a platform will run on newer versions. */
108 108
@@ -360,7 +360,11 @@ w32_draw_underwave (struct glyph_string *s, COLORREF color)
360 360
361 /* Find and set clipping rectangle */ 361 /* Find and set clipping rectangle */
362 362
363 wave_clip = (XRectangle){ x0, y0, width, wave_height }; 363 wave_clip.x = x0;
364 wave_clip.y = y0;
365 wave_clip.width = width;
366 wave_clip.height = wave_height;
367
364 get_glyph_string_clip_rect (s, &w32_string_clip); 368 get_glyph_string_clip_rect (s, &w32_string_clip);
365 CONVERT_TO_XRECT (string_clip, w32_string_clip); 369 CONVERT_TO_XRECT (string_clip, w32_string_clip);
366 370
diff --git a/src/w32term.h b/src/w32term.h
index 5d756f435e4..fcaccc4d624 100644
--- a/src/w32term.h
+++ b/src/w32term.h
@@ -201,6 +201,8 @@ extern struct w32_display_info *w32_term_init (Lisp_Object,
201extern int x_display_pixel_height (struct w32_display_info *); 201extern int x_display_pixel_height (struct w32_display_info *);
202extern int x_display_pixel_width (struct w32_display_info *); 202extern int x_display_pixel_width (struct w32_display_info *);
203 203
204extern Lisp_Object x_get_focus_frame (struct frame *);
205
204 206
205#define PIX_TYPE COLORREF 207#define PIX_TYPE COLORREF
206 208
@@ -431,7 +433,15 @@ struct scroll_bar {
431/* Turning a lisp vector value into a pointer to a struct scroll_bar. */ 433/* Turning a lisp vector value into a pointer to a struct scroll_bar. */
432#define XSCROLL_BAR(vec) ((struct scroll_bar *) XVECTOR (vec)) 434#define XSCROLL_BAR(vec) ((struct scroll_bar *) XVECTOR (vec))
433 435
436#ifdef _WIN64
437/* Building a 64-bit C integer from two 32-bit lisp integers. */
438#define SCROLL_BAR_PACK(low, high) (XINT (high) << 32 | XINT (low))
434 439
440/* Setting two lisp integers to the low and high words of a 64-bit C int. */
441#define SCROLL_BAR_UNPACK(low, high, int64) \
442 (XSETINT ((low), ((DWORDLONG)(int64)) & 0xffffffff), \
443 XSETINT ((high), ((DWORDLONG)(int64) >> 32) & 0xffffffff))
444#else /* not _WIN64 */
435/* Building a 32-bit C integer from two 16-bit lisp integers. */ 445/* Building a 32-bit C integer from two 16-bit lisp integers. */
436#define SCROLL_BAR_PACK(low, high) (XINT (high) << 16 | XINT (low)) 446#define SCROLL_BAR_PACK(low, high) (XINT (high) << 16 | XINT (low))
437 447
@@ -439,7 +449,7 @@ struct scroll_bar {
439#define SCROLL_BAR_UNPACK(low, high, int32) \ 449#define SCROLL_BAR_UNPACK(low, high, int32) \
440 (XSETINT ((low), (int32) & 0xffff), \ 450 (XSETINT ((low), (int32) & 0xffff), \
441 XSETINT ((high), ((int32) >> 16) & 0xffff)) 451 XSETINT ((high), ((int32) >> 16) & 0xffff))
442 452#endif /* not _WIN64 */
443 453
444/* Extract the window id of the scroll bar from a struct scroll_bar. */ 454/* Extract the window id of the scroll bar from a struct scroll_bar. */
445#define SCROLL_BAR_W32_WINDOW(ptr) \ 455#define SCROLL_BAR_W32_WINDOW(ptr) \
@@ -447,7 +457,7 @@ struct scroll_bar {
447 457
448/* Store a window id in a struct scroll_bar. */ 458/* Store a window id in a struct scroll_bar. */
449#define SET_SCROLL_BAR_W32_WINDOW(ptr, id) \ 459#define SET_SCROLL_BAR_W32_WINDOW(ptr, id) \
450 (SCROLL_BAR_UNPACK ((ptr)->w32_window_low, (ptr)->w32_window_high, (int) id)) 460 (SCROLL_BAR_UNPACK ((ptr)->w32_window_low, (ptr)->w32_window_high, (intptr_t) id))
451 461
452/* Extract the X widget of the scroll bar from a struct scroll_bar. */ 462/* Extract the X widget of the scroll bar from a struct scroll_bar. */
453#define SCROLL_BAR_X_WIDGET(ptr) \ 463#define SCROLL_BAR_X_WIDGET(ptr) \
diff --git a/src/window.c b/src/window.c
index bb3b73f9acd..3b974616e38 100644
--- a/src/window.c
+++ b/src/window.c
@@ -133,102 +133,102 @@ static EMACS_INT window_scroll_preserve_hpos;
133static EMACS_INT window_scroll_preserve_vpos; 133static EMACS_INT window_scroll_preserve_vpos;
134 134
135/* These setters are used only in this file, so they can be private. */ 135/* These setters are used only in this file, so they can be private. */
136static inline void 136static void
137wset_combination_limit (struct window *w, Lisp_Object val) 137wset_combination_limit (struct window *w, Lisp_Object val)
138{ 138{
139 w->combination_limit = val; 139 w->combination_limit = val;
140} 140}
141static inline void 141static void
142wset_dedicated (struct window *w, Lisp_Object val) 142wset_dedicated (struct window *w, Lisp_Object val)
143{ 143{
144 w->dedicated = val; 144 w->dedicated = val;
145} 145}
146static inline void 146static void
147wset_display_table (struct window *w, Lisp_Object val) 147wset_display_table (struct window *w, Lisp_Object val)
148{ 148{
149 w->display_table = val; 149 w->display_table = val;
150} 150}
151static inline void 151static void
152wset_hchild (struct window *w, Lisp_Object val) 152wset_hchild (struct window *w, Lisp_Object val)
153{ 153{
154 w->hchild = val; 154 w->hchild = val;
155} 155}
156static inline void 156static void
157wset_left_fringe_width (struct window *w, Lisp_Object val) 157wset_left_fringe_width (struct window *w, Lisp_Object val)
158{ 158{
159 w->left_fringe_width = val; 159 w->left_fringe_width = val;
160} 160}
161static inline void 161static void
162wset_left_margin_cols (struct window *w, Lisp_Object val) 162wset_left_margin_cols (struct window *w, Lisp_Object val)
163{ 163{
164 w->left_margin_cols = val; 164 w->left_margin_cols = val;
165} 165}
166static inline void 166static void
167wset_new_normal (struct window *w, Lisp_Object val) 167wset_new_normal (struct window *w, Lisp_Object val)
168{ 168{
169 w->new_normal = val; 169 w->new_normal = val;
170} 170}
171static inline void 171static void
172wset_new_total (struct window *w, Lisp_Object val) 172wset_new_total (struct window *w, Lisp_Object val)
173{ 173{
174 w->new_total = val; 174 w->new_total = val;
175} 175}
176static inline void 176static void
177wset_normal_cols (struct window *w, Lisp_Object val) 177wset_normal_cols (struct window *w, Lisp_Object val)
178{ 178{
179 w->normal_cols = val; 179 w->normal_cols = val;
180} 180}
181static inline void 181static void
182wset_normal_lines (struct window *w, Lisp_Object val) 182wset_normal_lines (struct window *w, Lisp_Object val)
183{ 183{
184 w->normal_lines = val; 184 w->normal_lines = val;
185} 185}
186static inline void 186static void
187wset_parent (struct window *w, Lisp_Object val) 187wset_parent (struct window *w, Lisp_Object val)
188{ 188{
189 w->parent = val; 189 w->parent = val;
190} 190}
191static inline void 191static void
192wset_pointm (struct window *w, Lisp_Object val) 192wset_pointm (struct window *w, Lisp_Object val)
193{ 193{
194 w->pointm = val; 194 w->pointm = val;
195} 195}
196static inline void 196static void
197wset_right_fringe_width (struct window *w, Lisp_Object val) 197wset_right_fringe_width (struct window *w, Lisp_Object val)
198{ 198{
199 w->right_fringe_width = val; 199 w->right_fringe_width = val;
200} 200}
201static inline void 201static void
202wset_right_margin_cols (struct window *w, Lisp_Object val) 202wset_right_margin_cols (struct window *w, Lisp_Object val)
203{ 203{
204 w->right_margin_cols = val; 204 w->right_margin_cols = val;
205} 205}
206static inline void 206static void
207wset_scroll_bar_width (struct window *w, Lisp_Object val) 207wset_scroll_bar_width (struct window *w, Lisp_Object val)
208{ 208{
209 w->scroll_bar_width = val; 209 w->scroll_bar_width = val;
210} 210}
211static inline void 211static void
212wset_start (struct window *w, Lisp_Object val) 212wset_start (struct window *w, Lisp_Object val)
213{ 213{
214 w->start = val; 214 w->start = val;
215} 215}
216static inline void 216static void
217wset_temslot (struct window *w, Lisp_Object val) 217wset_temslot (struct window *w, Lisp_Object val)
218{ 218{
219 w->temslot = val; 219 w->temslot = val;
220} 220}
221static inline void 221static void
222wset_vchild (struct window *w, Lisp_Object val) 222wset_vchild (struct window *w, Lisp_Object val)
223{ 223{
224 w->vchild = val; 224 w->vchild = val;
225} 225}
226static inline void 226static void
227wset_vertical_scroll_bar_type (struct window *w, Lisp_Object val) 227wset_vertical_scroll_bar_type (struct window *w, Lisp_Object val)
228{ 228{
229 w->vertical_scroll_bar_type = val; 229 w->vertical_scroll_bar_type = val;
230} 230}
231static inline void 231static void
232wset_window_parameters (struct window *w, Lisp_Object val) 232wset_window_parameters (struct window *w, Lisp_Object val)
233{ 233{
234 w->window_parameters = val; 234 w->window_parameters = val;
diff --git a/src/xdisp.c b/src/xdisp.c
index b23a06ff3d1..635e7ecd0b2 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -367,22 +367,22 @@ static Lisp_Object Qmargin, Qpointer;
367static Lisp_Object Qline_height; 367static Lisp_Object Qline_height;
368 368
369/* These setters are used only in this file, so they can be private. */ 369/* These setters are used only in this file, so they can be private. */
370static inline void 370static void
371wset_base_line_number (struct window *w, Lisp_Object val) 371wset_base_line_number (struct window *w, Lisp_Object val)
372{ 372{
373 w->base_line_number = val; 373 w->base_line_number = val;
374} 374}
375static inline void 375static void
376wset_base_line_pos (struct window *w, Lisp_Object val) 376wset_base_line_pos (struct window *w, Lisp_Object val)
377{ 377{
378 w->base_line_pos = val; 378 w->base_line_pos = val;
379} 379}
380static inline void 380static void
381wset_column_number_displayed (struct window *w, Lisp_Object val) 381wset_column_number_displayed (struct window *w, Lisp_Object val)
382{ 382{
383 w->column_number_displayed = val; 383 w->column_number_displayed = val;
384} 384}
385static inline void 385static void
386wset_region_showing (struct window *w, Lisp_Object val) 386wset_region_showing (struct window *w, Lisp_Object val)
387{ 387{
388 w->region_showing = val; 388 w->region_showing = val;
@@ -1191,7 +1191,7 @@ window_box (struct window *w, int area, int *box_x, int *box_y,
1191 *BOTTOM_RIGHT_Y the coordinates of the bottom-right corner of the 1191 *BOTTOM_RIGHT_Y the coordinates of the bottom-right corner of the
1192 box. */ 1192 box. */
1193 1193
1194static inline void 1194static void
1195window_box_edges (struct window *w, int area, int *top_left_x, int *top_left_y, 1195window_box_edges (struct window *w, int area, int *top_left_x, int *top_left_y,
1196 int *bottom_right_x, int *bottom_right_y) 1196 int *bottom_right_x, int *bottom_right_y)
1197{ 1197{
@@ -1278,7 +1278,7 @@ string_from_display_spec (Lisp_Object spec)
1278/* Limit insanely large values of W->hscroll on frame F to the largest 1278/* Limit insanely large values of W->hscroll on frame F to the largest
1279 value that will still prevent first_visible_x and last_visible_x of 1279 value that will still prevent first_visible_x and last_visible_x of
1280 'struct it' from overflowing an int. */ 1280 'struct it' from overflowing an int. */
1281static inline int 1281static int
1282window_hscroll_limited (struct window *w, struct frame *f) 1282window_hscroll_limited (struct window *w, struct frame *f)
1283{ 1283{
1284 ptrdiff_t window_hscroll = w->hscroll; 1284 ptrdiff_t window_hscroll = w->hscroll;
@@ -1625,7 +1625,7 @@ pos_visible_p (struct window *w, ptrdiff_t charpos, int *x, int *y,
1625 returns an invalid character. If we find one, we return a `?', but 1625 returns an invalid character. If we find one, we return a `?', but
1626 with the length of the invalid character. */ 1626 with the length of the invalid character. */
1627 1627
1628static inline int 1628static int
1629string_char_and_length (const unsigned char *str, int *len) 1629string_char_and_length (const unsigned char *str, int *len)
1630{ 1630{
1631 int c; 1631 int c;
@@ -1673,7 +1673,7 @@ string_pos_nchars_ahead (struct text_pos pos, Lisp_Object string, ptrdiff_t ncha
1673/* Value is the text position, i.e. character and byte position, 1673/* Value is the text position, i.e. character and byte position,
1674 for character position CHARPOS in STRING. */ 1674 for character position CHARPOS in STRING. */
1675 1675
1676static inline struct text_pos 1676static struct text_pos
1677string_pos (ptrdiff_t charpos, Lisp_Object string) 1677string_pos (ptrdiff_t charpos, Lisp_Object string)
1678{ 1678{
1679 struct text_pos pos; 1679 struct text_pos pos;
@@ -12577,7 +12577,7 @@ debug_method_add (struct window *w, char const *fmt, ...)
12577 buffer position, END is given as a distance from Z. Used in 12577 buffer position, END is given as a distance from Z. Used in
12578 redisplay_internal for display optimization. */ 12578 redisplay_internal for display optimization. */
12579 12579
12580static inline int 12580static int
12581text_outside_line_unchanged_p (struct window *w, 12581text_outside_line_unchanged_p (struct window *w,
12582 ptrdiff_t start, ptrdiff_t end) 12582 ptrdiff_t start, ptrdiff_t end)
12583{ 12583{
@@ -12838,7 +12838,7 @@ check_point_in_composition (struct buffer *prev_buf, ptrdiff_t prev_pt,
12838/* Reconsider the setting of B->clip_changed which is displayed 12838/* Reconsider the setting of B->clip_changed which is displayed
12839 in window W. */ 12839 in window W. */
12840 12840
12841static inline void 12841static void
12842reconsider_clip_changes (struct window *w, struct buffer *b) 12842reconsider_clip_changes (struct window *w, struct buffer *b)
12843{ 12843{
12844 if (b->clip_changed 12844 if (b->clip_changed
@@ -14538,7 +14538,7 @@ set_cursor_from_row (struct window *w, struct glyph_row *row,
14538 14538
14539 We assume that the window's buffer is really current. */ 14539 We assume that the window's buffer is really current. */
14540 14540
14541static inline struct text_pos 14541static struct text_pos
14542run_window_scroll_functions (Lisp_Object window, struct text_pos startp) 14542run_window_scroll_functions (Lisp_Object window, struct text_pos startp)
14543{ 14543{
14544 struct window *w = XWINDOW (window); 14544 struct window *w = XWINDOW (window);
@@ -22491,7 +22491,7 @@ init_glyph_string (struct glyph_string *s,
22491/* Append the list of glyph strings with head H and tail T to the list 22491/* Append the list of glyph strings with head H and tail T to the list
22492 with head *HEAD and tail *TAIL. Set *HEAD and *TAIL to the result. */ 22492 with head *HEAD and tail *TAIL. Set *HEAD and *TAIL to the result. */
22493 22493
22494static inline void 22494static void
22495append_glyph_string_lists (struct glyph_string **head, struct glyph_string **tail, 22495append_glyph_string_lists (struct glyph_string **head, struct glyph_string **tail,
22496 struct glyph_string *h, struct glyph_string *t) 22496 struct glyph_string *h, struct glyph_string *t)
22497{ 22497{
@@ -22511,7 +22511,7 @@ append_glyph_string_lists (struct glyph_string **head, struct glyph_string **tai
22511 list with head *HEAD and tail *TAIL. Set *HEAD and *TAIL to the 22511 list with head *HEAD and tail *TAIL. Set *HEAD and *TAIL to the
22512 result. */ 22512 result. */
22513 22513
22514static inline void 22514static void
22515prepend_glyph_string_lists (struct glyph_string **head, struct glyph_string **tail, 22515prepend_glyph_string_lists (struct glyph_string **head, struct glyph_string **tail,
22516 struct glyph_string *h, struct glyph_string *t) 22516 struct glyph_string *h, struct glyph_string *t)
22517{ 22517{
@@ -22530,7 +22530,7 @@ prepend_glyph_string_lists (struct glyph_string **head, struct glyph_string **ta
22530/* Append glyph string S to the list with head *HEAD and tail *TAIL. 22530/* Append glyph string S to the list with head *HEAD and tail *TAIL.
22531 Set *HEAD and *TAIL to the resulting list. */ 22531 Set *HEAD and *TAIL to the resulting list. */
22532 22532
22533static inline void 22533static void
22534append_glyph_string (struct glyph_string **head, struct glyph_string **tail, 22534append_glyph_string (struct glyph_string **head, struct glyph_string **tail,
22535 struct glyph_string *s) 22535 struct glyph_string *s)
22536{ 22536{
@@ -22545,7 +22545,7 @@ append_glyph_string (struct glyph_string **head, struct glyph_string **tail,
22545 Value is a pointer to a realized face that is ready for display if 22545 Value is a pointer to a realized face that is ready for display if
22546 DISPLAY_P is non-zero. */ 22546 DISPLAY_P is non-zero. */
22547 22547
22548static inline struct face * 22548static struct face *
22549get_char_face_and_encoding (struct frame *f, int c, int face_id, 22549get_char_face_and_encoding (struct frame *f, int c, int face_id,
22550 XChar2b *char2b, int display_p) 22550 XChar2b *char2b, int display_p)
22551{ 22551{
@@ -22578,7 +22578,7 @@ get_char_face_and_encoding (struct frame *f, int c, int face_id,
22578 The encoding of GLYPH->u.ch is returned in *CHAR2B. Value is 22578 The encoding of GLYPH->u.ch is returned in *CHAR2B. Value is
22579 a pointer to a realized face that is ready for display. */ 22579 a pointer to a realized face that is ready for display. */
22580 22580
22581static inline struct face * 22581static struct face *
22582get_glyph_face_and_encoding (struct frame *f, struct glyph *glyph, 22582get_glyph_face_and_encoding (struct frame *f, struct glyph *glyph,
22583 XChar2b *char2b, int *two_byte_p) 22583 XChar2b *char2b, int *two_byte_p)
22584{ 22584{
@@ -22615,7 +22615,7 @@ get_glyph_face_and_encoding (struct frame *f, struct glyph *glyph,
22615/* Get glyph code of character C in FONT in the two-byte form CHAR2B. 22615/* Get glyph code of character C in FONT in the two-byte form CHAR2B.
22616 Return 1 if FONT has a glyph for C, otherwise return 0. */ 22616 Return 1 if FONT has a glyph for C, otherwise return 0. */
22617 22617
22618static inline int 22618static int
22619get_char_glyph_code (int c, struct font *font, XChar2b *char2b) 22619get_char_glyph_code (int c, struct font *font, XChar2b *char2b)
22620{ 22620{
22621 unsigned code; 22621 unsigned code;
@@ -23089,7 +23089,7 @@ right_overwriting (struct glyph_string *s)
23089 first glyph following S. LAST_X is the right-most x-position + 1 23089 first glyph following S. LAST_X is the right-most x-position + 1
23090 in the drawing area. */ 23090 in the drawing area. */
23091 23091
23092static inline void 23092static void
23093set_glyph_string_background_width (struct glyph_string *s, int start, int last_x) 23093set_glyph_string_background_width (struct glyph_string *s, int start, int last_x)
23094{ 23094{
23095 /* If the face of this glyph string has to be drawn to the end of 23095 /* If the face of this glyph string has to be drawn to the end of
@@ -23650,7 +23650,7 @@ draw_glyphs (struct window *w, int x, struct glyph_row *row,
23650/* Store one glyph for IT->char_to_display in IT->glyph_row. 23650/* Store one glyph for IT->char_to_display in IT->glyph_row.
23651 Called from x_produce_glyphs when IT->glyph_row is non-null. */ 23651 Called from x_produce_glyphs when IT->glyph_row is non-null. */
23652 23652
23653static inline void 23653static void
23654append_glyph (struct it *it) 23654append_glyph (struct it *it)
23655{ 23655{
23656 struct glyph *glyph; 23656 struct glyph *glyph;
@@ -23724,7 +23724,7 @@ append_glyph (struct it *it)
23724 IT->glyph_row. Called from x_produce_glyphs when IT->glyph_row is 23724 IT->glyph_row. Called from x_produce_glyphs when IT->glyph_row is
23725 non-null. */ 23725 non-null. */
23726 23726
23727static inline void 23727static void
23728append_composite_glyph (struct it *it) 23728append_composite_glyph (struct it *it)
23729{ 23729{
23730 struct glyph *glyph; 23730 struct glyph *glyph;
@@ -23793,7 +23793,7 @@ append_composite_glyph (struct it *it)
23793/* Change IT->ascent and IT->height according to the setting of 23793/* Change IT->ascent and IT->height according to the setting of
23794 IT->voffset. */ 23794 IT->voffset. */
23795 23795
23796static inline void 23796static void
23797take_vertical_position_into_account (struct it *it) 23797take_vertical_position_into_account (struct it *it)
23798{ 23798{
23799 if (it->voffset) 23799 if (it->voffset)
@@ -28986,7 +28986,7 @@ and is used only on frames for which no explicit name has been set
28986 doc: /* Maximum number of lines to keep in the message log buffer. 28986 doc: /* Maximum number of lines to keep in the message log buffer.
28987If nil, disable message logging. If t, log messages but don't truncate 28987If nil, disable message logging. If t, log messages but don't truncate
28988the buffer when it becomes large. */); 28988the buffer when it becomes large. */);
28989 Vmessage_log_max = make_number (100); 28989 Vmessage_log_max = make_number (1000);
28990 28990
28991 DEFVAR_LISP ("window-size-change-functions", Vwindow_size_change_functions, 28991 DEFVAR_LISP ("window-size-change-functions", Vwindow_size_change_functions,
28992 doc: /* Functions called before redisplay, if window sizes have changed. 28992 doc: /* Functions called before redisplay, if window sizes have changed.
@@ -29357,10 +29357,6 @@ init_xdisp (void)
29357 help_echo_showing_p = 0; 29357 help_echo_showing_p = 0;
29358} 29358}
29359 29359
29360/* Since w32 does not support atimers, it defines its own implementation of
29361 the following three functions in w32fns.c. */
29362#ifndef WINDOWSNT
29363
29364/* Platform-independent portion of hourglass implementation. */ 29360/* Platform-independent portion of hourglass implementation. */
29365 29361
29366/* Cancel a currently active hourglass timer, and start a new one. */ 29362/* Cancel a currently active hourglass timer, and start a new one. */
@@ -29383,6 +29379,10 @@ start_hourglass (void)
29383 else 29379 else
29384 delay = make_emacs_time (DEFAULT_HOURGLASS_DELAY, 0); 29380 delay = make_emacs_time (DEFAULT_HOURGLASS_DELAY, 0);
29385 29381
29382#ifdef WINDOWSNT
29383 w32_note_current_window ();
29384#endif
29385
29386 hourglass_atimer = start_atimer (ATIMER_RELATIVE, delay, 29386 hourglass_atimer = start_atimer (ATIMER_RELATIVE, delay,
29387 show_hourglass, NULL); 29387 show_hourglass, NULL);
29388#endif 29388#endif
@@ -29405,4 +29405,3 @@ cancel_hourglass (void)
29405 hide_hourglass (); 29405 hide_hourglass ();
29406#endif 29406#endif
29407} 29407}
29408#endif /* ! WINDOWSNT */
diff --git a/src/xfaces.c b/src/xfaces.c
index 28be6aaf082..f861dde2d15 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -601,7 +601,7 @@ x_free_dpy_colors (Display *dpy, Screen *screen, Colormap cmap,
601/* Create and return a GC for use on frame F. GC values and mask 601/* Create and return a GC for use on frame F. GC values and mask
602 are given by XGCV and MASK. */ 602 are given by XGCV and MASK. */
603 603
604static inline GC 604static GC
605x_create_gc (struct frame *f, long unsigned int mask, XGCValues *xgcv) 605x_create_gc (struct frame *f, long unsigned int mask, XGCValues *xgcv)
606{ 606{
607 GC gc; 607 GC gc;
@@ -615,7 +615,7 @@ x_create_gc (struct frame *f, long unsigned int mask, XGCValues *xgcv)
615 615
616/* Free GC which was used on frame F. */ 616/* Free GC which was used on frame F. */
617 617
618static inline void 618static void
619x_free_gc (struct frame *f, GC gc) 619x_free_gc (struct frame *f, GC gc)
620{ 620{
621 eassert (input_blocked_p ()); 621 eassert (input_blocked_p ());
@@ -628,7 +628,7 @@ x_free_gc (struct frame *f, GC gc)
628#ifdef WINDOWSNT 628#ifdef WINDOWSNT
629/* W32 emulation of GCs */ 629/* W32 emulation of GCs */
630 630
631static inline GC 631static GC
632x_create_gc (struct frame *f, unsigned long mask, XGCValues *xgcv) 632x_create_gc (struct frame *f, unsigned long mask, XGCValues *xgcv)
633{ 633{
634 GC gc; 634 GC gc;
@@ -642,7 +642,7 @@ x_create_gc (struct frame *f, unsigned long mask, XGCValues *xgcv)
642 642
643/* Free GC which was used on frame F. */ 643/* Free GC which was used on frame F. */
644 644
645static inline void 645static void
646x_free_gc (struct frame *f, GC gc) 646x_free_gc (struct frame *f, GC gc)
647{ 647{
648 IF_DEBUG (eassert (--ngcs >= 0)); 648 IF_DEBUG (eassert (--ngcs >= 0));
@@ -654,7 +654,7 @@ x_free_gc (struct frame *f, GC gc)
654#ifdef HAVE_NS 654#ifdef HAVE_NS
655/* NS emulation of GCs */ 655/* NS emulation of GCs */
656 656
657static inline GC 657static GC
658x_create_gc (struct frame *f, 658x_create_gc (struct frame *f,
659 unsigned long mask, 659 unsigned long mask,
660 XGCValues *xgcv) 660 XGCValues *xgcv)
@@ -664,7 +664,7 @@ x_create_gc (struct frame *f,
664 return gc; 664 return gc;
665} 665}
666 666
667static inline void 667static void
668x_free_gc (struct frame *f, GC gc) 668x_free_gc (struct frame *f, GC gc)
669{ 669{
670 xfree (gc); 670 xfree (gc);
@@ -677,7 +677,7 @@ x_free_gc (struct frame *f, GC gc)
677 CHECK_LIVE_FRAME. This is here because it's a frequent pattern in 677 CHECK_LIVE_FRAME. This is here because it's a frequent pattern in
678 Lisp function definitions. */ 678 Lisp function definitions. */
679 679
680static inline struct frame * 680static struct frame *
681frame_or_selected_frame (Lisp_Object frame, int nparam) 681frame_or_selected_frame (Lisp_Object frame, int nparam)
682{ 682{
683 if (NILP (frame)) 683 if (NILP (frame))
@@ -1920,7 +1920,7 @@ struct named_merge_point
1920 FACE_NAME and NAMED_MERGE_POINT_KIND, as the head of the linked list 1920 FACE_NAME and NAMED_MERGE_POINT_KIND, as the head of the linked list
1921 pointed to by NAMED_MERGE_POINTS, and return 1. */ 1921 pointed to by NAMED_MERGE_POINTS, and return 1. */
1922 1922
1923static inline int 1923static int
1924push_named_merge_point (struct named_merge_point *new_named_merge_point, 1924push_named_merge_point (struct named_merge_point *new_named_merge_point,
1925 Lisp_Object face_name, 1925 Lisp_Object face_name,
1926 enum named_merge_point_kind named_merge_point_kind, 1926 enum named_merge_point_kind named_merge_point_kind,
@@ -2004,7 +2004,7 @@ resolve_face_name (Lisp_Object face_name, int signal_p)
2004 face text properties; Ediff uses that). If SIGNAL_P is non-zero, 2004 face text properties; Ediff uses that). If SIGNAL_P is non-zero,
2005 signal an error if FACE_NAME is not a valid face name. If SIGNAL_P 2005 signal an error if FACE_NAME is not a valid face name. If SIGNAL_P
2006 is zero, value is nil if FACE_NAME is not a valid face name. */ 2006 is zero, value is nil if FACE_NAME is not a valid face name. */
2007static inline Lisp_Object 2007static Lisp_Object
2008lface_from_face_name_no_resolve (struct frame *f, Lisp_Object face_name, 2008lface_from_face_name_no_resolve (struct frame *f, Lisp_Object face_name,
2009 int signal_p) 2009 int signal_p)
2010{ 2010{
@@ -2033,7 +2033,7 @@ lface_from_face_name_no_resolve (struct frame *f, Lisp_Object face_name,
2033 non-zero, signal an error if FACE_NAME is not a valid face name. 2033 non-zero, signal an error if FACE_NAME is not a valid face name.
2034 If SIGNAL_P is zero, value is nil if FACE_NAME is not a valid face 2034 If SIGNAL_P is zero, value is nil if FACE_NAME is not a valid face
2035 name. */ 2035 name. */
2036static inline Lisp_Object 2036static Lisp_Object
2037lface_from_face_name (struct frame *f, Lisp_Object face_name, int signal_p) 2037lface_from_face_name (struct frame *f, Lisp_Object face_name, int signal_p)
2038{ 2038{
2039 face_name = resolve_face_name (face_name, signal_p); 2039 face_name = resolve_face_name (face_name, signal_p);
@@ -2047,7 +2047,7 @@ lface_from_face_name (struct frame *f, Lisp_Object face_name, int signal_p)
2047 is non-zero, signal an error if FACE_NAME does not name a face. 2047 is non-zero, signal an error if FACE_NAME does not name a face.
2048 Otherwise, value is zero if FACE_NAME is not a face. */ 2048 Otherwise, value is zero if FACE_NAME is not a face. */
2049 2049
2050static inline int 2050static int
2051get_lface_attributes_no_remap (struct frame *f, Lisp_Object face_name, 2051get_lface_attributes_no_remap (struct frame *f, Lisp_Object face_name,
2052 Lisp_Object *attrs, int signal_p) 2052 Lisp_Object *attrs, int signal_p)
2053{ 2053{
@@ -2069,7 +2069,7 @@ get_lface_attributes_no_remap (struct frame *f, Lisp_Object face_name,
2069 non-zero, signal an error if FACE_NAME does not name a face. 2069 non-zero, signal an error if FACE_NAME does not name a face.
2070 Otherwise, value is zero if FACE_NAME is not a face. */ 2070 Otherwise, value is zero if FACE_NAME is not a face. */
2071 2071
2072static inline int 2072static int
2073get_lface_attributes (struct frame *f, Lisp_Object face_name, 2073get_lface_attributes (struct frame *f, Lisp_Object face_name,
2074 Lisp_Object *attrs, int signal_p, 2074 Lisp_Object *attrs, int signal_p,
2075 struct named_merge_point *named_merge_points) 2075 struct named_merge_point *named_merge_points)
@@ -2234,7 +2234,7 @@ merge_face_heights (Lisp_Object from, Lisp_Object to, Lisp_Object invalid)
2234 loops in face inheritance/remapping; it should be 0 when called from 2234 loops in face inheritance/remapping; it should be 0 when called from
2235 other places. */ 2235 other places. */
2236 2236
2237static inline void 2237static void
2238merge_face_vectors (struct frame *f, Lisp_Object *from, Lisp_Object *to, 2238merge_face_vectors (struct frame *f, Lisp_Object *from, Lisp_Object *to,
2239 struct named_merge_point *named_merge_points) 2239 struct named_merge_point *named_merge_points)
2240{ 2240{
@@ -3906,7 +3906,7 @@ return the font name used for CHARACTER. */)
3906 all attributes are `equal'. Tries to be fast because this function 3906 all attributes are `equal'. Tries to be fast because this function
3907 is called quite often. */ 3907 is called quite often. */
3908 3908
3909static inline int 3909static int
3910face_attr_equal_p (Lisp_Object v1, Lisp_Object v2) 3910face_attr_equal_p (Lisp_Object v1, Lisp_Object v2)
3911{ 3911{
3912 /* Type can differ, e.g. when one attribute is unspecified, i.e. nil, 3912 /* Type can differ, e.g. when one attribute is unspecified, i.e. nil,
@@ -3939,7 +3939,7 @@ face_attr_equal_p (Lisp_Object v1, Lisp_Object v2)
3939 all attributes are `equal'. Tries to be fast because this function 3939 all attributes are `equal'. Tries to be fast because this function
3940 is called quite often. */ 3940 is called quite often. */
3941 3941
3942static inline int 3942static int
3943lface_equal_p (Lisp_Object *v1, Lisp_Object *v2) 3943lface_equal_p (Lisp_Object *v1, Lisp_Object *v2)
3944{ 3944{
3945 int i, equal_p = 1; 3945 int i, equal_p = 1;
@@ -4024,7 +4024,7 @@ For internal use only. */)
4024/* Return a hash code for Lisp string STRING with case ignored. Used 4024/* Return a hash code for Lisp string STRING with case ignored. Used
4025 below in computing a hash value for a Lisp face. */ 4025 below in computing a hash value for a Lisp face. */
4026 4026
4027static inline unsigned 4027static unsigned
4028hash_string_case_insensitive (Lisp_Object string) 4028hash_string_case_insensitive (Lisp_Object string)
4029{ 4029{
4030 const unsigned char *s; 4030 const unsigned char *s;
@@ -4038,7 +4038,7 @@ hash_string_case_insensitive (Lisp_Object string)
4038 4038
4039/* Return a hash code for face attribute vector V. */ 4039/* Return a hash code for face attribute vector V. */
4040 4040
4041static inline unsigned 4041static unsigned
4042lface_hash (Lisp_Object *v) 4042lface_hash (Lisp_Object *v)
4043{ 4043{
4044 return (hash_string_case_insensitive (v[LFACE_FAMILY_INDEX]) 4044 return (hash_string_case_insensitive (v[LFACE_FAMILY_INDEX])
@@ -4057,7 +4057,7 @@ lface_hash (Lisp_Object *v)
4057 family, point size, weight, width, slant, and font. Both 4057 family, point size, weight, width, slant, and font. Both
4058 LFACE1 and LFACE2 must be fully-specified. */ 4058 LFACE1 and LFACE2 must be fully-specified. */
4059 4059
4060static inline int 4060static int
4061lface_same_font_attributes_p (Lisp_Object *lface1, Lisp_Object *lface2) 4061lface_same_font_attributes_p (Lisp_Object *lface1, Lisp_Object *lface2)
4062{ 4062{
4063 eassert (lface_fully_specified_p (lface1) 4063 eassert (lface_fully_specified_p (lface1)
@@ -4453,7 +4453,7 @@ uncache_face (struct face_cache *c, struct face *face)
4453 Value is the ID of the face found. If no suitable face is found, 4453 Value is the ID of the face found. If no suitable face is found,
4454 realize a new one. */ 4454 realize a new one. */
4455 4455
4456static inline int 4456static int
4457lookup_face (struct frame *f, Lisp_Object *attr) 4457lookup_face (struct frame *f, Lisp_Object *attr)
4458{ 4458{
4459 struct face_cache *cache = FRAME_FACE_CACHE (f); 4459 struct face_cache *cache = FRAME_FACE_CACHE (f);
diff --git a/src/xml.c b/src/xml.c
index a22ca208743..a0c4fe17fc4 100644
--- a/src/xml.c
+++ b/src/xml.c
@@ -73,7 +73,7 @@ libxml2_loaded_p (void)
73#define fn_xmlCleanupParser xmlCleanupParser 73#define fn_xmlCleanupParser xmlCleanupParser
74#define fn_xmlCheckVersion xmlCheckVersion 74#define fn_xmlCheckVersion xmlCheckVersion
75 75
76static inline int 76static int
77libxml2_loaded_p (void) 77libxml2_loaded_p (void)
78{ 78{
79 return 1; 79 return 1;
diff --git a/src/xterm.c b/src/xterm.c
index 6cd1d583870..a4c3e125d8d 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -1027,7 +1027,7 @@ x_set_mouse_face_gc (struct glyph_string *s)
1027 Faces to use in the mode line have already been computed when the 1027 Faces to use in the mode line have already been computed when the
1028 matrix was built, so there isn't much to do, here. */ 1028 matrix was built, so there isn't much to do, here. */
1029 1029
1030static inline void 1030static void
1031x_set_mode_line_face_gc (struct glyph_string *s) 1031x_set_mode_line_face_gc (struct glyph_string *s)
1032{ 1032{
1033 s->gc = s->face->gc; 1033 s->gc = s->face->gc;
@@ -1038,7 +1038,7 @@ x_set_mode_line_face_gc (struct glyph_string *s)
1038 S->stippled_p to a non-zero value if the face of S has a stipple 1038 S->stippled_p to a non-zero value if the face of S has a stipple
1039 pattern. */ 1039 pattern. */
1040 1040
1041static inline void 1041static void
1042x_set_glyph_string_gc (struct glyph_string *s) 1042x_set_glyph_string_gc (struct glyph_string *s)
1043{ 1043{
1044 PREPARE_FACE_FOR_DISPLAY (s->f, s->face); 1044 PREPARE_FACE_FOR_DISPLAY (s->f, s->face);
@@ -1083,7 +1083,7 @@ x_set_glyph_string_gc (struct glyph_string *s)
1083/* Set clipping for output of glyph string S. S may be part of a mode 1083/* Set clipping for output of glyph string S. S may be part of a mode
1084 line or menu if we don't have X toolkit support. */ 1084 line or menu if we don't have X toolkit support. */
1085 1085
1086static inline void 1086static void
1087x_set_glyph_string_clipping (struct glyph_string *s) 1087x_set_glyph_string_clipping (struct glyph_string *s)
1088{ 1088{
1089 XRectangle *r = s->clip; 1089 XRectangle *r = s->clip;
@@ -1156,7 +1156,7 @@ x_compute_glyph_string_overhangs (struct glyph_string *s)
1156 1156
1157/* Fill rectangle X, Y, W, H with background color of glyph string S. */ 1157/* Fill rectangle X, Y, W, H with background color of glyph string S. */
1158 1158
1159static inline void 1159static void
1160x_clear_glyph_string_rect (struct glyph_string *s, int x, int y, int w, int h) 1160x_clear_glyph_string_rect (struct glyph_string *s, int x, int y, int w, int h)
1161{ 1161{
1162 XGCValues xgcv; 1162 XGCValues xgcv;