Merge from trunk.
[bpt/emacs.git] / src / ChangeLog
1 2011-06-15 Paul Eggert <eggert@cs.ucla.edu>
2
3 Integer overflow and signedness fixes.
4
5 * fileio.c: Don't assume EMACS_INT fits in off_t.
6 (emacs_lseek): New static function.
7 (Finsert_file_contents, Fwrite_region): Use it.
8 Use SEEK_SET, SEEK_CUR, SEEK_END as appropriate.
9
10 * fns.c (Fload_average): Don't assume 100 * load average fits in int.
11
12 * fns.c: Don't overflow int when computing a list length.
13 * fns.c (QUIT_COUNT_HEURISTIC): New constant.
14 (Flength, Fsafe_length): Use EMACS_INT, not int, to avoid unwanted
15 truncation on 64-bit hosts. Check for QUIT every
16 QUIT_COUNT_HEURISTIC entries rather than every other entry; that's
17 faster and is responsive enough.
18 (Flength): Report an error instead of overflowing an integer.
19 (Fsafe_length): Return a float if the value is not representable
20 as a fixnum. This shouldn't happen except in contrived situations.
21 (Fnthcdr, Fsort): Don't assume list length fits in int.
22 (Fcopy_sequence): Don't assume vector length fits in int.
23
24 * alloc.c: Check that resized vectors' lengths fit in fixnums.
25 (header_size, word_size): New constants.
26 (allocate_vectorlike): Don't check size overflow here.
27 (allocate_vector): Check it here instead, since this is the only
28 caller of allocate_vectorlike that could cause overflow.
29 Check that the new vector's length is representable as a fixnum.
30
31 * fns.c (next_almost_prime): Don't return a multiple of 3 or 5.
32 The previous code was bogus. For example, next_almost_prime (32)
33 returned 39, which is undesirable as it is a multiple of 3; and
34 next_almost_prime (24) returned 25, which is a multiple of 5 so
35 why was the code bothering to check for multiples of 7?
36
37 * bytecode.c (exec_byte_code): Use ptrdiff_t, not int, for vector length.
38
39 * eval.c, doprnt.c (SIZE_MAX): Remove; inttypes.h defines this now.
40
41 Variadic C functions now count arguments with ptrdiff_t.
42 This partly undoes my 2011-03-30 change, which replaced int with size_t.
43 Back then I didn't know that the Emacs coding style prefers signed int.
44 Also, in the meantime I found a few more instances where arguments
45 were being counted with int, which may truncate counts on 64-bit
46 machines, or EMACS_INT, which may be unnecessarily wide.
47 * lisp.h (struct Lisp_Subr.function.aMANY)
48 (DEFUN_ARGS_MANY, internal_condition_case_n, safe_call):
49 Arg counts are now ptrdiff_t, not size_t.
50 All variadic functions and their callers changed accordingly.
51 (struct gcpro.nvars): Now size_t, not size_t. All uses changed.
52 * bytecode.c (exec_byte_code): Check maxdepth for overflow,
53 to avoid potential buffer overrun. Don't assume arg counts fit in 'int'.
54 * callint.c (Fcall_interactively): Check arg count for overflow,
55 to avoid potential buffer overrun. Use signed char, not 'int',
56 for 'varies' array, so that we needn't bother to check its size
57 calculation for overflow.
58 * editfns.c (Fformat): Use ptrdiff_t, not EMACS_INT, to count args.
59 * eval.c (apply_lambda):
60 * fns.c (Fmapconcat): Use XFASTINT, not XINT, to get args length.
61 (struct textprop_rec.argnum): Now ptrdiff_t, not int. All uses changed.
62 (mapconcat): Use ptrdiff_t, not int and EMACS_INT, to count args.
63
64 * callint.c (Fcall_interactively): Don't use index var as event count.
65
66 * vm-limit.c (check_memory_limits): Fix incorrect extern function decls.
67 * mem-limits.h (SIZE): Remove; no longer used.
68
69 * xterm.c (x_alloc_nearest_color_1): Prefer int to long when int works.
70
71 Remove unnecessary casts.
72 * xterm.c (x_term_init):
73 * xfns.c (x_set_border_pixel):
74 * widget.c (create_frame_gcs): Remove casts to unsigned long etc.
75 These aren't needed now that we assume ANSI C.
76
77 * sound.c (Fplay_sound_internal): Remove cast to unsigned long.
78 It's more likely to cause problems (due to unsigned overflow)
79 than to cure them.
80
81 * dired.c (Ffile_attributes): Don't use 32-bit hack on 64-bit hosts.
82
83 * unexelf.c (unexec): Don't assume BSS addr fits in unsigned.
84
85 * xterm.c (handle_one_xevent): Omit unnecessary casts to unsigned.
86
87 * keyboard.c (modify_event_symbol): Don't limit alist len to UINT_MAX.
88
89 * lisp.h (CHAR_TABLE_SET): Omit now-redundant test.
90
91 * lread.c (Fload): Don't compare a possibly-garbage time_t value.
92
93 GLYPH_CODE_FACE returns EMACS_INT, not int.
94 * dispextern.h (merge_faces):
95 * xfaces.c (merge_faces):
96 * xdisp.c (get_next_display_element, next_element_from_display_vector):
97 Don't assume EMACS_INT fits in int.
98
99 * character.h (CHAR_VALID_P): Remove unused parameter.
100 * fontset.c, lisp.h, xdisp.c: All uses changed.
101
102 * editfns.c (Ftranslate_region_internal): Omit redundant test.
103
104 * fns.c (concat): Minor tuning based on overflow analysis.
105 This doesn't fix any bugs. Use int to hold character, instead
106 of constantly refetching from Emacs object. Use XFASTINT, not
107 XINT, for value known to be a character. Don't bother comparing
108 a single byte to 0400, as it's always less.
109
110 * floatfns.c (Fexpt):
111 * fileio.c (make_temp_name): Omit unnecessary cast to unsigned.
112
113 * editfns.c (Ftranslate_region_internal): Use int, not EMACS_INT
114 for characters.
115
116 * doc.c (get_doc_string): Omit (unsigned)c that mishandled negatives.
117
118 * data.c (Faset): If ARRAY is a string, check that NEWELT is a char.
119 Without this fix, on a 64-bit host (aset S 0 4294967386) would
120 incorrectly succeed when S was a string, because 4294967386 was
121 truncated before it was used.
122
123 * chartab.c (Fchar_table_range): Use CHARACTERP to check range.
124 Otherwise, an out-of-range integer could cause undefined behavior
125 on a 64-bit host.
126
127 * composite.c: Use int, not EMACS_INT, for characters.
128 (fill_gstring_body, composition_compute_stop_pos): Use int, not
129 EMACS_INT, for values that are known to be in character range.
130 This doesn't fix any bugs but is the usual style inside Emacs and
131 may generate better code on 32-bit machines.
132
133 Make sure a 64-bit char is never passed to ENCODE_CHAR.
134 This is for reasons similar to the recent CHAR_STRING fix.
135 * charset.c (Fencode_char): Check that character arg is actually
136 a character. Pass an int to ENCODE_CHAR.
137 * charset.h (ENCODE_CHAR): Verify that the character argument is no
138 wider than 'int', as a compile-time check to prevent future regressions
139 in this area.
140
141 * character.c (char_string): Remove unnecessary casts.
142
143 Make sure a 64-bit char is never passed to CHAR_STRING.
144 Otherwise, CHAR_STRING would do the wrong thing on a 64-bit platform,
145 by silently ignoring the top 32 bits, allowing some values
146 that were far too large to be valid characters.
147 * character.h: Include <verify.h>.
148 (CHAR_STRING, CHAR_STRING_ADVANCE): Verify that the character
149 arguments are no wider than unsigned, as a compile-time check
150 to prevent future regressions in this area.
151 * data.c (Faset):
152 * editfns.c (Fchar_to_string, general_insert_function, Finsert_char)
153 (Fsubst_char_in_region):
154 * fns.c (concat):
155 * xdisp.c (decode_mode_spec_coding):
156 Adjust to CHAR_STRING's new requirement.
157 * editfns.c (Finsert_char, Fsubst_char_in_region):
158 * fns.c (concat): Check that character args are actually
159 characters. Without this test, these functions did the wrong
160 thing with wildly out-of-range values on 64-bit hosts.
161
162 Remove incorrect casts to 'unsigned' that lose info on 64-bit hosts.
163 These casts should not be needed on 32-bit hosts, either.
164 * keyboard.c (read_char):
165 * lread.c (Fload): Remove casts to unsigned.
166
167 * lisp.h (UNSIGNED_CMP): New macro.
168 This fixes comparison bugs on 64-bit hosts.
169 (ASCII_CHAR_P): Use it.
170 * casefiddle.c (casify_object):
171 * character.h (ASCII_BYTE_P, CHAR_VALID_P)
172 (SINGLE_BYTE_CHAR_P, CHAR_STRING):
173 * composite.h (COMPOSITION_ENCODE_RULE_VALID):
174 * dispextern.h (FACE_FROM_ID):
175 * keyboard.c (read_char): Use UNSIGNED_CMP.
176
177 * xmenu.c (dialog_selection_callback) [!USE_GTK]: Cast to intptr_t,
178 not to EMACS_INT, to avoid GCC warning.
179
180 * xfns.c (x_set_scroll_bar_default_width): Remove unused 'int' locals.
181
182 * buffer.h (PTR_BYTE_POS, BUF_PTR_BYTE_POS): Remove harmful cast.
183 The cast incorrectly truncated 64-bit byte offsets to 32 bits, and
184 isn't needed on 32-bit machines.
185
186 * buffer.c (Fgenerate_new_buffer_name):
187 Use EMACS_INT for count, not int.
188 (advance_to_char_boundary): Return EMACS_INT, not int.
189
190 * data.c (Qcompiled_function): Now static.
191
192 * window.c (window_body_lines): Now static.
193
194 * image.c (gif_load): Rename local to avoid shadowing.
195
196 * lisp.h (SAFE_ALLOCA_LISP): Check for integer overflow.
197 (struct Lisp_Save_Value): Use ptrdiff_t, not int, for 'integer' member.
198 * alloc.c (make_save_value): Integer argument is now of type
199 ptrdiff_t, not int.
200 (mark_object): Use ptrdiff_t, not int.
201 * lisp.h (pD): New macro.
202 * print.c (print_object): Use it.
203
204 * alloc.c: Use EMACS_INT, not int, to count objects.
205 (total_conses, total_markers, total_symbols, total_vector_size)
206 (total_free_conses, total_free_markers, total_free_symbols)
207 (total_free_floats, total_floats, total_free_intervals)
208 (total_intervals, total_strings, total_free_strings):
209 Now EMACS_INT, not int. All uses changed.
210 (Fgarbage_collect): Compute overall total using a double, so that
211 integer overflow is less likely to be a problem. Check for overflow
212 when converting back to an integer.
213 (n_interval_blocks, n_string_blocks, n_float_blocks, n_cons_blocks)
214 (n_vectors, n_symbol_blocks, n_marker_blocks): Remove.
215 These were 'int' variables that could overflow on 64-bit hosts;
216 they were never used, so remove them instead of repairing them.
217 (nzombies, ngcs, max_live, max_zombies): Now EMACS_INT, not 'int'.
218 (inhibit_garbage_collection): Set gc_cons_threshold to max value.
219 Previously, this ceilinged at INT_MAX, but that doesn't work on
220 64-bit machines.
221 (allocate_pseudovector): Don't use EMACS_INT when int would do.
222
223 * alloc.c (Fmake_bool_vector): Don't assume vector size fits in int.
224 (allocate_vectorlike): Check for ptrdiff_t overflow.
225 (mark_vectorlike, mark_char_table, mark_object): Avoid EMACS_UINT
226 when a (possibly-narrower) signed value would do just as well.
227 We prefer using signed arithmetic, to avoid comparison confusion.
228
229 * alloc.c: Catch some string size overflows that we were missing.
230 (XMALLOC_OVERRUN_CHECK_SIZE) [!XMALLOC_OVERRUN_CHECK]: Define to 0,
231 for convenience in STRING_BYTES_MAX.
232 (STRING_BYTES_MAX): New macro, superseding the old one in lisp.h.
233 The definition here is exact; the one in lisp.h was approximate.
234 (allocate_string_data): Check for string overflow. This catches
235 some instances we weren't catching before. Also, it catches
236 size_t overflow on (unusual) hosts where SIZE_MAX <= min
237 (PTRDIFF_MAX, MOST_POSITIVE_FIXNUM), e.g., when size_t is 32 bits
238 and ptrdiff_t and EMACS_INT are both 64 bits.
239
240 * character.c, coding.c, doprnt.c, editfns.c, eval.c:
241 All uses of STRING_BYTES_MAX replaced by STRING_BYTES_BOUND.
242 * lisp.h (STRING_BYTES_BOUND): Renamed from STRING_BYTES_MAX.
243
244 * character.c (string_escape_byte8): Fix nbytes/nchars typo.
245
246 * alloc.c (Fmake_string): Check for out-of-range init.
247
248 2011-06-14 Jan Djärv <jan.h.d@swipnet.se>
249
250 * xfns.c (x_set_scroll_bar_default_width): Remove argument to
251 xg_get_default_scrollbar_width.
252
253 * gtkutil.c: Include emacsgtkfixed.h if HAVE_GTK3.
254 (int_gtk_range_get_value): Move to the scroll bar part of the file.
255 (style_changed_cb): Call update_theme_scrollbar_width and call
256 x_set_scroll_bar_default_width and xg_frame_set_char_size for
257 all frames (Bug#8505).
258 (xg_create_frame_widgets): Call emacs_fixed_new if HAVE_GTK3 (Bug#8505).
259 Call gtk_window_set_resizable if HAVE_GTK3.
260 (x_wm_set_size_hint): Call emacs_fixed_set_min_size with min width
261 and height if HAVE_GTK3 (Bug#8505).
262 (scroll_bar_width_for_theme): New variable.
263 (update_theme_scrollbar_width): New function.
264 (xg_get_default_scrollbar_width): Move code to
265 update_theme_scrollbar_width, just return scroll_bar_width_for_theme.
266 (xg_initialize): Call update_theme_scrollbar_width.
267
268 * gtkutil.h (xg_get_default_scrollbar_width): Remove argument.
269
270 * emacsgtkfixed.c, emacsgtkfixed.h: New files.
271
272 2011-06-12 Martin Rudalics <rudalics@gmx.at>
273
274 * frame.c (make_frame): Call other_buffer_safely instead of
275 other_buffer.
276
277 * window.c (temp_output_buffer_show): Call display_buffer with
278 second argument Vtemp_buffer_show_specifiers and reset latter
279 immediately after the call.
280 (Vtemp_buffer_show_specifiers): New variable.
281 (auto_window_vscroll_p, next_screen_context_lines)
282 (Vscroll_preserve_screen_position): Remove leading asterisks from
283 doc-strings.
284
285 2011-06-12 Paul Eggert <eggert@cs.ucla.edu>
286
287 Fix minor problems found by GCC 4.6.0 static checking.
288 * buffer.c (Qclone_number): Remove for now, as it's unused.
289 (record_buffer, Funrecord_buffer): Rename local to avoid shadowing.
290 (record_buffer): Remove unused local.
291 * frame.c (other_visible_frames, frame_buffer_list): Now static.
292 (set_frame_buffer_list): Remove; unused.
293 * frame.h (other_visible_frames): Remove decl.
294 * keyboard.h (menu_items_inuse): Declare only if USE_GTK || USE_MOTIF.
295 * lisp.h (frame_buffer_list, set_frame_buffer_list): Remove decls.
296 (add_gpm_wait_descriptor, delete_gpm_wait_descriptor): Declare only
297 if HAVE_GPM.
298 * menu.c (menu_items_inuse): Now static unless USE_GTK || USE_MOTIF.
299 * process.c (add_gpm_wait_descriptor, delete_gpm_wait_descriptor):
300 Define only if HAVE_GPM.
301 * widget.c (EmacsFrameResize, emacsFrameClassRec): Now static.
302 (update_hints_inhibit): Remove; never set. All uses removed.
303 * widgetprv.h (emacsFrameClassRec): Remove decl.
304 * window.c (delete_deletable_window): Now returns void, since it
305 wasn't returning anything.
306 (compare_window_configurations): Remove unused locals.
307 * xfns.c (x_set_scroll_bar_default_width): Remove unused locals.
308 * xmenu.c (x_menu_set_in_use): Define only if USE_GTK || USE_MOTIF.
309 (dialog_selection_callback) [!USE_GTK]: Prefer intptr_t for integers
310 the same widths as pointers. This follows up on the 2011-05-06 patch.
311 * xterm.c (x_alloc_lighter_color_for_widget): Define only if USE_LUCID.
312 * xterm.h: Likewise.
313 (x_menu_set_in_use): Declare only if USE_GTK || USE_MOTIF.
314
315 2011-06-12 Juanma Barranquero <lekktu@gmail.com>
316
317 * makefile.w32-in: Update dependencies.
318 (LISP_H): Add lib/intprops.h.
319
320 2011-06-11 Chong Yidong <cyd@stupidchicken.com>
321
322 * image.c (gif_load): Add animation frame delay to the metadata.
323 (syms_of_image): Use DEFSYM. New symbol `delay'.
324
325 2011-06-11 Martin Rudalics <rudalics@gmx.at>
326
327 * window.c (delete_deletable_window): Re-add.
328 (Fset_window_configuration): Rewrite to handle dead buffers and
329 consequently deletable windows.
330 (window_tree, Fwindow_tree): Remove. Supply functionality in
331 window.el.
332 (compare_window_configurations): Simplify code.
333
334 2011-06-11 Andreas Schwab <schwab@linux-m68k.org>
335
336 * image.c (imagemagick_load_image): Fix type mismatch.
337 (Fimagemagick_types): Likewise.
338
339 * window.h (replace_buffer_in_windows): Declare.
340
341 2011-06-11 Martin Rudalics <rudalics@gmx.at>
342
343 * buffer.c: New Lisp objects Qbuffer_list_update_hook and
344 Qclone_number. Remove external declaration of Qdelete_window.
345 (Fbuffer_list): Rewrite doc-string. Minor restructuring of
346 code.
347 (Fget_buffer_create, Fmake_indirect_buffer, Frename_buffer): Run
348 Qbuffer_list_update_hook if allowed.
349 (Fother_buffer): Rewrite doc-string. Major rewrite for new
350 buffer list implementation.
351 (other_buffer_safely): New function.
352 (Fkill_buffer): Replace call to replace_buffer_in_all_windows by
353 calls to replace_buffer_in_windows and
354 replace_buffer_in_windows_safely. Run Qbuffer_list_update_hook
355 if allowed.
356 (record_buffer): Inhibit quitting and rewrite using quittable
357 functions. Run Qbuffer_list_update_hook if allowed.
358 (Frecord_buffer, Funrecord_buffer): New functions.
359 (switch_to_buffer_1, Fswitch_to_buffer): Remove. Move
360 switch-to-buffer to window.el.
361 (bury-buffer): Move to window.el.
362 (Vbuffer_list_update_hook): New variable.
363
364 * lisp.h (other_buffer_safely): Add prototype in buffer.c
365 section.
366
367 * window.h (resize_frame_windows): Move up in code.
368 (Fwindow_frame): Remove EXFUN.
369 (replace_buffer_in_all_windows): Remove prototype.
370 (replace_buffer_in_windows_safely): Add prototype.
371
372 * window.c: Declare Qdelete_window static again. Move down
373 declaration of select_count.
374 (Fnext_window, Fprevious_window): Rewrite doc-strings.
375 (Fother_window): Move to window.el.
376 (window_loop): Remove DELETE_BUFFER_WINDOWS and UNSHOW_BUFFER
377 cases. Add REPLACE_BUFFER_IN_WINDOWS_SAFELY case.
378 (Fdelete_windows_on, Freplace_buffer_in_windows): Move to
379 window.el.
380 (replace_buffer_in_windows): Implement by calling
381 Qreplace_buffer_in_windows.
382 (replace_buffer_in_all_windows): Remove with some functionality
383 moved into replace_buffer_in_windows_safely.
384 (replace_buffer_in_windows_safely): New function.
385 (select_window_norecord, select_frame_norecord): Move in front
386 of run_window_configuration_change_hook. Remove now obsolete
387 declarations.
388 (Fset_window_buffer): Rewrite doc-string. Call
389 Qrecord_window_buffer.
390 (keys_of_window): Move binding for other-window to window.el.
391
392 2011-06-11 Chong Yidong <cyd@stupidchicken.com>
393
394 * dispextern.h (struct image): Replace data member, whose int_val
395 and ptr_val fields were not used by anything, with a single
396 lisp_val object.
397
398 * image.c (Fimage_metadata, make_image, mark_image, tiff_load)
399 (gif_clear_image, gif_load, imagemagick_load_image)
400 (gs_clear_image, gs_load): Callers changed.
401
402 2011-06-10 Paul Eggert <eggert@cs.ucla.edu>
403
404 * buffer.h: Include <time.h>, for time_t.
405 Needed to build on FreeBSD 8.2. Problem reported by Herbert J. Skuhra.
406
407 Fix minor problems found by static checking.
408
409 * image.c (PixelGetMagickColor): Declare if ImageMagick headers don't.
410
411 Make identifiers static if they are not used in other modules.
412 * data.c (Qcompiled_function, Qframe, Qvector):
413 * image.c (QimageMagick, Qsvg):
414 * minibuf.c (Qmetadata):
415 * window.c (resize_window_check, resize_root_window): Now static.
416 * window.h (resize_window_check, resize_root_window): Remove decls.
417
418 * window.c (window_deletion_count, delete_deletable_window):
419 Remove; unused.
420 (window_body_lines): Now static.
421 (Fdelete_other_windows_internal): Mark vars as initialized.
422 Make sure 'resize_failed' is initialized.
423 (run_window_configuration_change_hook): Rename local to avoid shadowing.
424 (resize_window_apply): Remove unused local.
425 * window.h (delete_deletable_window): Remove decl.
426
427 * image.c (gif_load, svg_load_image): Rename locals to avoid shadowing.
428 (imagemagick_load_image): Fix pointer signedness problem by changing
429 last arg from unsigned char * to char *. All uses changed.
430 Also, fix a local for similar reasons.
431 Remove unused locals. Remove locals to avoid shadowing.
432 (fn_rsvg_handle_free): Remove; unused.
433 (svg_load, svg_load_image): Fix pointer signedness problem.
434 (imagemagick_load_image): Don't use garbage pointer image_wand.
435
436 * ftfont.c (ftfont_get_metrics, ftfont_drive_otf): Remove unused locals.
437
438 2011-06-10 Chong Yidong <cyd@stupidchicken.com>
439
440 * image.c (gif_load): Fix omitted cast error introduced by
441 2011-06-06 change.
442
443 2011-06-10 Martin Rudalics <rudalics@gmx.at>
444
445 * window.h (resize_proportionally, orig_total_lines)
446 (orig_top_line): Remove from window structure.
447 (set_window_height, set_window_width, change_window_heights)
448 (Fdelete_window): Remove prototypes.
449 (resize_frame_windows): Remove duplicate declaration.
450
451 2011-06-10 Eli Zaretskii <eliz@gnu.org>
452
453 * window.h (resize_frame_windows, resize_window_check)
454 (delete_deletable_window, resize_root_window)
455 (resize_frame_windows): Declare prototypes.
456
457 * window.c (resize_window_apply): Make definition be "static" to
458 match the prototype.
459
460 2011-06-10 Martin Rudalics <rudalics@gmx.at>
461
462 * window.c: Remove declarations of Qwindow_size_fixed,
463 window_min_size_1, window_min_size_2, window_min_size,
464 size_window, window_fixed_size_p, enlarge_window, delete_window.
465 Remove static from declaration of Qdelete_window, it's
466 temporarily needed by Fbury_buffer.
467 (replace_window): Don't assign orig_top_line and
468 orig_total_lines.
469 (Fdelete_window, delete_window): Remove. Window deletion is
470 handled by window.el.
471 (window_loop): Remove DELETE_OTHER_WINDOWS case. Replace
472 Fdelete_window calls with calls to Qdelete_window.
473 (Fdelete_other_windows): Remove. Deleting other windows is
474 handled by window.el.
475 (window_fixed_size_p): Remove. Fixed-sizeness of windows is
476 handled in window.el.
477 (window_min_size_2, window_min_size_1, window_min_size): Remove.
478 Window minimum sizes are handled in window.el.
479 (shrink_windows, size_window, set_window_height)
480 (set_window_width, change_window_heights, window_height)
481 (window_width, CURBEG, CURSIZE, enlarge_window)
482 (adjust_window_trailing_edge, Fadjust_window_trailing_edge)
483 (Fenlarge_window, Fshrink_window): Remove. Window resizing is
484 handled in window.el.
485 (make_dummy_parent): Rename to make_parent_window and give it a
486 second argument horflag.
487 (make_window): Don't set resize_proportionally any more.
488 (Fsplit_window): Remove. Windows are split in window.el.
489 (save_restore_action, save_restore_orig_size)
490 (shrink_window_lowest_first, save_restore_orig_size): Remove.
491 Resize mini windows in window.el.
492 (grow_mini_window, shrink_mini_window): Implement by calling
493 Qresize_root_window_vertically, resize_window_check and
494 resize_window_apply.
495 (saved_window, Fset_window_configuration, save_window_save): Do
496 not handle orig_top_line, orig_total_lines, and
497 resize_proportionally.
498 (window_min_height, window_min_width): Move to window.el.
499 (keys_of_window): Move bindings for delete-other-windows,
500 split-window, delete-window and enlarge-window to window.el.
501
502 * buffer.c: Temporarily extern Qdelete_window.
503 (Fbury_buffer): Temporarily call Qdelete_window instead of
504 Fdelete_window (Fbury_buffer will move to window.el soon).
505
506 * frame.c (set_menu_bar_lines_1): Remove code handling
507 orig_top_line and orig_total_lines.
508
509 * dispnew.c (adjust_frame_glyphs_initially): Don't use
510 set_window_height but set heights directly.
511 (change_frame_size_1): Use resize_frame_windows.
512
513 * xdisp.c (init_xdisp): Don't use set_window_height but set
514 heights directly.
515
516 * xfns.c (x_set_menu_bar_lines, x_set_tool_bar_lines): Use
517 resize_frame_windows instead of change_window_heights and run
518 run_window_configuration_change_hook.
519
520 * w32fns.c (x_set_tool_bar_lines): Use resize_frame_windows
521 instead of change_window_heights and run
522 run_window_configuration_change_hook.
523
524 2011-06-09 Martin Rudalics <rudalics@gmx.at>
525
526 * window.c (replace_window): Rename second argument REPLACEMENT to
527 NEW. New third argument SETFLAG. Rewrite.
528 (delete_window, make_dummy_parent): Call replace_window with
529 third argument 1.
530 (window_list_1): Move down in code.
531 (run_window_configuration_change_hook): Move set_buffer part
532 before select_frame_norecord part in order to unwind correctly.
533 Rename count1 to count.
534 (recombine_windows, delete_deletable_window, resize_root_window)
535 (Fdelete_other_windows_internal)
536 (Frun_window_configuration_change_hook, make_parent_window)
537 (resize_window_check, resize_window_apply, Fresize_window_apply)
538 (resize_frame_windows, Fsplit_window_internal)
539 (Fdelete_window_internal, Fresize_mini_window_internal): New
540 functions.
541 (syms_of_window): New variables Vwindow_splits and Vwindow_nest.
542
543 2011-06-08 Martin Rudalics <rudalics@gmx.at>
544
545 * window.h (window): Add some new members to window structure -
546 normal_lines, normal_cols, new_total, new_normal, clone_number,
547 splits, nest, prev_buffers, next_buffers.
548 (WINDOW_TOTAL_SIZE): Move here from window.c.
549 (MIN_SAFE_WINDOW_WIDTH, MIN_SAFE_WINDOW_HEIGHT): Define here.
550
551 * window.c (Fwindow_height, Fwindow_width, Fwindow_full_width_p):
552 Remove.
553 (make_dummy_parent): Set new members of windows structure.
554 (make_window): Move down in code. Handle new members of window
555 structure.
556 (Fwindow_clone_number, Fwindow_splits, Fset_window_splits)
557 (Fwindow_nest, Fset_window_nest, Fwindow_new_total)
558 (Fwindow_normal_size, Fwindow_new_normal, Fwindow_prev_buffers)
559 (Fset_window_prev_buffers, Fwindow_next_buffers)
560 (Fset_window_next_buffers, Fset_window_clone_number): New
561 functions.
562 (Fwindow_hscroll, Fwindow_at, Fwindow_point, Fwindow_start)
563 (Fwindow_end, Fwindow_line_height, Fset_window_dedicated_p):
564 Doc-string fixes.
565 (Fwindow_parameters, Fwindow_parameter, Fset_window_parameter):
566 Argument WINDOW can be now internal window too.
567 (Fwindow_use_time): Move up in code.
568 (Fget_buffer_window): Rename argument FRAME to ALL-FRAMES.
569 Rewrite doc-string.
570 (Fset_window_configuration, saved_window)
571 (Fcurrent_window_configuration, save_window_save): Handle new
572 members of window structure.
573 (WINDOW_TOTAL_SIZE, MIN_SAFE_WINDOW_WIDTH)
574 (MIN_SAFE_WINDOW_HEIGHT): Move to window.h.
575 (syms_of_window): New Lisp objects Qrecord_window_buffer,
576 Qwindow_deletable_p, Qdelete_window, Qreplace_buffer_in_windows,
577 Qget_mru_window, Qresize_root_window,
578 Qresize_root_window_vertically, Qsafe, Qabove, Qbelow,
579 Qauto_buffer_name; staticpro them.
580
581 2011-06-07 Martin Rudalics <rudalics@gmx.at>
582
583 * window.c (Fwindow_total_size, Fwindow_left_column)
584 (Fwindow_top_line, window_body_lines, Fwindow_body_size)
585 (Fwindow_list_1): New functions.
586 (window_box_text_cols): Replace with window_body_cols.
587 (Fwindow_width, Fscroll_left, Fscroll_right): Use
588 window_body_cols instead of window_box_text_cols.
589 (delete_window, Fset_window_configuration): Call
590 delete_all_subwindows with window as argument.
591 (delete_all_subwindows): Take a window as argument and not a
592 structure. Rewrite.
593 (window_loop): Remove handling of GET_LRU_WINDOW and
594 GET_LARGEST_WINDOW.
595 (Fget_lru_window, Fget_largest_window): Move to window.el.
596
597 * window.h: Extern window_body_cols instead of
598 window_box_text_cols. delete_all_subwindows now takes a
599 Lisp_Object as argument.
600
601 * indent.c (compute_motion, Fcompute_motion): Use
602 window_body_cols instead of window_box_text_cols.
603
604 * frame.c (delete_frame): Call delete_all_subwindows with root
605 window as argument.
606
607 2011-06-07 Daniel Colascione <dan.colascione@gmail.com>
608
609 * fns.c (Fputhash): Document return value.
610
611 2011-06-06 Chong Yidong <cyd@stupidchicken.com>
612
613 * image.c (gif_load): Implement gif89a spec "no disposal" method.
614
615 2011-06-06 Paul Eggert <eggert@cs.ucla.edu>
616
617 Cons<->int and similar integer overflow fixes (Bug#8794).
618
619 Check for overflow when converting integer to cons and back.
620 * charset.c (Fdefine_charset_internal, Fdecode_char):
621 Use cons_to_unsigned to catch overflow.
622 (Fencode_char): Use INTEGER_TO_CONS.
623 * composite.h (LGLYPH_CODE): Use cons_to_unsigned.
624 (LGLYPH_SET_CODE): Use INTEGER_TO_CONS.
625 * data.c (long_to_cons, cons_to_long): Remove.
626 (cons_to_unsigned, cons_to_signed): New functions.
627 These signal an error for invalid or out-of-range values.
628 * dired.c (Ffile_attributes): Use INTEGER_TO_CONS.
629 * fileio.c (Fset_visited_file_modtime): Use CONS_TO_INTEGER.
630 * font.c (Ffont_variation_glyphs):
631 * fontset.c (Finternal_char_font): Use INTEGER_TO_CONS.
632 * lisp.h: Include <intprops.h>.
633 (INTEGER_TO_CONS, CONS_TO_INTEGER): New macros.
634 (cons_to_signed, cons_to_unsigned): New decls.
635 (long_to_cons, cons_to_long): Remove decls.
636 * undo.c (record_first_change): Use INTEGER_TO_CONS.
637 (Fprimitive_undo): Use CONS_TO_INTEGER.
638 * xfns.c (Fx_window_property): Likewise.
639 * xselect.c: Include <limits.h>.
640 (x_own_selection, selection_data_to_lisp_data):
641 Use INTEGER_TO_CONS.
642 (x_handle_selection_request, x_handle_selection_clear)
643 (x_get_foreign_selection, Fx_disown_selection_internal)
644 (Fx_get_atom_name, x_send_client_event): Use CONS_TO_INTEGER.
645 (lisp_data_to_selection_data): Use cons_to_unsigned.
646 (x_fill_property_data): Use cons_to_signed.
647 Report values out of range.
648
649 Check for buffer and string overflow more precisely.
650 * buffer.h (BUF_BYTES_MAX): New macro.
651 * lisp.h (STRING_BYTES_MAX): New macro.
652 * alloc.c (Fmake_string):
653 * character.c (string_escape_byte8):
654 * coding.c (coding_alloc_by_realloc):
655 * doprnt.c (doprnt):
656 * editfns.c (Fformat):
657 * eval.c (verror):
658 Use STRING_BYTES_MAX, not MOST_POSITIVE_FIXNUM,
659 since they may not be the same number.
660 * editfns.c (Finsert_char):
661 * fileio.c (Finsert_file_contents):
662 Likewise for BUF_BYTES_MAX.
663
664 * image.c: Use ptrdiff_t, not int, for sizes.
665 (slurp_file): Switch from int to ptrdiff_t.
666 All uses changed.
667 (slurp_file): Check that file size fits in both size_t (for
668 malloc) and ptrdiff_t (for sanity and safety).
669
670 * fileio.c (Fverify_visited_file_modtime): Avoid time overflow
671 if b->modtime has its maximal value.
672
673 * dired.c (Ffile_attributes): Don't assume EMACS_INT has >32 bits.
674
675 Don't assume time_t can fit into int.
676 * buffer.h (struct buffer.modtime): Now time_t, not int.
677 * fileio.c (Fvisited_file_modtime): No need for time_t cast now.
678 * undo.c (Fprimitive_undo): Use time_t, not int, for time_t value.
679
680 Minor fixes for signed vs unsigned integers.
681 * character.h (MAYBE_UNIFY_CHAR):
682 * charset.c (maybe_unify_char):
683 * keyboard.c (read_char, reorder_modifiers):
684 XINT -> XFASTINT, since the integer must be nonnegative.
685 * ftfont.c (ftfont_spec_pattern):
686 * keymap.c (access_keymap, silly_event_symbol_error):
687 XUINT -> XFASTINT, since the integer must be nonnegative.
688 (Fsingle_key_description, preferred_sequence_p): XUINT -> XINT,
689 since it makes no difference and we prefer signed.
690 * keyboard.c (record_char): Use XUINT when all the neighbors do.
691 (access_keymap): NATNUMP -> INTEGERP, since the integer must be
692 nonnegative.
693
694 2011-06-06 Stefan Monnier <monnier@iro.umontreal.ca>
695
696 * window.h (Fwindow_frame): Declare.
697
698 2011-06-06 Paul Eggert <eggert@cs.ucla.edu>
699
700 * alloc.c: Simplify handling of large-request failures (Bug#8800).
701 (SPARE_MEMORY): Always define.
702 (LARGE_REQUEST): Remove.
703 (memory_full): Use SPARE_MEMORY rather than LARGE_REQUEST.
704
705 2011-06-06 Martin Rudalics <rudalics@gmx.at>
706
707 * lisp.h: Move EXFUNS for Fframe_root_window,
708 Fframe_first_window and Fset_frame_selected_window to window.h.
709
710 * window.h: Move EXFUNS for Fframe_root_window,
711 Fframe_first_window and Fset_frame_selected_window here from
712 lisp.h.
713
714 * frame.c (Fwindow_frame, Fframe_first_window)
715 (Fframe_root_window, Fframe_selected_window)
716 (Fset_frame_selected_window): Move to window.c.
717 (Factive_minibuffer_window): Move to minibuf.c.
718 (Fother_visible_frames_p): New function.
719
720 * minibuf.c (Factive_minibuffer_window): Move here from frame.c.
721
722 * window.c (decode_window, decode_any_window): Move up in code.
723 (Fwindowp, Fwindow_live_p): Rewrite doc-strings.
724 (inhibit_frame_unsplittable): Remove unused variable.
725 (Fwindow_buffer): Move up and rewrite doc-string.
726 (Fwindow_parent, Fwindow_vchild, Fwindow_hchild, Fwindow_next)
727 (Fwindow_prev): New functions.
728 (Fwindow_frame): Move here from frame.c. Accept any window as
729 argument.
730 (Fframe_root_window, Fframe_first_window)
731 (Fframe_selected_window): Move here from frame.c. Accept frame
732 or arbitrary window as argument. Update doc-strings.
733 (Fminibuffer_window): Move up in code.
734 (Fwindow_minibuffer_p): Move up in code and simplify.
735 (Fset_frame_selected_window): Move here from frame.c.
736 Marginal rewrite.
737 (Fselected_window, select_window, Fselect_window): Move up in
738 code. Minor doc-string fixes.
739
740 2011-06-06 Paul Eggert <eggert@cs.ucla.edu>
741
742 * alloc.c (memory_full) [SYSTEM_MALLOC]: Port to MacOS (Bug#8800).
743 Do not assume that spare memory exists; that assumption is valid
744 only if SYSTEM_MALLOC.
745 (LARGE_REQUEST): New macro, so that the issue of large requests
746 is separated from the issue of spare memory.
747
748 2011-06-05 Andreas Schwab <schwab@linux-m68k.org>
749
750 * editfns.c (Fformat): Correctly handle zero flag with hexadecimal
751 format. (Bug#8806)
752
753 * gtkutil.c (xg_get_default_scrollbar_width): Avoid warning.
754
755 * xfns.c (x_set_scroll_bar_default_width): Move declarations
756 before statements.
757
758 2011-06-05 Jan Djärv <jan.h.d@swipnet.se>
759
760 * gtkutil.c (xg_get_default_scrollbar_width): New function.
761
762 * gtkutil.h: Declare xg_get_default_scrollbar_width.
763
764 * xfns.c (x_set_scroll_bar_default_width): If USE_GTK, get
765 min width by calling x_set_scroll_bar_default_width (Bug#8505).
766
767 2011-06-05 Juanma Barranquero <lekktu@gmail.com>
768
769 * xdisp.c (single_display_spec_intangible_p): Remove declaration.
770
771 2011-06-04 Chong Yidong <cyd@stupidchicken.com>
772
773 * xselect.c (x_clipboard_manager_save): Remove redundant arg.
774 (x_clipboard_manager_save): Add return value.
775 (x_clipboard_manager_error_1, x_clipboard_manager_error_2):
776 New error handlers.
777 (x_clipboard_manager_save_frame, x_clipboard_manager_save_all):
778 Obey Vx_select_enable_clipboard_manager. Catch errors in
779 x_clipboard_manager_save (Bug#8779).
780 (Vx_select_enable_clipboard_manager): New variable.
781 (x_get_foreign_selection): Reduce scope of x_catch_errors (Bug#8790).
782
783 2011-06-04 Dan Nicolaescu <dann@ics.uci.edu>
784
785 * emacs.c (main): Warn when starting a GTK emacs in daemon mode.
786
787 2011-06-04 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
788
789 * fringe.c (update_window_fringes): Don't update overlay arrow bitmap
790 in the current matrix if keep_current_p is non-zero.
791
792 2011-06-04 Eli Zaretskii <eliz@gnu.org>
793
794 * bidi.c (bidi_level_of_next_char): Fix last change.
795
796 2011-06-03 Eli Zaretskii <eliz@gnu.org>
797
798 Support bidi reordering of text covered by display properties.
799
800 * bidi.c (bidi_copy_it): Use offsetof instead of emulating it.
801 (bidi_fetch_char, bidi_fetch_char_advance): New functions.
802 (bidi_cache_search, bidi_cache_iterator_state)
803 (bidi_paragraph_init, bidi_resolve_explicit, bidi_resolve_weak)
804 (bidi_level_of_next_char, bidi_move_to_visually_next):
805 Support character positions inside a run of characters covered by a
806 display string.
807 (bidi_paragraph_init, bidi_resolve_explicit_1)
808 (bidi_level_of_next_char): Call bidi_fetch_char and
809 bidi_fetch_char_advance instead of FETCH_CHAR and
810 FETCH_CHAR_ADVANCE.
811 (bidi_init_it): Initialize new members.
812 (LRE_CHAR, RLE_CHAR, PDF_CHAR, LRO_CHAR, RLO_CHAR): Remove macro
813 definitions.
814 (bidi_explicit_dir_char): Lookup character type in bidi_type_table,
815 instead of using explicit *_CHAR codes.
816 (bidi_resolve_explicit, bidi_resolve_weak):
817 Use FETCH_MULTIBYTE_CHAR instead of FETCH_CHAR, as reordering of
818 bidirectional text is supported only in multibyte buffers.
819 (bidi_init_it): Accept additional argument FRAME_WINDOW_P and use
820 it to initialize the frame_window_p member of struct bidi_it.
821 (bidi_cache_iterator_state, bidi_resolve_explicit_1)
822 (bidi_resolve_explicit, bidi_resolve_weak)
823 (bidi_level_of_next_char, bidi_move_to_visually_next): Abort if
824 bidi_it->nchars is non-positive.
825 (bidi_level_of_next_char): Don't try to lookup the cache for the
826 next/previous character if nothing is cached there yet, or if we
827 were just reseat()'ed to a new position.
828
829 * xdisp.c (set_cursor_from_row): Set start and stop points
830 according to the row's direction when priming the loop that looks
831 for the glyph on which to display cursor.
832 (single_display_spec_intangible_p): Function deleted.
833 (display_prop_intangible_p): Reimplement to call
834 handle_display_spec instead of single_display_spec_intangible_p.
835 Accept 3 additional arguments needed by handle_display_spec.
836 This fixes incorrect cursor motion across display property with complex
837 values: lists, `(when COND...)' forms, etc.
838 (single_display_spec_string_p): Support property values that are
839 lists with the argument STRING its top-level element.
840 (display_prop_string_p): Fix the condition for processing a
841 property that is a list to be consistent with handle_display_spec.
842 (handle_display_spec): New function, refactored from the
843 last portion of handle_display_prop.
844 (compute_display_string_pos): Accept additional argument
845 FRAME_WINDOW_P. Call handle_display_spec to determine whether the
846 value of a `display' property is a "replacing spec".
847 (handle_single_display_spec): Accept 2 additional arguments BUFPOS
848 and FRAME_WINDOW_P. If IT is NULL, don't set up the iterator from
849 the display property, but just return a value indicating whether
850 the display property will replace the characters it covers.
851 (Fcurrent_bidi_paragraph_direction): Initialize the nchars and
852 frame_window_p members of struct bidi_it.
853 (compute_display_string_pos, compute_display_string_end):
854 New functions.
855 (push_it): Accept second argument POSITION, where pop_it should
856 jump to continue iteration.
857 (reseat_1): Initialize bidi_it.disp_pos.
858
859 * keyboard.c (adjust_point_for_property): Adjust the call to
860 display_prop_intangible_p to its new signature.
861
862 * dispextern.h (struct bidi_it): New member frame_window_p.
863 (bidi_init_it): Update prototypes.
864 (display_prop_intangible_p): Update prototype.
865 (compute_display_string_pos, compute_display_string_end):
866 Declare prototypes.
867 (struct bidi_it): New members nchars and disp_pos. ch_len is now
868 EMACS_INT.
869
870 2011-06-02 Paul Eggert <eggert@cs.ucla.edu>
871
872 Malloc failure behavior now depends on size of allocation.
873 * alloc.c (buffer_memory_full, memory_full): New arg NBYTES.
874 * lisp.h: Change signatures accordingly.
875 * alloc.c, buffer.c, editfns.c, menu.c, minibuf.c, xterm.c:
876 All callers changed. (Bug#8762)
877
878 * gnutls.c: Use Emacs's memory allocators.
879 Without this change, the gnutls library would invoke malloc etc.
880 directly, which causes problems on non-SYNC_INPUT hosts, and which
881 runs afoul of improving memory_full behavior. (Bug#8761)
882 (fn_gnutls_global_set_mem_functions): New macro or function pointer.
883 (emacs_gnutls_global_init): Use it to specify xmalloc, xrealloc,
884 xfree instead of the default malloc, realloc, free.
885 (Fgnutls_boot): No need to check for memory allocation failure,
886 since xmalloc does that for us.
887
888 Remove arbitrary limit of 2**31 entries in hash tables. (Bug#8771)
889 * category.c (hash_get_category_set):
890 * ccl.c (ccl_driver):
891 * charset.c (Fdefine_charset_internal):
892 * charset.h (struct charset.hash_index):
893 * composite.c (get_composition_id, gstring_lookup_cache)
894 (composition_gstring_put_cache):
895 * composite.h (struct composition.hash_index):
896 * dispextern.h (struct image.hash):
897 * fns.c (next_almost_prime, larger_vector, cmpfn_eql)
898 (cmpfn_equal, cmpfn_user_defined, hashfn_eq, hashfn_eql)
899 (hashfn_equal, hashfn_user_defined, make_hash_table)
900 (maybe_resize_hash_table, hash_lookup, hash_put)
901 (hash_remove_from_table, hash_clear, sweep_weak_table, SXHASH_COMBINE)
902 (sxhash_string, sxhash_list, sxhash_vector, sxhash_bool_vector)
903 (Fsxhash, Fgethash, Fputhash, Fmaphash):
904 * image.c (make_image, search_image_cache, lookup_image)
905 (xpm_put_color_table_h):
906 * lisp.h (struct Lisp_Hash_Table):
907 * minibuf.c (Ftry_completion, Fall_completions, Ftest_completion):
908 * print.c (print): Use 'EMACS_UINT' and 'EMACS_INT'
909 for hashes and hash indexes, instead of 'unsigned' and 'int'.
910 * alloc.c (allocate_vectorlike):
911 Check for overflow in vector size calculations.
912 * ccl.c (ccl_driver):
913 Check for overflow when converting EMACS_INT to int.
914 * fns.c, image.c: Remove unnecessary static decls that would otherwise
915 need to be updated by these changes.
916 * fns.c (make_hash_table, maybe_resize_hash_table):
917 Check for integer overflow with large hash tables.
918 (make_hash_table, maybe_resize_hash_table, Fmake_hash_table):
919 Prefer the faster XFLOAT_DATA to XFLOATINT where either will do.
920 (SXHASH_REDUCE): New macro.
921 (sxhash_string, sxhash_list, sxhash_vector, sxhash_bool_vector):
922 Use it instead of discarding useful hash info with large hash values.
923 (sxhash_float): New function.
924 (sxhash): Use it. No more need for "& INTMASK" due to above changes.
925 * lisp.h (FIXNUM_BITS): New macro, useful for SXHASH_REDUCE etc.
926 (MOST_NEGATIVE_FIXNUM, MOST_POSITIVE_FIXNUM, INTMASK):
927 Rewrite to use FIXNUM_BITS, as this simplifies things.
928 (next_almost_prime, larger_vector, sxhash, hash_lookup, hash_put):
929 Adjust signatures to match updated version of code.
930 (consing_since_gc): Now EMACS_INT, since a single hash table can
931 use more than INT_MAX bytes.
932
933 2011-06-01 Dan Nicolaescu <dann@ics.uci.edu>
934
935 Make it possible to build with GCC-4.6+ -O2 -flto.
936
937 * emacs.c (__malloc_initialize_hook): Mark as EXTERNALLY_VISIBLE.
938
939 2011-06-01 Stefan Monnier <monnier@iro.umontreal.ca>
940
941 * minibuf.c (get_minibuffer, read_minibuf_unwind):
942 Call minibuffer-inactive-mode.
943
944 2011-05-31 Juanma Barranquero <lekktu@gmail.com>
945
946 * makefile.w32-in ($(BLD)/data.$(O), $(BLD)/editfns.$(O)):
947 Update dependencies.
948
949 2011-05-31 Dan Nicolaescu <dann@ics.uci.edu>
950
951 * data.c (init_data): Remove code for UTS, this system is not
952 supported anymore.
953
954 2011-05-31 Dan Nicolaescu <dann@ics.uci.edu>
955
956 Don't force ./temacs to start in terminal mode.
957
958 * frame.c (make_initial_frame): Initialize faces in all cases, not
959 only when CANNOT_DUMP is defined.
960 * dispnew.c (init_display): Remove CANNOT_DUMP condition.
961
962 2011-05-31 Dan Nicolaescu <dann@ics.uci.edu>
963
964 * dispnew.c (add_window_display_history): Use const for the string
965 pointer. Remove declaration, not needed.
966
967 2011-05-31 Paul Eggert <eggert@cs.ucla.edu>
968
969 Use 'inline', not 'INLINE'.
970 <http://lists.gnu.org/archive/html/emacs-devel/2011-05/msg00914.html>
971 * alloc.c, fontset.c (INLINE): Remove.
972 * alloc.c, bidi.c, charset.c, coding.c, dispnew.c, fns.c, image.c:
973 * intervals.c, keyboard.c, process.c, syntax.c, textprop.c, w32term.c:
974 * xdisp.c, xfaces.c, xterm.c: Replace all uses of INLINE with inline.
975 * gmalloc.c (register_heapinfo): Use inline unconditionally.
976 * lisp.h (LISP_MAKE_RVALUE): Use inline, not __inline__.
977
978 2011-05-31 Dan Nicolaescu <dann@ics.uci.edu>
979
980 Make it possible to run ./temacs.
981
982 * callproc.c (set_initial_environment): Remove CANNOT_DUMP code,
983 syms_of_callproc does the same thing. Remove test for
984 "initialized", do it in the caller.
985 * emacs.c (main): Avoid calling set_initial_environment when dumping.
986
987 2011-05-31 Stefan Monnier <monnier@iro.umontreal.ca>
988
989 * minibuf.c (Finternal_complete_buffer): Return `category' metadata.
990 (read_minibuf): Use get_minibuffer.
991 (syms_of_minibuf): Use DEFSYM.
992 (Qmetadata): New var.
993 * data.c (Qbuffer): Don't make it static.
994 (syms_of_data): Use DEFSYM.
995
996 2011-05-31 Paul Eggert <eggert@cs.ucla.edu>
997
998 * ccl.c (CCL_CODE_RANGE): Allow negative numbers. (Bug#8751)
999 (CCL_CODE_MIN): New macro.
1000
1001 2011-05-30 Paul Eggert <eggert@cs.ucla.edu>
1002
1003 * alloc.c (lisp_align_malloc): Omit unnecessary val==NULL tests.
1004
1005 * eval.c (Qdebug): Now static.
1006 * lisp.h (Qdebug): Remove decl. This reverts a part of the
1007 2011-04-26T11:26:05Z!dan.colascione@gmail.com that inadvertently undid part of
1008 2011-04-14T06:48:41Z!eggert@cs.ucla.edu.
1009
1010 2011-05-29 Chong Yidong <cyd@stupidchicken.com>
1011
1012 * image.c: Various fixes to ImageMagick code comments.
1013 (Fimagemagick_types): Doc fix.
1014
1015 2011-05-29 Paul Eggert <eggert@cs.ucla.edu>
1016
1017 Minor fixes prompted by GCC 4.6.0 warnings.
1018
1019 * xselect.c (converted_selections, conversion_fail_tag): Now static.
1020
1021 * emacs.c [HAVE_X_WINDOWS]: Include "xterm.h".
1022 (x_clipboard_manager_save_all): Move extern decl to ...
1023 * xterm.h: ... here, so that it can be checked for consistency.
1024
1025 2011-05-29 Chong Yidong <cyd@stupidchicken.com>
1026
1027 * xselect.c (x_clipboard_manager_save_frame)
1028 (x_clipboard_manager_save_all): New functions.
1029 (Fx_clipboard_manager_save): Lisp function deleted.
1030
1031 * emacs.c (Fkill_emacs): Call x_clipboard_manager_save_all.
1032 * frame.c (delete_frame): Call x_clipboard_manager_save_frame.
1033
1034 * xterm.h: Update prototype.
1035
1036 2011-05-28 William Xu <william.xwl@gmail.com>
1037
1038 * nsterm.m (ns_term_shutdown): Synchronize user defaults before
1039 exiting (Bug#8239).
1040
1041 2011-05-28 Jim Meyering <meyering@redhat.com>
1042
1043 Avoid a sign-extension bug in crypto_hash_function.
1044 * fns.c (to_uchar): Define.
1045 (crypto_hash_function): Use it to convert some newly-signed
1046 variables to unsigned, to avoid sign-extension bugs. For example,
1047 without this change, (md5 "truc") would evaluate to
1048 45723a2aff78ff4fff7fff1114760e62 rather than the expected
1049 45723a2af3788c4ff17f8d1114760e62. Reported by Antoine Levitt in
1050 https://lists.gnu.org/archive/html/emacs-devel/2011-05/msg00883.html.
1051
1052 2011-05-27 Paul Eggert <eggert@cs.ucla.edu>
1053
1054 Integer overflow fixes.
1055
1056 * dbusbind.c: Serial number integer overflow fixes.
1057 (CHECK_DBUS_SERIAL_GET_SERIAL): New macro.
1058 (Fdbus_call_method_asynchronously, xd_read_message_1): Use a float
1059 to hold a serial number that is too large for a fixnum.
1060 (Fdbus_method_return_internal, Fdbus_method_error_internal):
1061 Check for serial numbers out of range. Decode any serial number
1062 that was so large that it became a float. (Bug#8722)
1063
1064 * dbusbind.c: Use XFASTINT rather than XUINT, and check for nonneg.
1065 (Fdbus_call_method, Fdbus_call_method_asynchronously):
1066 Use XFASTINT rather than XUINT when numbers are nonnegative.
1067 (xd_append_arg, Fdbus_method_return_internal):
1068 (Fdbus_method_error_internal): Likewise. Also, for unsigned
1069 arguments, check that Lisp number is nonnegative, rather than
1070 silently wrapping negative numbers around. (Bug#8722)
1071 (xd_read_message_1): Don't assume dbus_uint32_t can fit in int.
1072 (Bug#8722)
1073
1074 * data.c (arith_driver, Flsh): Avoid unnecessary casts to EMACS_UINT.
1075
1076 * ccl.c (ccl_driver): Redo slightly to avoid the need for 'unsigned'.
1077
1078 ccl: add integer overflow checks
1079 * ccl.c (CCL_CODE_MAX, GET_CCL_RANGE, GET_CCL_CODE, GET_CCL_INT):
1080 (IN_INT_RANGE): New macros.
1081 (ccl_driver): Use them to check for integer overflow when
1082 decoding a CCL program. Many of the new checks are whether XINT (x)
1083 fits in int; it doesn't always, on 64-bit hosts. The new version
1084 doesn't catch all possible integer overflows, but it's an
1085 improvement. (Bug#8719)
1086
1087 * alloc.c (make_event_array): Use XINT, not XUINT.
1088 There's no need for unsigned here.
1089
1090 * mem-limits.h (EXCEEDS_LISP_PTR) [!USE_LSB_TAG]: EMACS_UINT -> uintptr_t
1091 This follows up to the 2011-05-06 change that substituted uintptr_t
1092 for EMACS_INT. This case wasn't caught back then.
1093
1094 Rework Fformat to avoid integer overflow issues.
1095 * editfns.c: Include <float.h> unconditionally, as it's everywhere
1096 now (part of C89). Include <verify.h>.
1097 (MAX_10_EXP, CONVERTED_BYTE_SIZE): Remove; no longer needed.
1098 (pWIDE, pWIDElen, signed_wide, unsigned_wide): New defns.
1099 (Fformat): Avoid the prepass trying to compute sizes; it was only
1100 approximate and thus did not catch overflow reliably. Instead, walk
1101 through the format just once, formatting and computing sizes as we go,
1102 checking for integer overflow at every step, and allocating a larger
1103 buffer as needed. Keep track separately whether the format is
1104 multibyte. Keep only the most-recently calculated precision, rather
1105 than them all. Record whether each argument has been converted to
1106 string. Use EMACS_INT, not int, for byte and char and arg counts.
1107 Support field widths and precisions larger than INT_MAX. Avoid
1108 sprintf's undefined behavior with conversion specifications such as %#d
1109 and %.0c. Fix bug with strchr succeeding on '\0' when looking for
1110 flags. Fix bug with (format "%c" 256.0). Avoid integer overflow when
1111 formatting out-of-range floating point numbers with int
1112 formats. (Bug#8668)
1113
1114 * lisp.h (FIXNUM_OVERFLOW_P): Work even if arg is a NaN.
1115
1116 * data.c: Avoid integer truncation in expressions involving floats.
1117 * data.c: Include <intprops.h>.
1118 (arith_driver): When there's an integer overflow in an expression
1119 involving floating point, convert the integers to floating point
1120 so that the resulting value does not suffer from catastrophic
1121 integer truncation. For example, on a 64-bit host (* 4
1122 most-negative-fixnum 0.5) should yield about -4.6e+18, not zero.
1123 Do not rely on undefined behavior after integer overflow.
1124
1125 merge count_size_as_multibyte, parse_str_to_multibyte
1126 * character.c, character.h (count_size_as_multibyte):
1127 Rename from parse_str_to_multibyte; all uses changed.
1128 Check for integer overflow.
1129 * insdel.c, lisp.h (count_size_as_multibyte): Remove,
1130 since it's now a duplicate of the other. This is more of
1131 a character than a buffer op, so better that it's in character.c.
1132 * fns.c, print.c: Adjust to above changes.
1133
1134 2011-05-27 Stefan Monnier <monnier@iro.umontreal.ca>
1135
1136 * xselect.c (x_convert_selection): Yet another int/Lisp_Object mixup.
1137
1138 2011-05-27 Paul Eggert <eggert@cs.ucla.edu>
1139
1140 * xselect.c: Fix minor problems prompted by GCC 4.6.0 warnings.
1141 (x_handle_selection_request, frame_for_x_selection): Remove unused vars.
1142 (x_clipboard_manager_save): Now static.
1143 (Fx_clipboard_manager_save): Rename local to avoid shadowing.
1144
1145 * fns.c: Fix minor problems prompted by GCC 4.6.0 warnings.
1146 (crypto_hash_function): Now static.
1147 Fix pointer signedness problems. Avoid unnecessary initializations.
1148
1149 2011-05-27 Chong Yidong <cyd@stupidchicken.com>
1150
1151 * termhooks.h (Vselection_alist): Make it terminal-local.
1152
1153 * terminal.c (create_terminal): Initialize it.
1154
1155 * xselect.c: Support for clipboard managers.
1156 (Vselection_alist): Move to termhooks.h as terminal-local var.
1157 (LOCAL_SELECTION): New macro.
1158 (x_atom_to_symbol): Handle x_display_info_for_display fail case.
1159 (symbol_to_x_atom): Remove gratuitous arg.
1160 (x_handle_selection_request, lisp_data_to_selection_data)
1161 (x_get_foreign_selection, Fx_register_dnd_atom): Callers changed.
1162 (x_own_selection, x_get_local_selection, x_convert_selection):
1163 New arg, specifying work frame. Use terminal-local Vselection_alist.
1164 (some_frame_on_display): Delete unused function.
1165 (Fx_own_selection_internal, Fx_get_selection_internal)
1166 (Fx_disown_selection_internal, Fx_selection_owner_p)
1167 (Fx_selection_exists_p): New optional frame arg.
1168 (frame_for_x_selection, Fx_clipboard_manager_save): New functions.
1169 (x_handle_selection_clear): Don't treat other terminals with the
1170 same keyboard specially. Use the terminal-local Vselection_alist.
1171 (x_clear_frame_selections): Use Frun_hook_with_args.
1172
1173 * xterm.c (x_term_init): Intern ATOM and CLIPBOARD_MANAGER atoms.
1174
1175 * xterm.h: Add support for those atoms.
1176
1177 2011-05-26 Chong Yidong <cyd@stupidchicken.com>
1178
1179 * xselect.c: ICCCM-compliant handling of MULTIPLE targets.
1180 (converted_selections, conversion_fail_tag): New global variables.
1181 (x_selection_request_lisp_error): Free the above.
1182 (x_get_local_selection): Remove unnecessary code.
1183 (x_reply_selection_request): Args changed; handle arbitrary array
1184 of converted selections stored in converted_selections.
1185 Separate the XChangeProperty and SelectionNotify steps.
1186 (x_handle_selection_request): Rewrite to handle MULTIPLE target.
1187 (x_convert_selection): New function.
1188 (x_handle_selection_event): Simplify.
1189 (x_get_foreign_selection): Don't ignore incoming requests while
1190 waiting for an answer; this will fail when we implement
1191 SAVE_TARGETS, and seems unnecessary anyway.
1192 (selection_data_to_lisp_data): Recognize ATOM_PAIR type.
1193 (Vx_sent_selection_functions): Doc fix.
1194
1195 2011-05-26 Leo Liu <sdl.web@gmail.com>
1196
1197 * editfns.c (Ftranspose_regions): Allow empty regions. (Bug#8699)
1198
1199 2011-05-25 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
1200
1201 * dispextern.h (struct glyph_row): New member fringe_bitmap_periodic_p.
1202
1203 * dispnew.c (shift_glyph_matrix, scrolling_window): Mark scrolled row
1204 for fringe update if it has periodic bitmap.
1205 (row_equal_p): Also compare left_fringe_offset, right_fringe_offset,
1206 and fringe_bitmap_periodic_p.
1207
1208 * fringe.c (get_fringe_bitmap_data): New function.
1209 (draw_fringe_bitmap_1, update_window_fringes): Use it.
1210 (update_window_fringes): Record periodicity of fringe bitmap in glyph
1211 row. Mark glyph row for fringe update if periodicity changed.
1212
1213 * xdisp.c (try_window_reusing_current_matrix): Don't mark scrolled row
1214 for fringe update unless it has periodic bitmap.
1215
1216 2011-05-25 Kenichi Handa <handa@m17n.org>
1217
1218 * xdisp.c (get_next_display_element): Set correct it->face_id for
1219 a static composition.
1220
1221 2011-05-24 Leo Liu <sdl.web@gmail.com>
1222
1223 * deps.mk (fns.o):
1224 * makefile.w32-in ($(BLD)/fns.$(O)): Include sha1.h.
1225
1226 * fns.c (crypto_hash_function, Fsha1): New function.
1227 (Fmd5): Use crypto_hash_function.
1228 (syms_of_fns): Add Ssha1.
1229
1230 2011-05-22 Paul Eggert <eggert@cs.ucla.edu>
1231
1232 * gnutls.c: Remove unused macros.
1233 (fn_gnutls_transport_set_lowat, fn_gnutls_transport_set_pull_function):
1234 (fn_gnutls_transport_set_push_function) [!WINDOWSNT]:
1235 Remove macros that are defined and never used.
1236 Caught by gcc -Wunused-macros (GCC 4.6.0, Fedora 14).
1237
1238 2011-05-22 Chong Yidong <cyd@stupidchicken.com>
1239
1240 * xselect.c (syms_of_xselect): Remove unused symbol SAVE_TARGETS.
1241 (Fx_get_selection_internal): Minor cleanup.
1242 (Fx_own_selection_internal): Rename arguments for consistency with
1243 select.el.
1244
1245 2011-05-22 Paul Eggert <eggert@cs.ucla.edu>
1246
1247 * xselect.c (QSAVE_TARGETS): New static var, to fix build failure.
1248
1249 2011-05-22 Chong Yidong <cyd@stupidchicken.com>
1250
1251 * xselect.c (syms_of_xselect): Include character.h; use DEFSYM.
1252
1253 2011-05-21 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
1254
1255 * dispnew.c (scrolling_window): Don't exclude the case that the
1256 last enabled row in the desired matrix touches the bottom boundary.
1257
1258 2011-05-21 Glenn Morris <rgm@gnu.org>
1259
1260 * Makefile.in ($(etc)/DOC): Make second command line even shorter.
1261 (SOME_MACHINE_OBJECTS): Replace FONT_OBJ by its maximal expansion,
1262 and add some more files.
1263
1264 2011-05-20 Eli Zaretskii <eliz@gnu.org>
1265
1266 * callproc.c (Fcall_process) [MSDOS]: Fix arguments to
1267 report_file_error introduced by the change from 2011-05-07.
1268
1269 2011-05-20 Paul Eggert <eggert@cs.ucla.edu>
1270
1271 * systime.h (Time): Define only if emacs is defined.
1272 This is to allow ../lib-src/profile.c to be compiled on FreeBSD,
1273 where the include path doesn't have X11/X.h by default. See
1274 <http://lists.gnu.org/archive/html/emacs-devel/2011-05/msg00561.html>.
1275
1276 2011-05-20 Kenichi Handa <handa@m17n.org>
1277
1278 * composite.c (find_automatic_composition): Fix previous change.
1279
1280 2011-05-20 Glenn Morris <rgm@gnu.org>
1281
1282 * lisp.mk: New file, split from Makefile.in.
1283 * Makefile.in (lisp): Move to separate file, inserted by @lisp_frag@.
1284 (shortlisp): Remove.
1285 ($(etc)/DOC): Edit lisp.mk rather than using $shortlisp.
1286
1287 2011-05-19 Glenn Morris <rgm@gnu.org>
1288
1289 * Makefile.in (MSDOS_SUPPORT_REAL, MSDOS_SUPPORT, NS_SUPPORT)
1290 (REAL_MOUSE_SUPPORT, GPM_MOUSE_SUPPORT, MOUSE_SUPPORT, TOOLTIP_SUPPORT)
1291 (BASE_WINDOW_SUPPORT, X_WINDOW_SUPPORT, WINDOW_SUPPORT): Remove.
1292 (lisp): Set the order to that of loadup.el.
1293 (shortlisp): Make it a copy of $lisp.
1294 (SOME_MACHINE_LISP): Remove.
1295 ($(etc)/DOC): Depend just on $lisp, not $SOME_MACHINE_LISP too.
1296 Use just $shortlisp, not $SOME_MACHINE_LISP too.
1297
1298 2011-05-18 Kenichi Handa <handa@m17n.org>
1299
1300 * composite.c (CHAR_COMPOSABLE_P): Add more check for efficiency.
1301 (BACKWARD_CHAR): Wrap the arg STOP by parenthesis.
1302 (find_automatic_composition): Mostly rewrite for efficiency.
1303
1304 2011-05-18 Juanma Barranquero <lekktu@gmail.com>
1305
1306 * makefile.w32-in: Update dependencies.
1307
1308 2011-05-18 Christoph Scholtes <cschol2112@googlemail.com>
1309
1310 * menu.c: Include limits.h (fixes the MS-Windows build broken by
1311 revision 104625).
1312
1313 2011-05-18 Paul Eggert <eggert@cs.ucla.edu>
1314
1315 Fix some integer overflow issues, such as string length overflow.
1316
1317 * insdel.c (count_size_as_multibyte): Check for string overflow.
1318
1319 * character.c (lisp_string_width): Check for string overflow.
1320 Use EMACS_INT, not int, for string indexes and lengths; in
1321 particular, 2nd arg is now EMACS_INT, not int. Do not crash if
1322 the resulting string length overflows an EMACS_INT; instead,
1323 report a string overflow if no precision given. When checking for
1324 precision exhaustion, use a check that cannot possibly have
1325 integer overflow. (Bug#8675)
1326 * character.h (lisp_string_width): Adjust to new signature.
1327
1328 * alloc.c (string_overflow): New function.
1329 (Fmake_string): Use it. This doesn't change behavior, but saves
1330 a few bytes and will simplify future changes.
1331 * character.c (string_escape_byte8): Likewise.
1332 * lisp.h (string_overflow): New decl.
1333
1334 Fixups, following up to the user-interface timestamp change.
1335 * nsterm.m (last_mouse_movement_time, ns_mouse_position): Use Time
1336 for UI timestamps, instead of unsigned long.
1337 * msdos.c (mouse_get_pos): Likewise.
1338 * w32inevt.c (movement_time, w32_console_mouse_position): Likewise.
1339 * w32gui.h (Time): Define by including "systime.h" rather than by
1340 declaring it ourselves. (Bug#8664)
1341
1342 * dispextern.h (struct image): Don't assume time_t <= unsigned long.
1343 * image.c (clear_image_cache): Likewise.
1344
1345 * term.c (term_mouse_position): Don't assume time_t wraparound.
1346
1347 Be more systematic about user-interface timestamps.
1348 Before, the code sometimes used 'Time', sometimes 'unsigned long',
1349 and sometimes 'EMACS_UINT', to represent these timestamps.
1350 This change causes it to use 'Time' uniformly, as that's what X uses.
1351 This makes the code easier to follow, and makes it easier to catch
1352 integer overflow bugs such as Bug#8664.
1353 * frame.c (Fmouse_position, Fmouse_pixel_position):
1354 Use Time, not unsigned long, for user-interface timestamps.
1355 * keyboard.c (last_event_timestamp, kbd_buffer_get_event): Likewise.
1356 (button_down_time, make_lispy_position, make_lispy_movement): Likewise.
1357 * keyboard.h (last_event_timestamp): Likewise.
1358 * menu.c (Fx_popup_menu) [!HAVE_X_WINDOWS]: Likewise.
1359 * menu.h (xmenu_show): Likewise.
1360 * term.c (term_mouse_position): Likewise.
1361 * termhooks.h (struct input_event.timestamp): Likewise.
1362 (struct terminal.mouse_position_hook): Likewise.
1363 * xmenu.c (create_and_show_popup_menu, xmenu_show): Likewise.
1364 * xterm.c (XTmouse_position, x_scroll_bar_report_motion): Likewise.
1365 * systime.h (Time): New decl. Pull it in from <X11/X.h> if
1366 HAVE_X_WINDOWS, otherwise define it as unsigned long, which is
1367 what it was before.
1368 * menu.h, termhooks.h: Include "systime.h", for Time.
1369
1370 * keyboard.c (make_lispy_event): Fix problem in integer overflow.
1371 Don't assume that the difference between two unsigned long values
1372 can fit into an integer. At this point, we know button_down_time
1373 <= event->timestamp, so the difference must be nonnegative, so
1374 there's no need to cast the result if double-click-time is
1375 nonnegative, as it should be; check that it's nonnegative, just in
1376 case. This bug is triggered when events are more than 2**31 ms
1377 apart (about 25 days). (Bug#8664)
1378
1379 * xselect.c (last_event_timestamp): Remove duplicate decl.
1380 (x_own_selection): Remove needless cast to unsigned long.
1381
1382 * xmenu.c (set_frame_menubar): Use int, not EMACS_UINT, for indexes
1383 that always fit in int. Use a sentinel instead of a counter, to
1384 avoid a temp and to allay GCC's concerns about possible int overflow.
1385 * frame.h (struct frame): Use int for menu_bar_items_used
1386 instead of EMACS_INT, since it always fits in int.
1387
1388 * menu.c (grow_menu_items): Check for int overflow.
1389
1390 * xmenu.c (set_frame_menubar): Don't mishandle vectors with no nils.
1391
1392 * xterm.c: Use EMACS_INT for Emacs modifiers, and int for X modifiers.
1393 Before, the code was not consistent. These values cannot exceed
1394 2**31 - 1 so there's no need to make them unsigned.
1395 (x_x_to_emacs_modifiers): Accept int and return EMACS_INT.
1396 (x_emacs_to_x_modifiers): Accept EMACS_INT and return int.
1397 (x_x_to_emacs_modifiers, x_emacs_to_x_modifiers): Reject non-integers
1398 as modifiers.
1399 * xterm.h (x_x_to_emacs_modifiers): Adjust to signature change.
1400
1401 * lisp.h (XINT) [USE_LISP_UNION_TYPE]: Cast to EMACS_INT.
1402 (XUINT) [USE_LISP_UNION_TYPE]: Cast to EMACS_UINT.
1403 Otherwise, GCC 4.6.0 warns about printf (pI, XINT (...)),
1404 presumably because the widths might not match.
1405
1406 * window.c (size_window): Avoid needless test at loop start.
1407
1408 2011-05-18 Courtney Bane <emacs-bugs-7626@cbane.org> (tiny change)
1409
1410 * term.c (Fresume_tty): Restore hooks before reinitializing (bug#8687).
1411
1412 2011-05-12 Drew Adams <drew.adams@oracle.com>
1413
1414 * textprop.c (Fprevious_single_char_property_change): Doc fix (bug#8655).
1415
1416 2011-05-12 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
1417
1418 * w32term.c (w32_draw_fringe_bitmap): Rename local vars `left' and
1419 `width' to `bar_area_x' and `bar_area_width', respectively.
1420 (x_scroll_run): Take account of fringe background extension.
1421
1422 * xterm.c (x_draw_fringe_bitmap) [USE_TOOLKIT_SCROLL_BARS]:
1423 Rename local vars `left' and `width' to `bar_area_x' and
1424 `bar_area_width', respectively.
1425 (x_scroll_run) [USE_TOOLKIT_SCROLL_BARS]: Take account of fringe
1426 background extension.
1427
1428 2011-05-10 Jim Meyering <meyering@redhat.com>
1429
1430 * xdisp.c (x_intersect_rectangles): Fix typo "the the -> the".
1431
1432 2011-05-10 Juanma Barranquero <lekktu@gmail.com>
1433
1434 * image.c (Finit_image_library): Return t for built-in image types,
1435 like pbm and xbm. (Bug#8640)
1436
1437 2011-05-09 Andreas Schwab <schwab@linux-m68k.org>
1438
1439 * w32menu.c (set_frame_menubar): Fix submenu allocation.
1440
1441 2011-05-07 Eli Zaretskii <eliz@gnu.org>
1442
1443 * w32console.c (Fset_screen_color): Doc fix.
1444 (Fget_screen_color): New function.
1445 (syms_of_ntterm): Defsubr it.
1446
1447 * callproc.c (call_process_cleanup) [MSDOS]: Don't close and
1448 unlink the temporary file if Fcall_process didn't create it in the
1449 first place.
1450 (Fcall_process) [MSDOS]: Don't create tempfile if stdout of the
1451 child process will be redirected to a file specified with `:file'.
1452 Don't try to re-open tempfile in that case, and set fd[0] to -1 as
1453 cue to call_process_cleanup not to close that handle.
1454
1455 2011-05-07 Ben Key <bkey76@gmail.com>
1456
1457 * makefile.w32-in: The bootstrap-temacs rule now makes use of
1458 one of two shell specific rules, either bootstrap-temacs-CMD or
1459 bootstrap-temacs-SH. The bootstrap-temacs-SH rule is identical
1460 to the previous implementation of the bootstrap-temacs rule.
1461 The bootstrap-temacs-CMD rule is similar to the previous
1462 implementation of the bootstrap-temacs rule except that it
1463 makes use of the ESC_CFLAGS variable instead of the CFLAGS
1464 variable.
1465
1466 These changes, along with some changes to nt/configure.bat,
1467 nt/gmake.defs, and nt/nmake.defs, are required to extend my
1468 earlier fix to add support for --cflags and --ldflags options
1469 that include quotes so that it works whether make uses cmd or
1470 sh as the shell.
1471
1472 2011-05-06 Michael Albinus <michael.albinus@gmx.de>
1473
1474 * dbusbind.c (QCdbus_type_unix_fd): Declare static.
1475 (xd_remove_watch): Don't check QCdbus_type_unix_fd for SYMBOLP, it
1476 is a constant.
1477 (Fdbus_init_bus, xd_read_queued_messages): Bus can be a symbol or
1478 a string. Handle both cases.
1479 (Fdbus_call_method_asynchronously, Fdbus_register_signal)
1480 (Fdbus_register_method): Use Qinvalid_function.
1481
1482 2011-05-06 Juanma Barranquero <lekktu@gmail.com>
1483
1484 * makefile.w32-in: Update dependencies.
1485 (LISP_H): Add inttypes.h and stdin.h.
1486 (PROCESS_H): Add unistd.h.
1487
1488 2011-05-06 Eli Zaretskii <eliz@gnu.org>
1489
1490 * lread.c: Include limits.h (fixes the MS-Windows build broken by
1491 2011-05-06T07:13:19Z!eggert@cs.ucla.edu).
1492
1493 2011-05-06 Paul Eggert <eggert@cs.ucla.edu>
1494
1495 * image.c (Finit_image_library) [!HAVE_NTGUI]: Omit unused local.
1496
1497 * term.c (vfatal): Remove stray call to va_end.
1498 It's not needed and the C Standard doesn't allow it here anyway.
1499
1500 Use C99's va_copy to avoid undefined behavior on x86-64 GNU/Linux.
1501 * eval.c (verror): doprnt a copy of ap, not the original. (Bug#8545)
1502
1503 * eval.c (verror): OK to create a string of up to MOST_POSITIVE_FIXNUM
1504 bytes.
1505
1506 * term.c: Don't include <stdarg.h>, as <lisp.h> does that.
1507
1508 * callproc.c (Fcall_process): Use 'volatile' to avoid vfork clobbering.
1509
1510 * process.c (Fformat_network_address): Fix typo: args2 -> *args2.
1511
1512 * xmenu.c (set_frame_menubar): Fix typo: int * -> int (3 times).
1513
1514 * coding.c (detect_coding_charset): Fix typo: * 2 -> *4 (Bug#8601).
1515
1516 * charset.h (struct charset.code_space): Now has 15 elements, not 16.
1517 * charset.c (Fdefine_charset_internal): Don't initialize
1518 charset.code_space[15]. The value was garbage, on hosts with
1519 32-bit int (Bug#8600).
1520
1521 * lread.c (read_integer): Be more consistent with string-to-number.
1522 Use string_to_number to do the actual conversion; this avoids
1523 rounding errors and fixes some other screwups. Without this fix,
1524 for example, #x1fffffffffffffff was misread as -2305843009213693952.
1525 (digit_to_number): Move earlier, for benefit of read_integer.
1526 Return -1 if the digit is out of range for the base, -2 if it is
1527 not a digit in any supported base. (Bug#8602)
1528
1529 * doprnt.c (doprnt): Support arbitrary pI values, such as "I64".
1530
1531 * dispnew.c (scrolling_window): Return 1 if we scrolled,
1532 to match comment at start of function. This also removes a
1533 GCC warning about overflow in a 32+64-bit port.
1534
1535 * lisp.h (EMACS_INT, EMACS_UINT, BITS_PER_EMACS_INT, pI): Simplify.
1536
1537 * dbusbind.c: Do not use XPNTR on a value that may be an integer.
1538 Reported by Stefan Monnier in
1539 <http://lists.gnu.org/archive/html/emacs-devel/2011-04/msg00919.html>.
1540 (xd_remove_watch, Fdbus_init_bus, xd_read_queued_messages):
1541 Use SYMBOLP-guarded XSYMBOL, not XPNTR.
1542
1543 * lisp.h (EMACS_INTPTR): Remove. All uses changed to intptr_t.
1544 (EMACS_UINTPTR): Likewise, with uintptr_t.
1545
1546 * lisp.h: Prefer 64-bit EMACS_INT if available.
1547 (EMACS_INT, EMACS_UINT, BITS_PER_EMACS_INT, pI): Define to 64-bit
1548 on 32-bit hosts that have 64-bit int, so that they can access
1549 large files.
1550 However, temporarily disable this change unless the temporary
1551 symbol WIDE_EMACS_INT is defined.
1552
1553 * lread.c, process.c: Do not include <inttypes.h>; lisp.h does it now.
1554
1555 Prefer intptr_t/uintptr_t for integers the same widths as pointers.
1556 This removes an assumption that EMACS_INT and long are the same
1557 width as pointers. The assumption is true for Emacs porting targets
1558 now, but we want to make other targets possible.
1559 * lisp.h: Include <inttypes.h>, for INTPTR_MAX, UINTPTR_MAX.
1560 (EMACS_INTPTR, EMACS_UINTPTR): New macros.
1561 In the rest of the code, change types of integers that hold casted
1562 pointers to EMACS_INTPTR and EMACS_UINTPTR, systematically
1563 replacing EMACS_INT, long, EMACS_UINT, and unsigned long.
1564 (XTYPE): Don't cast arg to EMACS_UINT; normally is not needed.
1565 (XSET): Cast type of XTYPE arg to EMACS_INTPTR; it is needed here.
1566 No need to cast type when ORing.
1567 (XPNTR): Return a value of type EMACS_INTPTR or EMACS_UINTPTR.
1568 * alloc.c (lisp_align_malloc): Remove a no-longer-needed cast.
1569 * doc.c (store_function_docstring): Use EMACS_INTPTR, so as not to
1570 assume EMACS_INT is the same width as char *.
1571 * gtkutil.c (xg_gtk_scroll_destroy, xg_tool_bar_button_cb):
1572 (xg_tool_bar_callback, xg_tool_bar_help_callback, xg_make_tool_item):
1573 Remove no-longer-needed casts.
1574 (xg_create_scroll_bar, xg_tool_bar_button_cb, xg_tool_bar_callback):
1575 (xg_tool_bar_help_callback, xg_make_tool_item):
1576 Use EMACS_INTPTR to hold an integer
1577 that will be cast to void *; this can avoid a GCC warning
1578 if EMACS_INT is not the same width as void *.
1579 * menu.c (find_and_call_menu_selection): Remove no-longer-needed cast.
1580 * xdisp.c (display_echo_area_1, resize_mini_window_1):
1581 (current_message_1, set_message_1):
1582 Use a local to convert to proper width without a cast.
1583 * xmenu.c (dialog_selection_callback): Likewise.
1584
1585 * sysdep.c (get_random): Don't assume EMACS_INT is no wider than long.
1586 Also, don't assume VALBITS / RAND_BITS is less than 5,
1587 and don't rely on undefined behavior when shifting a 1 left into
1588 the sign bit.
1589 * lisp.h (get_random): Change signature to match.
1590
1591 * lread.c (hash_string): Use size_t, not int, for hash computation.
1592 Normally we prefer signed values; but hashing is special, because
1593 it's better to use unsigned division on hash table sizes so that
1594 the remainder is nonnegative. Also, size_t is the natural width
1595 for hashing into memory. The previous code used 'int', which doesn't
1596 retain enough info to hash well into very large tables.
1597 (oblookup, oblookup_last_bucket_number, Funintern): Likewise.
1598
1599 * dbusbind.c: Don't possibly lose pointer info when converting.
1600 (xd_remove_watch, Fdbus_init_bus, xd_read_queued_messages):
1601 Use XPNTR rather than XHASH, so that the high-order bits of
1602 the pointer aren't lost when converting through void *.
1603
1604 * eval.c (Fautoload): Don't double-shift a pointer.
1605
1606 * fns.c (Frandom): Let EMACS_UINT be wider than unsigned long.
1607
1608 2011-05-06 Juanma Barranquero <lekktu@gmail.com>
1609
1610 * gnutls.c (DEF_GNUTLS_FN):
1611 * image.c (DEF_IMGLIB_FN): Make function pointers static.
1612
1613 2011-05-05 Andreas Schwab <schwab@linux-m68k.org>
1614
1615 * lread.c (lisp_file_lexically_bound_p): Stop scanning at end
1616 marker. (Bug#8610)
1617
1618 2011-05-05 Eli Zaretskii <eliz@gnu.org>
1619
1620 * w32heap.c (allocate_heap) [USE_LISP_UNION_TYPE || USE_LSB_TAG]:
1621 New version that can reserve upto 2GB of heap space.
1622
1623 2011-05-05 Chong Yidong <cyd@stupidchicken.com>
1624
1625 * nsfns.m (Fns_read_file_name): Doc fix (Bug#8534).
1626
1627 2011-05-05 Teodor Zlatanov <tzz@lifelogs.com>
1628
1629 * gnutls.c (fn_gnutls_certificate_set_x509_key_file): Add alias to
1630 `gnutls_certificate_set_x509_key_file'.
1631
1632 2011-05-05 Juanma Barranquero <lekktu@gmail.com>
1633
1634 * makefile.w32-in ($(BLD)/image.$(O), $(BLD)/process.$(O)):
1635 Update dependencies.
1636
1637 2011-05-04 Juanma Barranquero <lekktu@gmail.com>
1638
1639 * gnutls.h (emacs_gnutls_write, emacs_gnutls_read):
1640 * gnutls.c (emacs_gnutls_write, emacs_gnutls_read):
1641 Remove unused parameter `fildes'.
1642 * process.c (read_process_output, send_process): Don't pass it.
1643
1644 2011-05-04 Juanma Barranquero <lekktu@gmail.com>
1645
1646 Fix previous change: the library cache is defined in w32.c.
1647 * image.c (CACHE_IMAGE_TYPE) [!HAVE_NTGUI]: Define to noop.
1648 (Finit_image_library): Wrap Vlibrary_cache on "#ifdef HAVE_NTGUI".
1649
1650 2011-05-04 Juanma Barranquero <lekktu@gmail.com>
1651
1652 Implement dynamic loading of GnuTLS on Windows.
1653
1654 * gnutls.h (GNUTLS_EMACS_ERROR_NOT_LOADED): New macro.
1655 (emacs_gnutls_write, emacs_gnutls_read): Mark as extern.
1656 (emacs_gnutls_record_check_pending, emacs_gnutls_transport_set_errno):
1657 Declare.
1658
1659 * gnutls.c (Qgnutls_dll): Define.
1660 (DEF_GNUTLS_FN, LOAD_GNUTLS_FN): New macros.
1661 (gnutls_*): Declare function pointers.
1662 (init_gnutls_functions): New function to initialize function pointers.
1663 (emacs_gnutls_handshake, Fgnutls_error_string, Fgnutls_deinit)
1664 (emacs_gnutls_global_init, Fgnutls_bye): Use function pointers.
1665 (emacs_gnutls_record_check_pending, emacs_gnutls_transport_set_errno):
1666 Wrappers for gnutls_record_check_pending and gnutls_transport_set_errno.
1667 (emacs_gnutls_write, emacs_gnutls_read)
1668 (emacs_gnutls_handle_error, Fgnutls_error_fatalp)
1669 (Fgnutls_available_p): New function.
1670 (Fgnutls_boot): Call Fgnutls_available_p. Use function pointers.
1671 (syms_of_gnutls) <Qgnutls_dll>: Initialize and staticpro it.
1672 (syms_of_gnutls) <Sgnutls_available_p>: defsubr it.
1673
1674 * image.c: Include w32.h.
1675 (Vimage_type_cache): Delete.
1676 (syms_of_image) <Vimage_type_cache>: Don't initialize and staticpro it.
1677 (CACHE_IMAGE_TYPE, Finit_image_library): Use Vlibrary_cache instead.
1678 (w32_delayed_load): Move to w32.c.
1679
1680 * w32.h (VlibraryCache, QCloaded_from, w32_delayed_load): Declare.
1681
1682 * w32.c (QCloaded_from, Vlibrary_cache): Define.
1683 (w32_delayed_load): Move from image.c. When loading a library, record
1684 its filename in the :loaded-from property of the library id.
1685 (globals_of_w32) <QCloaded_from, Vlibrary_cache>:
1686 Initialize and staticpro them.
1687 (emacs_gnutls_pull, emacs_gnutls_push): Call emacs_gnutls_* functions.
1688
1689 * process.c: Include lisp.h before w32.h, not after.
1690 (wait_reading_process_output): Call emacs_gnutls_record_check_pending
1691 instead of gnutls_record_check_pending.
1692
1693 * callproc.c, emacs.c: Include lisp.h before w32.h, not after.
1694
1695 2011-05-04 Teodor Zlatanov <tzz@lifelogs.com>
1696
1697 * gnutls.c (Fgnutls_boot): Support :keylist and :crlfiles options
1698 instead of :keyfiles. Give GnuTLS the keylist and the CRL lists
1699 as passed in.
1700
1701 2011-05-03 Jan Djärv <jan.h.d@swipnet.se>
1702
1703 * xterm.c (x_set_frame_alpha): Do not set property on anything
1704 else than FRAME_X_OUTER_WINDOW (Bug#8608).
1705
1706 2011-05-02 Juanma Barranquero <lekktu@gmail.com>
1707
1708 * sysdep.c (get_tty_size) [WINDOWSNT]: Implement. (Bug#8596)
1709
1710 2011-05-02 Juanma Barranquero <lekktu@gmail.com>
1711
1712 * gnutls.c (Qgnutls_log_level, Qgnutls_code, Qgnutls_anon)
1713 (Qgnutls_x509pki, Qgnutls_e_interrupted, Qgnutls_e_again)
1714 (Qgnutls_e_invalid_session, Qgnutls_e_not_ready_for_handshake)
1715 (gnutls_global_initialized, Qgnutls_bootprop_priority)
1716 (Qgnutls_bootprop_trustfiles, Qgnutls_bootprop_keyfiles)
1717 (Qgnutls_bootprop_callbacks, Qgnutls_bootprop_loglevel)
1718 (Qgnutls_bootprop_hostname, Qgnutls_bootprop_verify_flags)
1719 (Qgnutls_bootprop_verify_error, Qgnutls_bootprop_verify_hostname_error)
1720 (Qgnutls_bootprop_callbacks_verify): Make static.
1721
1722 2011-05-01 Andreas Schwab <schwab@linux-m68k.org>
1723
1724 * callproc.c: Indentation fixup.
1725
1726 * sysdep.c (wait_for_termination_1): Make static.
1727 (wait_for_termination, interruptible_wait_for_termination):
1728 Move after wait_for_termination_1.
1729
1730 2011-05-01 Lars Magne Ingebrigtsen <larsi@gnus.org>
1731
1732 * sysdep.c (interruptible_wait_for_termination): New function
1733 which is like wait_for_termination, but allows keyboard
1734 interruptions.
1735
1736 * callproc.c (Fcall_process): Add (:file "file") as an option for
1737 the STDOUT buffer.
1738 (Fcall_process_region): Ditto.
1739
1740 2011-04-30 Eli Zaretskii <eliz@gnu.org>
1741
1742 * dosfns.c (Fint86, Fdos_memget, Fdos_memput): Use `ASIZE (FOO)'
1743 rather than `XVECTOR (FOO)->size'.
1744
1745 * process.c: Remove HAVE_INTTYPES_H condition from inclusion of
1746 inttypes.h, as a gnulib replacement is used if it not available in
1747 system headers.
1748
1749 2011-04-21 Eli Zaretskii <eliz@gnu.org>
1750
1751 Lift the MOST_POSITIVE_FIXNUM/4 limitation on visited files.
1752 * fileio.c (Finsert_file_contents): Don't limit file size to 1/4
1753 of MOST_POSITIVE_FIXNUM. (Bug#8528)
1754
1755 * coding.c (coding_alloc_by_realloc): Error out if destination
1756 will grow beyond MOST_POSITIVE_FIXNUM.
1757 (decode_coding_emacs_mule): Abort if there isn't enough place in
1758 charbuf for the composition carryover bytes. Reserve an extra
1759 space for up to 2 characters produced in a loop.
1760 (decode_coding_iso_2022): Abort if there isn't enough place in
1761 charbuf for the composition carryover bytes.
1762
1763 2011-04-21 Eli Zaretskii <eliz@gnu.org>
1764
1765 * doprnt.c (doprnt) [!HAVE_LONG_LONG_INT]: Error out instead of
1766 aborting when %lld or %lll format is passed.
1767 [!HAVE_UNSIGNED_LONG_LONG_INT]: Error out instead of aborting when
1768 %llo or %llx format is passed. (Bug#8545)
1769
1770 * window.c (window_scroll_line_based): Use a marker instead of
1771 simple variables to record original value of point. (Bug#7952)
1772
1773 * doprnt.c (doprnt): Fix the case where a multibyte sequence
1774 produced by %s or %c overflows available buffer space. (Bug#8545)
1775
1776 2011-04-28 Paul Eggert <eggert@cs.ucla.edu>
1777
1778 * doprnt.c (doprnt): Omit useless test; int overflow check (Bug#8545).
1779 (SIZE_MAX): Move defn after all includes, as they might #define it.
1780
1781 2011-04-28 Juanma Barranquero <lekktu@gmail.com>
1782
1783 * w32.c (init_environment): Warn about defaulting HOME to C:\.
1784
1785 2011-04-28 Juanma Barranquero <lekktu@gmail.com>
1786
1787 * keyboard.c (Qdelayed_warnings_hook): Define.
1788 (command_loop_1): Run `delayed-warnings-hook'
1789 if Vdelayed_warnings_list is non-nil.
1790 (syms_of_keyboard) <delayed-warnings-hook>: DEFSYM it.
1791 (syms_of_keyboard) <delayed-warnings-list>: DEFVAR_LISP it.
1792
1793 2011-04-28 Eli Zaretskii <eliz@gnu.org>
1794
1795 * doprnt.c (doprnt): Don't return value smaller than the buffer
1796 size if the message was truncated. (Bug#8545).
1797
1798 2011-04-28 Juanma Barranquero <lekktu@gmail.com>
1799
1800 * w32fns.c (Fx_change_window_property, Fx_delete_window_property)
1801 (Fx_window_property): #if-0 the whole functions, not just the bodies.
1802
1803 2011-04-27 Paul Eggert <eggert@cs.ucla.edu>
1804
1805 * doprnt.c (doprnt): Support "ll" length modifier, for long long.
1806
1807 2011-04-27 Juanma Barranquero <lekktu@gmail.com>
1808
1809 * makefile.w32-in: Update dependencies.
1810
1811 2011-04-27 Eli Zaretskii <eliz@gnu.org>
1812
1813 Improve `doprnt' and its usage. (Bug#8545)
1814 * doprnt.c (doprnt): Make sure `format' is never accessed beyond
1815 `format_end'. Remove support for %l as a conversion specifier.
1816 Don't use xrealloc. Improve diagnostics when the %l size modifier
1817 is used. Update the commentary.
1818
1819 * eval.c (verror): Simplify calculation of size_t.
1820
1821 * coding.c (Ffind_operation_coding_system): Fix diagnostic error
1822 messages.
1823
1824 2011-04-27 Yoshiaki Kasahara <kasahara@nc.kyushu-u.ac.jp> (tiny change)
1825
1826 * buffer.c (init_buffer) [USE_MMAP_FOR_BUFFERS]: Adjust to aliasing
1827 change.
1828
1829 2011-04-27 Paul Eggert <eggert@cs.ucla.edu>
1830
1831 * nsmenu.m: Replace all uses of XVECTOR with ASIZE and AREF.
1832 This makes this file independent of the recent pseudovector change.
1833
1834 2011-04-26 Paul Eggert <eggert@cs.ucla.edu>
1835
1836 * keyboard.c (handle_user_signal): Fix pointer signedness problem.
1837
1838 * gnutls.c (emacs_gnutls_handle_error): Remove unused local.
1839 (Fgnutls_boot): gnutls_certificate_verify_peers2 wants unsigned *.
1840 Remove unused local.
1841 (emacs_gnutls_write): Don't use uninitialized rtnval if nbyte <= 0.
1842
1843 * lisp.h: Fix a problem with aliasing and vector headers. (Bug#8546)
1844 GCC 4.6.0 optimizes based on type-based alias analysis.
1845 For example, if b is of type struct buffer * and v of type struct
1846 Lisp_Vector *, then gcc -O2 was incorrectly assuming that &b->size
1847 != &v->size, and therefore "v->size = 1; b->size = 2; return
1848 v->size;" must therefore return 1. This assumption is incorrect
1849 for Emacs, since it type-puns struct Lisp_Vector * with many other
1850 types. To fix this problem, this patch adds a new type struct
1851 vectorlike_header that documents the constraints on layout of vectors
1852 and pseudovectors, and helps optimizing compilers not get fooled
1853 by Emacs's type punning. It also adds the macros XSETTYPED_PVECTYPE
1854 XSETTYPED_PSEUDOVECTOR, TYPED_PSEUDOVECTORP, for similar reasons.
1855 * lisp.h (XSETTYPED_PVECTYPE): New macro, specifying the name of
1856 the size member.
1857 (XSETPVECTYPE): Rewrite in terms of new macro.
1858 (XSETPVECTYPESIZE): New macro, specifying both type and size.
1859 This is a bit clearer, and further avoids the possibility of
1860 undesirable aliasing.
1861 (XSETTYPED_PSEUDOVECTOR): New macro, specifying the size.
1862 (XSETPSEUDOVECTOR): Rewrite in terms of XSETTYPED_PSEUDOVECTOR.
1863 (XSETSUBR): Rewrite in terms of XSETTYPED_PSEUDOVECTOR and XSIZE,
1864 since Lisp_Subr is a special case (no "next" field).
1865 (ASIZE): Now uses header.size rather than size.
1866 All previous uses of XVECTOR (foo)->size replaced to use this macro,
1867 to avoid the hassle of writing XVECTOR (foo)->header.size.
1868 (struct vectorlike_header): New type.
1869 (TYPED_PSEUDOVECTORP): New macro, also specifying the C type of the
1870 object, to help avoid aliasing.
1871 (PSEUDOVECTORP): Rewrite in terms of TYPED_PSEUDOVECTORP.
1872 (SUBRP): Likewise, since Lisp_Subr is a special case.
1873 * lisp.h (struct Lisp_Vector, struct Lisp_Char_Table):
1874 (struct Lisp_Sub_Char_Table, struct Lisp_Bool_Vector):
1875 (struct Lisp_Hash_Table): Combine first two members into a single
1876 struct vectorlike_header member. All uses of "size" and "next" members
1877 changed to be "header.size" and "header.next".
1878 * buffer.h (struct buffer): Likewise.
1879 * font.h (struct font_spec, struct font_entity, struct font): Likewise.
1880 * frame.h (struct frame): Likewise.
1881 * process.h (struct Lisp_Process): Likewise.
1882 * termhooks.h (struct terminal): Likewise.
1883 * window.c (struct save_window_data, struct saved_window): Likewise.
1884 * window.h (struct window): Likewise.
1885 * alloc.c (allocate_buffer, Fmake_bool_vector, allocate_pseudovector):
1886 Use XSETPVECTYPESIZE, not XSETPVECTYPE, to avoid aliasing problems.
1887 * buffer.c (init_buffer_once): Likewise.
1888 * lread.c (defsubr): Use XSETTYPED_PVECTYPE, since Lisp_Subr is a
1889 special case.
1890 * process.c (Fformat_network_address): Use local var for size,
1891 for brevity.
1892
1893 * bytecode.c (exec_byte_code): Don't use XVECTOR before CHECK_VECTOR.
1894
1895 Make the Lisp reader and string-to-float more consistent (Bug#8525)
1896 * data.c (atof): Remove decl; no longer used or needed.
1897 (digit_to_number): Move to lread.c.
1898 (Fstring_to_number): Use new string_to_number function, to be
1899 consistent with how the Lisp reader treats infinities and NaNs.
1900 Do not assume that floating-point numbers represent EMACS_INT
1901 without losing information; this is not true on most 64-bit hosts.
1902 Avoid double-rounding errors, by insisting on integers when
1903 parsing non-base-10 numbers, as the documentation specifies.
1904 * lisp.h (string_to_number): New decl, replacing ...
1905 (isfloat_string): Remove.
1906 * lread.c: Include <inttypes.h>, for uintmax_t and strtoumax.
1907 (read1): Do not accept +. and -. as integers; this
1908 appears to have been a coding error. Similarly, do not accept
1909 strings like +-1e0 as floating point numbers. Do not report
1910 overflow for integer overflows unless the base is not 10 which
1911 means we have no simple and reliable way to continue.
1912 Break out the floating-point parsing into a new
1913 function string_to_number, so that Fstring_to_number parses
1914 floating point numbers consistently with the Lisp reader.
1915 (digit_to_number): Move here from data.c. Make it static inline.
1916 (E_CHAR, EXP_INT): Remove, replacing with ...
1917 (E_EXP): New macro, to solve the "1.0e+" problem mentioned below.
1918 (string_to_number): New function, replacing isfloat_string.
1919 This function checks for valid syntax and produces the resulting
1920 Lisp float number too. Rework it so that string-to-number
1921 no longer mishandles examples like "1.0e+". Use strtoumax,
1922 so that overflow for non-base-10 numbers is reported only when
1923 there's no portable and simple way to convert to floating point.
1924
1925 * textprop.c (set_text_properties_1): Rewrite for clarity,
1926 and to avoid GCC warning about integer overflow.
1927
1928 * intervals.h (struct interval): Use EMACS_INT for members
1929 where EMACS_UINT might cause problems. See
1930 <http://lists.gnu.org/archive/html/emacs-devel/2011-04/msg00514.html>.
1931 (CHECK_TOTAL_LENGTH): Remove cast to EMACS_INT; no longer needed.
1932 * intervals.c (interval_deletion_adjustment): Now returns EMACS_INT.
1933 All uses changed.
1934 (offset_intervals): Tell GCC not to worry about length overflow
1935 when negating a negative length.
1936
1937 * alloc.c (overrun_check_malloc, overrun_check_realloc): Now static.
1938 (overrun_check_free): Likewise.
1939
1940 * alloc.c (SDATA_SIZE) [!GC_CHECK_STRING_BYTES]: Avoid runtime check
1941 in the common case where SDATA_DATA_OFFSET is a multiple of Emacs
1942 word size.
1943
1944 * gnutls.c: Fix problems found by GCC 4.6.0 on Ubuntu 10.10.
1945 (gnutls_make_error): Rename local to avoid shadowing.
1946 (gnutls_emacs_global_deinit): ifdef out; not used.
1947 (Fgnutls_boot): Use const for pointer to readonly storage.
1948 Comment out unused local. Fix pointer signedness problems.
1949
1950 * lread.c (openp): Don't stuff size_t into an 'int'.
1951 Use <= on length, not < on length + 1, to avoid GCC 4.6.0 warning
1952 about possible signed overflow.
1953
1954 * gtkutil.c: Fix problems found by GCC 4.6.0 on Ubuntu 10.10.
1955 (GDK_KEY_g): Don't define if already defined.
1956 (xg_prepare_tooltip): Avoid pointer signedness problem.
1957 (xg_set_toolkit_scroll_bar_thumb): Redo to avoid two casts.
1958
1959 * process.c (Fnetwork_interface_info): Avoid left-shift undefined
1960 behavior with 1 << 31. GCC 4.6.0 warns about this on 32-bit hosts.
1961
1962 * xfns.c (Fx_window_property): Simplify a bit,
1963 to make a bit faster and to avoid GCC 4.6.0 warning.
1964 * xselect.c (x_get_window_property, x_handle_dnd_message): Likewise.
1965
1966 * fns.c (internal_equal): Don't assume size_t fits in int.
1967
1968 * alloc.c (compact_small_strings): Tighten assertion a little.
1969
1970 Replace pEd with more-general pI, and fix some printf arg casts.
1971 * lisp.h (pI): New macro, generalizing old pEd macro to other
1972 conversion specifiers. For example, use "...%"pI"d..." rather
1973 than "...%"pEd"...".
1974 (pEd): Remove. All uses replaced with similar uses of pI.
1975 * src/m/amdx86-64.h, src/m/ia64.h, src/m/ibms390x.h: Likewise.
1976 * alloc.c (check_pure_size): Don't overflow by converting size to int.
1977 * bidi.c (bidi_dump_cached_states): Use pI to avoid cast.
1978 * data.c (Fnumber_to_string): Use pI instead of if-then-else-abort.
1979 * dbusbind.c (xd_append_arg): Use pI to avoid cast.
1980 (Fdbus_method_return_internal, Fdbus_method_error_internal): Likewise.
1981 * font.c (font_unparse_xlfd): Avoid potential buffer overrun on
1982 64-bit hosts.
1983 (font_unparse_xlfd, font_unparse_fcname): Use pI to avoid casts.
1984 * keyboard.c (record_char, modify_event_symbol): Use pI to avoid casts.
1985 * print.c (safe_debug_print, print_object): Likewise.
1986 (print_object): Don't overflow by converting EMACS_INT or EMACS_UINT
1987 to int.
1988 Use pI instead of if-then-else-abort. Use %p to avoid casts,
1989 avoiding the 0 flag, which is not portable.
1990 * process.c (Fmake_network_process): Use pI to avoid cast.
1991 * region-cache.c (pp_cache): Likewise.
1992 * xdisp.c (decode_mode_spec): Likewise.
1993 * xrdb.c (x_load_resources) [USE_MOTIF]: Use pI to avoid undefined
1994 behavior on 64-bit hosts with printf arg.
1995 * xselect.c (x_queue_event): Use %p to avoid casts, avoiding 0 flag.
1996 (x_stop_queuing_selection_requests): Likewise.
1997 (x_get_window_property): Don't truncate byte count to an 'int'
1998 when tracing.
1999
2000 * frame.c (frame_name_fnn_p): Get rid of strtol, which isn't right
2001 here, since it parses constructs like leading '-' and spaces,
2002 which are not wanted; and it overflows with large numbers.
2003 Instead, simply match F[0-9]+, which is what is wanted anyway.
2004
2005 * alloc.c: Remove unportable assumptions about struct layout.
2006 (SDATA_SELECTOR, SDATA_DATA_OFFSET): New macros.
2007 (SDATA_OF_STRING, SDATA_SIZE, allocate_string_data):
2008 (allocate_vectorlike, make_pure_vector): Use the new macros,
2009 plus offsetof, to remove unportable assumptions about struct layout.
2010 These assumptions hold on all porting targets that I know of, but
2011 they are not guaranteed, they're easy to remove, and removing them
2012 makes further changes easier.
2013
2014 * alloc.c (BLOCK BYTES): Fix typo by changing "ablock" to "ablocks".
2015 This doesn't fix a bug but makes the code clearer.
2016 (string_overrun_cookie): Now const. Use initializers that
2017 don't formally overflow signed char, to avoid warnings.
2018 (allocate_string_data) [GC_CHECK_STRING_OVERRUN]: Fix typo that
2019 can cause Emacs to crash when string overrun checking is enabled.
2020 (allocate_buffer): Don't assume sizeof (struct buffer) is a
2021 multiple of sizeof (EMACS_INT); it need not be, if
2022 alignof(EMACS_INT) < sizeof (EMACS_INT).
2023 (check_sblock, check_string_bytes, check_string_free_list): Protoize.
2024
2025 2011-04-26 Juanma Barranquero <lekktu@gmail.com>
2026
2027 * keyboard.c (QCrtl): Rename from Qrtl. All uses changed.
2028
2029 2011-04-26 Teodor Zlatanov <tzz@lifelogs.com>
2030
2031 * gnutls.c (emacs_gnutls_handshake): Return an error if we're not
2032 supposed to be handshaking. (Bug#8556)
2033 Reported by Paul Eggert <eggert@cs.ucla.edu>.
2034
2035 2011-04-26 Daniel Colascione <dan.colascione@gmail.com>
2036
2037 * lisp.h (Qdebug): List symbol.
2038 * eval.c (Qdebug): Restore global linkage.
2039 * keyboard.c (debug-on-event): New variable.
2040 (handle_user_signal): Break into debugger when debug-on-event
2041 matches the current signal symbol.
2042
2043 2011-04-25 Dan Nicolaescu <dann@ics.uci.edu>
2044
2045 * alloc.c (check_sblock, check_string_bytes)
2046 (check_string_free_list): Convert to standard C.
2047
2048 2011-04-25 Teodor Zlatanov <tzz@lifelogs.com>
2049
2050 * w32.c (emacs_gnutls_push): Fix typo.
2051
2052 2011-04-25 Eli Zaretskii <eliz@gnu.org>
2053
2054 * gnutls.c (emacs_gnutls_handshake): Avoid compiler warnings about
2055 "cast to pointer from integer of different size".
2056
2057 Improve doprnt and its use in verror. (Bug#8545)
2058 * doprnt.c (doprnt): Document the set of format control sequences
2059 supported by the function. Use SAFE_ALLOCA instead of always
2060 using `alloca'.
2061
2062 * eval.c (verror): Don't limit the buffer size at size_max-1, that
2063 is one byte too soon. Don't use xrealloc; instead xfree and
2064 xmalloc anew.
2065
2066 2011-04-24 Teodor Zlatanov <tzz@lifelogs.com>
2067
2068 * gnutls.h: Add GNUTLS_STAGE_CALLBACKS enum to denote we're in the
2069 callbacks stage.
2070
2071 * gnutls.c: Renamed global_initialized to
2072 gnutls_global_initialized. Added internals for the
2073 :verify-hostname-error, :verify-error, and :verify-flags
2074 parameters of `gnutls-boot' and documented those parameters in the
2075 docstring. Start callback support.
2076 (emacs_gnutls_handshake): Add Woe32 support. Retry handshake
2077 unless a fatal error occured. Call gnutls_alert_send_appropriate
2078 on error. Return error code.
2079 (emacs_gnutls_write): Call emacs_gnutls_handle_error.
2080 (emacs_gnutls_read): Likewise.
2081 (Fgnutls_boot): Return handshake error code.
2082 (emacs_gnutls_handle_error): New function.
2083 (wsaerror_to_errno): Likewise.
2084
2085 * w32.h (emacs_gnutls_pull): Add prototype.
2086 (emacs_gnutls_push): Likewise.
2087
2088 * w32.c (emacs_gnutls_pull): New function for GnuTLS on Woe32.
2089 (emacs_gnutls_push): Likewise.
2090
2091 2011-04-24 Claudio Bley <claudio.bley@gmail.com> (tiny change)
2092
2093 * process.c (wait_reading_process_output): Check if GnuTLS
2094 buffered some data internally if no FDs are set for TLS
2095 connections.
2096
2097 * makefile.w32-in (OBJ2): Add gnutls.$(O).
2098 (LIBS): Link to USER_LIBS.
2099 ($(BLD)/gnutls.$(0)): New target.
2100
2101 2011-04-24 Eli Zaretskii <eliz@gnu.org>
2102
2103 * xdisp.c (handle_single_display_spec): Rename the
2104 display_replaced_before_p argument into display_replaced_p, to
2105 make it consistent with the commentary. Fix typos in the
2106 commentary.
2107
2108 * textprop.c (syms_of_textprop): Remove dead code.
2109 (copy_text_properties): Delete obsolete commentary about an
2110 interface that was deleted long ago. Fix typos in the description
2111 of arguments.
2112
2113 * msdos.c (XMenuActivate, XMenuAddSelection): Adjust argument list
2114 to changes in oldXMenu/XMenu.h from 2011-04-16.
2115 <menu_help_message, prev_menu_help_message>: Constify.
2116 (IT_menu_make_room): menu->help_text is now `const char **';
2117 adjust.
2118
2119 * msdos.h (XMenuActivate, XMenuAddSelection): Adjust prototypes
2120 to changes in oldXMenu/XMenu.h from 2011-04-16.
2121 (struct XMenu): Declare `help_text' `const char **'.
2122
2123 * xfaces.c <Qunspecified>: Make extern again.
2124
2125 * syntax.c: Include sys/types.h before including regex.h, as
2126 required by Posix.
2127
2128 * doc.c (get_doc_string): Improve the format passed to `error'.
2129
2130 * doprnt.c (doprnt): Improve commentary.
2131
2132 * term.c (init_tty) [MSDOS]: Fix 1st argument to maybe_fatal.
2133
2134 * Makefile.in (TAGS): Depend on $(M_FILE) and $(S_FILE), and scan
2135 them with etags.
2136
2137 * makefile.w32-in (globals.h): Add a dummy recipe, to make any
2138 changes in globals.h immediately force recompilation.
2139 (TAGS): Depend on $(CURDIR)/m/intel386.h and
2140 $(CURDIR)/s/ms-w32.h.
2141 (TAGS-gmake): Scan $(CURDIR)/m/intel386.h and $(CURDIR)/s/ms-w32.h.
2142
2143 * character.c (Fchar_direction): Function deleted.
2144 (syms_of_character): Don't defsubr it.
2145 <char-direction-table>: Deleted.
2146
2147 2011-04-23 Eli Zaretskii <eliz@gnu.org>
2148
2149 Fix doprnt so it could be used again safely in `verror'. (Bug#8435)
2150 * doprnt.c: Include limits.h.
2151 (SIZE_MAX): New macro.
2152 (doprnt): Return a size_t value. 2nd arg is now size_t.
2153 Many local variables are now size_t instead of int or unsigned.
2154 Improve overflow protection. Support `l' modifier for integer
2155 conversions. Support %l conversion. Don't assume an EMACS_INT
2156 argument for integer conversions and for %c.
2157
2158 * lisp.h (doprnt): Restore prototype.
2159
2160 * makefile.w32-in ($(BLD)/callint.$(O)): Depend on
2161 $(SRC)/character.h.
2162
2163 * Makefile.in (base_obj): Add back doprnt.o.
2164
2165 * deps.mk (doprnt.o): Add back prerequisites.
2166 (callint.o): Depend on character.h.
2167
2168 * eval.c (internal_lisp_condition_case): Include the handler
2169 representation in the error message.
2170 (verror): Call doprnt instead of vsnprintf. Fix an off-by-one bug
2171 when breaking from the loop.
2172
2173 * xdisp.c (vmessage): Call doprnt instead of vsnprintf.
2174
2175 * callint.c (Fcall_interactively): When displaying error message
2176 about invalid control letter, pass the character's codepoint, not
2177 a pointer to its multibyte form. Improve display of the character
2178 in octal and display also its hex code.
2179
2180 * character.c (char_string): Use %x to display the (unsigned)
2181 codepoint of an invalid character, to avoid displaying a bogus
2182 negative value.
2183
2184 * font.c (check_otf_features): Pass SDATA of SYMBOL_NAME to
2185 `error', not SYMBOL_NAME itself.
2186
2187 * coding.c (Fencode_sjis_char, Fencode_big5_char): Use %c for
2188 character arguments to `error'.
2189
2190 * charset.c (check_iso_charset_parameter): Fix incorrect argument
2191 to `error' in error message about FINAL_CHAR argument. Make sure
2192 FINAL_CHAR is a character, and use %c when it is passed as
2193 argument to `error'.
2194
2195 2011-04-23 Eli Zaretskii <eliz@gnu.org>
2196
2197 * s/ms-w32.h (localtime): Redirect to sys_localtime.
2198
2199 * w32.c: Include <time.h>.
2200 (sys_localtime): New function.
2201
2202 2011-04-23 Chong Yidong <cyd@stupidchicken.com>
2203
2204 * xdisp.c (init_xdisp): Initialize echo_area_window (Bug#6451).
2205
2206 * buffer.c (syms_of_buffer): Doc fix (Bug#6902).
2207
2208 2011-04-23 Samuel Thibault <sthibault@debian.org> (tiny change)
2209
2210 * sysdep.c (wait_for_termination): On GNU Hurd, kill returns -1 on
2211 zombies (Bug#8467).
2212
2213 2011-04-19 Eli Zaretskii <eliz@gnu.org>
2214
2215 * syntax.h (SETUP_SYNTAX_TABLE_FOR_OBJECT): Fix setting of
2216 gl_state.e_property when gl_state.object is Qt.
2217
2218 * insdel.c (make_gap_larger): Remove limitation of buffer size
2219 to <= INT_MAX.
2220
2221 2011-04-18 Chong Yidong <cyd@stupidchicken.com>
2222
2223 * xdisp.c (lookup_glyphless_char_display)
2224 (produce_glyphless_glyph): Handle cons cell entry in
2225 glyphless-char-display.
2226 (Vglyphless_char_display): Document it.
2227
2228 * term.c (produce_glyphless_glyph): Handle cons cell entry in
2229 glyphless-char-display.
2230
2231 2011-04-17 Chong Yidong <cyd@stupidchicken.com>
2232
2233 * xdisp.c (get_next_display_element): Remove unnecessary ifdefs.
2234
2235 * termhooks.h (FRAME_WINDOW_P): Remove duplicated definitions.
2236
2237 * dispextern.h (FACE_SUITABLE_FOR_ASCII_CHAR_P): Add missing
2238 definition for no-X builds.
2239
2240 2011-04-16 Paul Eggert <eggert@cs.ucla.edu>
2241
2242 Static checks with GCC 4.6.0 and non-default toolkits.
2243
2244 * s/sol2-6.h, s/unixware.h (PTY_TTY_NAME_SPRINTF): Protoize decl.
2245
2246 * process.c (keyboard_bit_set): Define only if SIGIO.
2247 (send_process_trap): Mark it with NO_RETURN if it doesn't return.
2248 (send_process): Repair possible setjmp clobbering.
2249
2250 * s/usg5-4-common.h (SETUP_SLAVE_PTY): Don't pass extra arg to 'fatal'.
2251
2252 * eval.c: Include <stdio.h>, for vsnprintf on non-GNU/Linux hosts.
2253
2254 * data.c (arith_error): Mark with NO_RETURN if it doesn't return.
2255
2256 * alloc.c (bytes_used_when_full, SPARE_MEMORY, BYTES_USED):
2257 Define only if needed.
2258
2259 * sysdep.c (_FILE_OFFSET_BITS): Make this hack even uglier
2260 by pacifying GCC about it. Maybe it's time to retire it?
2261 * xfaces.c (USG, __TIMEVAL__): Likewise.
2262
2263 * dispextern.h (struct redisplay_interface): Rename param
2264 to avoid shadowing.
2265 * termhooks.h (struct terminal): Likewise.
2266 * xterm.c (xembed_send_message): Likewise.
2267
2268 * insdel.c (make_gap_smaller): Define only if
2269 USE_MMAP_FOR_BUFFERS || REL_ALLOC || DOUG_LEA_MALLOC.
2270
2271 * keyboard.c (read_char): Make a var volatile so longjmp won't clobber
2272 it.
2273
2274 * emacs.c (MAX_HEAP_BSS_DIFF, my_edata): Move to where they're used,
2275 so that we aren't warned about unused symbols.
2276
2277 * xfns.c (Fx_file_dialog): Rename local to avoid shadowing.
2278
2279 * xdisp.c (x_produce_glyphs): Mark var as initialized (Bug#8512).
2280
2281 * xfns.c (x_real_positions): Mark locals as initialized.
2282
2283 * xmenu.c (xmenu_show): Don't use uninitialized vars.
2284
2285 * xterm.c: Fix problems found by static analysis with other toolkits.
2286 (toolkit_scroll_bar_interaction): Define and use only if USE_X_TOOLKIT.
2287 (x_dispatch_event): Declare static if USE_GTK, and
2288 define if USE_GTK || USE_X_TOOLKIT.
2289 (SET_SAVED_BUTTON_EVENT): Define only if USE_X_TOOLKIT || USE_GTK.
2290 * xterm.h (x_dispatch_event): Extern only if USE_X_TOOLKIT.
2291 * xterm.c, xterm.h (x_mouse_leave): Bring this function back, but only
2292 if defined HAVE_MENUS && !defined USE_X_TOOLKIT && !defined USE_GTK.
2293
2294 * xmenu.c (menu_help_callback): Pointer type fixes.
2295 Use const pointers when pointing at readonly data. Avoid pointer
2296 signedness clashes.
2297 (FALSE): Remove unused macro.
2298 (update_frame_menubar): Remove unused decl.
2299
2300 * xfns.c (Fx_hide_tip): Move locals to avoid shadowing.
2301
2302 * menu.c (push_submenu_start, push_submenu_end): Do not define unless
2303 USE_X_TOOLKIT || USE_GTK || HAVE_NS || defined HAVE_NTGUI.
2304 (single_menu_item): Rename local to avoid shadowing.
2305
2306 * keyboard.c (make_lispy_event): Remove unused local var.
2307
2308 * frame.c, frame.h (x_get_resource_string): Bring this back, but
2309 only if HAVE_X_WINDOWS && !USE_X_TOOLKIT.
2310
2311 * bitmaps: Change bitmaps from unsigned char back to the X11
2312 compatible char. Avoid the old compiler warnings about
2313 out-of-range initializers by using, for example, '\xab' rather
2314 than 0xab.
2315
2316 * xgselect.c (xgselect_initialize): Check vs interface
2317 even if ! (defined (USE_GTK) || defined (HAVE_GCONF)).
2318
2319 * xmenu.c (xmenu_show): Rename parm to avoid shadowing.
2320
2321 * xterm.c (x_create_toolkit_scroll_bar): Use const * for pointers
2322 to read-only memory.
2323
2324 * fns.c (vector): Remove; this old hack is no longer needed.
2325
2326 * xsmfns.c (create_client_leader_window): Rename shadowing arg.
2327 Remove unused var.
2328 (gdk_x11_set_sm_client_id) [!USE_GTK]: Don't define.
2329
2330 * xrdb.c (x_load_resources): Omit unused local.
2331
2332 * xfns.c (free_frame_menubar, atof): Remove duplicate decls.
2333 (x_window): Rename locals to avoid shadowing.
2334 (USG): Use the kludged USG macro, to pacify gcc.
2335
2336 * xterm.c (x_alloc_nearest_color_for_widget): Remove; unused.
2337 (x_term_init): Remove local to avoid shadowing.
2338
2339 * xfns.c, xterm.c (_XEditResCheckMessages): Protoize decl.
2340
2341 * xdisp.c, dispextern.h (set_vertical_scroll_bar): Now extern if
2342 USE_TOOLKIT_SCROLL_BARS && !USE_GTK, as xterm.c needs it then.
2343
2344 2011-04-16 Eli Zaretskii <eliz@gnu.org>
2345
2346 * gnutls.c (Fgnutls_boot): Don't pass Lisp_Object to `error'.
2347
2348 Fix regex.c, syntax.c and friends for buffers > 2GB.
2349 * syntax.h (struct gl_state_s): Declare character position members
2350 EMACS_INT.
2351
2352 * syntax.c (update_syntax_table): Declare 2nd argument EMACS_INT.
2353
2354 * textprop.c (verify_interval_modification, interval_of):
2355 Declare arguments EMACS_INT.
2356
2357 * intervals.c (adjust_intervals_for_insertion): Declare arguments
2358 EMACS_INT.
2359
2360 * intervals.h (CHECK_TOTAL_LENGTH): Cast to EMACS_INT, not `int'.
2361
2362 * indent.c (Fvertical_motion): Local variable it_start is now
2363 EMACS_INT.
2364
2365 * regex.c (re_match, re_match_2, re_match_2_internal)
2366 (bcmp_translate, regcomp, regexec, print_double_string)
2367 (group_in_compile_stack, re_search, re_search_2, regex_compile)
2368 (re_compile_pattern, re_exec): Declare arguments and local
2369 variables `size_t' and `ssize_t' and return values `regoff_t', as
2370 appropriate.
2371 (POP_FAILURE_REG_OR_COUNT) <pfreg>: Declare `long'.
2372 (CHECK_INFINITE_LOOP) <failure>: Declare `ssize_t'.
2373 <compile_stack_type>: `size' and `avail' are now `size_t'.
2374
2375 * regex.h <regoff_t>: Use ssize_t, not int.
2376 (re_search, re_search_2, re_match, re_match_2): Arguments that
2377 specify buffer/string position and length are now ssize_t and
2378 size_t. Return type is regoff_t.
2379
2380 2011-04-16 Ben Key <bkey76@gmail.com>
2381
2382 * nsfont.m: Fixed bugs in ns_get_family and
2383 ns_descriptor_to_entity that were caused by using free to
2384 deallocate memory blocks that were allocated by xmalloc (via
2385 xstrdup). This caused Emacs to crash when compiled with
2386 XMALLOC_OVERRUN_CHECK defined (when Emacs was configured with
2387 --enable-checking=xmallocoverrun). xfree is now used to
2388 deallocate these memory blocks.
2389
2390 2011-04-15 Paul Eggert <eggert@cs.ucla.edu>
2391
2392 * sysdep.c (emacs_read): Remove unnecessary check vs MAX_RW_COUNT.
2393
2394 emacs_write: Accept and return EMACS_INT for sizes.
2395 See http://lists.gnu.org/archive/html/emacs-devel/2011-04/msg00514.html
2396 et seq.
2397 * gnutls.c, gnutls.h (emacs_gnutls_read, emacs_gnutls_write):
2398 Accept and return EMACS_INT.
2399 (emacs_gnutls_write): Return the number of bytes written on
2400 partial writes.
2401 * sysdep.c, lisp.h (emacs_read, emacs_write): Likewise.
2402 (emacs_read, emacs_write): Remove check for negative size, as the
2403 Emacs source code has been audited now.
2404 * sysdep.c (MAX_RW_COUNT): New macro, to work around kernel bugs.
2405 (emacs_read, emacs_write): Use it.
2406 * process.c (send_process): Adjust to the new signatures of
2407 emacs_write and emacs_gnutls_write. Do not attempt to store
2408 a byte offset into an 'int'; it might overflow.
2409 See http://lists.gnu.org/archive/html/emacs-devel/2011-04/msg00483.html
2410
2411 * sound.c: Don't assume sizes fit in 'int'.
2412 (struct sound_device.period_size, alsa_period_size):
2413 Return EMACS_INT, not int.
2414 (struct sound_device.write, vox_write, alsa_write):
2415 Accept EMACS_INT, not int.
2416 (wav_play, au_play): Use EMACS_INT to store sizes and to
2417 record read return values.
2418
2419 2011-04-15 Ben Key <bkey76@gmail.com>
2420
2421 * keyboard.c (Qundefined): Don't declare static since it is used
2422 in nsfns.m.
2423 * xfaces.c (Qbold, Qexpanded, Qitalic, Qcondensed): Don't declare
2424 static since they are used in nsfont.m.
2425
2426 2011-04-15 Stefan Monnier <monnier@iro.umontreal.ca>
2427
2428 * process.c (Qprocessp): Don't declare static.
2429 * lisp.h (Qprocessp): Declare again.
2430
2431 2011-04-15 Juanma Barranquero <lekktu@gmail.com>
2432
2433 * font.c (Qopentype): Don't make static (used from w32uniscribe.c).
2434
2435 2011-04-14 Paul Eggert <eggert@cs.ucla.edu>
2436
2437 Improve C-level modularity by making more things 'static'.
2438
2439 Don't publish debugger-only interfaces to other modules.
2440 * lisp.h (safe_debug_print, debug_output_compilation_hack):
2441 (verify_bytepos, count_markers): Move decls to the only modules
2442 that need them.
2443 * region-cache.h (pp_cache): Likewise.
2444 * window.h (check_all_windows): Likewise.
2445 * marker.c, print.c, region-cache.c, window.c: Decls moved here.
2446
2447 * sysdep.c (croak): Now static, if
2448 defined TIOCNOTTY || defined USG5 || defined CYGWIN.
2449 * syssignal.h (croak): Declare only if not static.
2450
2451 * alloc.c (refill_memory_reserve): Now static if
2452 !defined REL_ALLOC || defined SYSTEM_MALLOC.
2453 * lisp.h (refill_memory_reserve): Declare only if not static.
2454
2455 * xsettings.c, xsettings.h (xsettings_get_system_normal_font):
2456 Define only if USE_LUCID.
2457
2458 * xrdb.c (x_customization_string, x_rm_string): Now static.
2459
2460 * xmenu.c (x_menu_wait_for_event): Export only if USE_MOTIF.
2461 * xterm.h (x_menu_wait_for_event): Declare only if USE_MOTIF.
2462
2463 * xdisp.c (draw_row_with_mouse_face): Now static.
2464 * dispextern.h (draw_row_with_mouse_fave): Remove decl.
2465
2466 * window.h (check_all_windows): Mark externally visible.
2467
2468 * window.c (window_deletion_count): Now static.
2469
2470 * undo.c: Make symbols static if they're not exported.
2471 (last_undo_buffer, last_boundary_position, pending_boundary):
2472 Now static.
2473
2474 * textprop.c (interval_insert_behind_hooks): Now static.
2475 (interval_insert_in_front_hooks): Likewise.
2476
2477 * term.c: Make symbols static if they're not exported.
2478 (tty_turn_off_highlight, get_tty_terminal, max_frame_cols):
2479 (max_frame_lines, tty_set_terminal_modes):
2480 (tty_reset_terminal_modes, tty_turn_off_highlight):
2481 (get_tty_terminal): Now static.
2482 (term_mouse_moveto): Do not define if HAVE_WINDOW_SYSTEM.
2483 * termhooks.h (term_mouse_moveto): Do not declare if
2484 HAVE_WINDOW_SYSTEM.
2485 * dispextern.h (tty_set_terminal_modes, tty_reset_terminal_modes):
2486 (tty_turn_off_highlight, get_tty_terminal): Remove decls.
2487
2488 * sysdep.c: Make symbols static if they're not exported.
2489 (emacs_get_tty, emacs_set_tty, old_fcntl_flags, old_fcntl_owner):
2490 Now static.
2491 (sigprocmask_set, full_mask): Remove; unused.
2492 (wait_debugging): Mark as visible.
2493 * syssignal.h (SIGFULLMASK, full_mask): Remove decls.
2494 * systty.h (emacs_get_tty, emacs_set_tty): Remove decls.
2495
2496 * syntax.c (syntax_temp): Define only if !__GNUC__.
2497
2498 * sound.c (current_sound_device, current_sound): Now static.
2499
2500 * search.c (searchbufs, searchbuf_head): Now static.
2501
2502 * scroll.c (scroll_cost): Remove; unused.
2503 * dispextern.h (scroll_cost): Remove decl.
2504
2505 * region-cache.h (pp_cache): Mark as externally visible.
2506
2507 * process.c: Make symbols static if they're not exported.
2508 (process_tick, update_tick, create_process, chan_process):
2509 (Vprocess_alist, proc_buffered_char, datagram_access):
2510 (fd_callback_data, send_process_frame, process_sent_to): Now static.
2511 (deactivate_process): Mark defn as static, as well as decl.
2512 * lisp.h (create_process): Remove decl.
2513 * process.h (chan_process, Vprocess_alist): Remove decls.
2514
2515 * print.c: Make symbols static if they're not exported.
2516 (print_depth, new_backquote_output, being_printed, print_buffer):
2517 (print_buffer_size, print_buffer_pos, print_buffer_pos_byte):
2518 (print_interval, print_number_index, initial_stderr_stream):
2519 Now static.
2520 * lisp.h (Fprinc): Remove decl.
2521 (debug_output_compilation_hack): Mark as externally visible.
2522
2523 * sysdep.c (croak): Move decl from here to syssignal.h.
2524 * syssignal.h (croak): Put it here, so the API can be checked when
2525 'croak' is called from dissociate_if_controlling_tty.
2526
2527 * minibuf.c: Make symbols static if they're not exported.
2528 (minibuf_save_list, choose_minibuf_frame): Now static.
2529 * lisp.h (choose_minibuf_frame): Remove decl.
2530
2531 * lisp.h (verify_bytepos, count_markers): Mark as externally visible.
2532
2533 * lread.c: Make symbols static if they're not exported.
2534 (read_objects, initial_obarray, oblookup_last_bucket_number):
2535 Now static.
2536 (make_symbol): Remove; unused.
2537 * lisp.h (initial_obarray, make_symbol): Remove decls.
2538
2539 * keyboard.c: Make symbols static if they're not exported.
2540 (single_kboard, recent_keys_index, total_keys, recent_keys):
2541 (this_command_key_count_reset, raw_keybuf, raw_keybuf_count):
2542 (this_single_command_key_start, echoing, last_auto_save):
2543 (read_key_sequence_cmd, dribble, recursive_edit_unwind):
2544 (command_loop, echo_now, keyboard_init_hook, help_char_p):
2545 (quit_throw_to_read_char, command_loop_2, top_level_1, poll_timer):
2546 (Vlispy_mouse_stem, double_click_count):
2547 Now static.
2548 (force_auto_save_soon): Define only if SIGDANGER.
2549 (ignore_mouse_drag_p): Now static if
2550 !defined HAVE_WINDOW_SYSTEM || defined USE_GTK || defined HAVE_NS.
2551 (print_help): Remove; unused.
2552 (stop_character, last_timer_event): Mark as externally visible.
2553 * keyboard.h (ignore_mouse_drag_p): Declare only if
2554 defined HAVE_WINDOW_SYSTEM && !defined USE_GTK && !defined HAVE_NS.
2555 (echo_now, help_char_p, quit_throw_to_read_char): Remove decls.
2556 * lisp.h (echoing): Remove decl.
2557 (force_auto_save_soon): Declare only if SIGDANGER.
2558 * xdisp.c (redisplay_window): Simplify code, to make it more
2559 obvious that ignore_mouse_drag_p is not accessed if !defined
2560 USE_GTK && !defined HAVE_NS.
2561
2562 * intervals.c: Make symbols static if they're not exported.
2563 (merge_properties_sticky, merge_interval_right, delete_interval):
2564 Now static.
2565 * intervals.h (merge_interval_right, delete_interval): Remove decls.
2566
2567 * insdel.c: Make symbols static if they're not exported.
2568 However, leave prepare_to_modify_buffer alone. It's never
2569 called from outside this function, but that appears to be a bug.
2570 (combine_after_change_list, combine_after_change_buffer):
2571 (adjust_after_replace, signal_before_change): Now static.
2572 (adjust_after_replace_noundo): Remove; unused.
2573 * lisp.h (adjust_after_replace, adjust_after_replace_noundo):
2574 (signal_before_change): Remove decls.
2575
2576 * indent.c (val_compute_motion, val_vmotion): Now static.
2577
2578 * image.c: Make symbols static if they're not exported.
2579 * dispextern.h (x_create_bitmap_from_xpm_data): Do not declare
2580 if USE_GTK.
2581 * image.c (x_create_bitmap_from_xpm_data): Do not define if USE_GTK.
2582 (xpm_color_cache, ct_table, ct_colors_allocated): Now static.
2583
2584 * fringe.c (standard_bitmaps): Now static.
2585 (max_used_fringe_bitmap): Now static, unless HAVE_NS.
2586
2587 * frame.c: Make symbols static if they're not exported.
2588 (x_report_frame_params, make_terminal_frame): Now static.
2589 (get_frame_param): Now static, unless HAVE_NS.
2590 (x_fullscreen_adjust): Define if WINDOWSNT, not if HAVE_WINDOW_SYSTEM.
2591 (x_get_resource_string): Remove; not used.
2592 * frame.h (make_terminal_frame, x_report_frame_params):
2593 (x_get_resource_string); Remove decls.
2594 (x_fullscreen_adjust): Declare only if WINDOWSNT.
2595 * lisp.h (get_frame_param): Declare only if HAVE_NS.
2596
2597 * font.c, fontset.c: Make symbols static if they're not exported.
2598 * dispextern.h (FACE_SUITABLE_FOR_ASCII_CHAR_P): New macro.
2599 (FACE_SUITABLE_FOR_CHAR_P): Use it.
2600 * font.c (font_close_object): Now static.
2601 * font.h (font_close_object): Remove.
2602 * fontset.c (FONTSET_OBJLIST): Remove.
2603 (free_realized_fontset) #if-0 the body, which does nothing.
2604 (face_suitable_for_char_p): #if-0, as it's never called.
2605 * fontset.h (face_suitable_for_char_p): Remove decl.
2606 * xfaces.c (face_at_string_position):
2607 Use FACE_SUITABLE_FOR_ASCII_CHAR_P, not FACE_SUITABLE_FOR_CHAR_P,
2608 since 0 is always ASCII.
2609
2610 * fns.c (weak_hash_tables): Now static.
2611
2612 * fileio.c: Make symbols static if they're not exported.
2613 (auto_saving, auto_save_mode_bits, auto_save_error_occurred):
2614 (Vwrite_region_annotation_buffers): Now static.
2615
2616 * eval.c: Make symbols static if they're not exported.
2617 (backtrace_list, lisp_eval_depth, when_entered_debugger): Now static.
2618 * lisp.h (backtrace_list): Remove decl.
2619
2620 * emacs.c: Make symbols static if they're not exported.
2621 (malloc_state_ptr, malloc_using_checking, syms_of_emacs):
2622 (fatal_error_code, fatal_error_signal_hook, standard_args):
2623 Now static.
2624 (fatal_error_signal): Now static, unless FLOAT_CATCH_SIGKILL.
2625 (DEFINE_DUMMY_FUNCTION): Mark function as externally visible.
2626 (__CTOR_LIST__, __DTOR_LIST__): Now externally visible.
2627 * lisp.h (fatal_error_signal_hook): Remove decl.
2628 (fatal_error_signal): Declare only if FLOAT_CATCH_SIGKILL.
2629
2630 * editfns.c: Move a (normally-unused) function to its only use.
2631 * editfns.c, lisp.h (get_operating_system_release): Remove.
2632 * process.c (init_process) [DARWIN_OS]: Do it inline, as it is not
2633 worth the hassle of breaking this out.
2634
2635 * xterm.c: Make symbols static if they're not exported.
2636 (x_raise_frame, x_lower_frame, x_wm_set_window_state):
2637 (x_wm_set_icon_pixmap, x_initialize, XTread_socket_fake_io_error):
2638 (x_destroy_window, x_delete_display):
2639 Now static.
2640 (x_dispatch_event): Now static if ! (USE_MOTIF || USE_X_TOOLKIT).
2641 (x_mouse_leave): Remove; unused.
2642 * xterm.h (x_display_info_for_name, x_raise_frame, x_lower_frame):
2643 (x_destroy_window, x_wm_set_window_state, x_wm_set_icon_pixmap):
2644 (x_delete_display, x_initialize, x_set_border_pixel, x_screen_planes):
2645 Remove decls.
2646 (x_mouse_leave): Declare only if WINDOWSNT.
2647 (x_dispatch_event): Declare only if USE_MOTIF or USE_X_TOOLKIT.
2648 (xic_create_fontsetname): Declare only if HAVE_X_WINDOWS &&
2649 USE_X_TOOLKIT.
2650
2651 * ftxfont.c: Make symbols static if they're not exported.
2652 (ftxfont_driver): Export only if !defined HAVE_XFT && def8ined
2653 HAVE_FREETYPE.
2654 * font.h (ftxfont_driver): Likewise.
2655
2656 * xfns.c: Make symbols static if they're not exported.
2657 (x_last_font_name, x_display_info_for_name):
2658 (x_set_foreground_color, x_set_background_color, x_set_mouse_color):
2659 (x_set_cursor_color, x_set_border_pixel, x_set_border_color):
2660 (x_set_cursor_type, x_set_icon_type, x_set_icon_name):
2661 (x_set_scroll_bar_foreground, x_set_scroll_bar_background):
2662 (x_explicitly_set_name, x_set_title, xic_defaut_fontset, tip_timer):
2663 (last_show_tip_args): Now static.
2664 (xic_defaut_fontset, xic_create_fontsetname): Define only if
2665 defined HAVE_X_WINDOWS && defined USE_X_TOOLKIT
2666 (x_screen_planes): Remove; unused.
2667 * dispextern.h (x_screen_planes): Remove decl.
2668
2669 * dispnew.c: Make symbols static if they're not exported.
2670 * dispextern.h (redraw_garbaged_frames, scrolling):
2671 (increment_row_positions): Remove.
2672 * dispnew.c (new_glyph_matrix, increment_row_positions, scrolling):
2673 (delayed_size_change, glyph_matrix_count, glyph_pool_count):
2674 Now static.
2675 (redraw_garbaged_frames): Remove; unused.
2676
2677 * xfaces.c: Make symbols static if they're not exported.
2678 * dispextern.h (ascii_face_of_lisp_face, free_realized_face):
2679 Remove decls.
2680 * xterm.h (defined_color): Remove decls.
2681 (x_free_dpy_colors): Declare only if USE_X_TOOLKIT.
2682 * xfaces.c (tty_suppress_bold_inverse_default_colors_p):
2683 (menu_face_changed_default, defined_color, free_realized_face):
2684 (x_free_dpy_colors): Define only if USE_X_TOOLKIT.
2685 (ascii_face_of_lisp_face): Remove; unused.
2686
2687 * xdisp.c: Make symbols static if they're not exported.
2688 * dispextern.h (scratch_glyph_row, window_box_edges):
2689 (glyph_to_pixel_coords, set_cursor_from_row):
2690 (get_next_display_element, set_iterator_to_next):
2691 (highlight_trailing_whitespace, frame_to_window_pixel_xy):
2692 (show_mouse_face): Remove decls
2693 * frame.h (message_buf_print): Likewise.
2694 * lisp.h (pop_message, set_message, check_point_in_composition):
2695 Likewise.
2696 * xterm.h (set_vertical_scroll_bar): Likewise.
2697 * xdisp.c (list_of_error, Vmessage_stack, line_number_displayed):
2698 (message_buf_print, scratch_glyph_row, displayed_buffer):
2699 (set_iterator_to_next, pop_message, set_message, set_cursor_from_row):
2700 (get_next_display_element, show_mouse_face, window_box_edges):
2701 (frame_to_window_pixel_xy, check_point_in_composition):
2702 (set_vertical_scroll_bar, highlight_trailing_whitespace): Now static.
2703 (glyph_to_pixel_coords): Remove; unused.
2704
2705 * dired.c (file_name_completion): Now static.
2706
2707 * dbusbind.c (xd_in_read_queued_messages): Now static.
2708
2709 * lisp.h (circular_list_error, FOREACH): Remove; unused.
2710 * data.c (circular_list_error): Remove.
2711
2712 * commands.h (last_point_position, last_point_position_buffer):
2713 (last_point_position_window): Remove decls.
2714 * keyboard.c: Make these variables static.
2715
2716 * coding.h (coding, code_convert_region, encode_coding_gap):
2717 Remove decls.
2718 * coding.c (Vsjis_coding_system, Vbig5_coding_system):
2719 (iso_code_class, detect_coding, code_convert_region): Now static.
2720 (encode_coding_gap): Remove; unused.
2721
2722 * chartab.c (chartab_chars, chartab_bits): Now static.
2723
2724 * charset.h (charset_iso_8859_1): Remove decl.
2725 * charset.c (charset_iso_8859_1, charset_emacs, map_charset_for_dump):
2726 Now static.
2727
2728 * ccl.h (check_ccl_update, Vccl_program_table): Remove decls.
2729 * ccl.c (Vccl_program_table): Now static.
2730 (check_ccl_update): Remove; unused.
2731
2732 * category.c (SET_CATEGORY_SET, set_category_set): Move here.
2733 * category.h: ... from here.
2734 * category.c (check_category_table, set_category_set): Now static.
2735
2736 * casetab.c (Vascii_upcase_table, Vascii_eqv_table): Now static.
2737 * lisp.h: Remove these decls.
2738
2739 * buffer.c (buffer_count): Remove unused var.
2740
2741 * bidi.c (bidi_dump_cached_states): Mark as externally visible,
2742 so that it's not optimized away.
2743 (bidi_ignore_explicit_marks_for_paragraph_level): Likewise.
2744 * dispextern.h (bidi_dump_cached_states): Remove, since it's
2745 exported only to the debugger.
2746
2747 * atimer.c (alarm_signal_handler, run_all_atimers): Now static.
2748 * atimer.h (run_all_atimers): Remove; not exported.
2749
2750 font.c: Make copy_font_spec and merge_font_spec ordinary C functions.
2751 * font.c (copy_font_spec): Rename from Fcopy_font_spec, since it
2752 was inaccessible from Lisp.
2753 (merge_font_spec): Likewise, renaming from Fmerge_font_spec.
2754 * font.c, font.h, fontset.c, xfaces.c, xfont.c: Change all uses.
2755
2756 alloc.c: Import and export fewer symbols, and remove unused items.
2757 * lisp.h (suppress_checking, die): Declare only if ENABLE_CHECKING
2758 is defined.
2759 (suppress_checking): Add EXTERNALLY_VISIBLE attribute, so that
2760 it's not optimized away by whole-program optimization.
2761 (message_enable_multibyte, free_misc): Remove.
2762 (catchlist, handlerlist, mark_backtrace):
2763 Declare only if BYTE_MARK_STACK.
2764 (mark_byte_stack): Likewise, fixing a ifdef-vs-if typo.
2765 * alloc.c (pure): Export only if VIRT_ADDR_VARIES is defined.
2766 (message_enable_multibyte): Remove decl.
2767 (free_misc, interval_free_list, float_block, float_block_index):
2768 (n_float_blocks, float_free_list, cons_block, cons_block_index):
2769 (cons_free_list, last_marked_index):
2770 Now static.
2771 (suppress_checking, die): Define only if ENABLE_CHECKING is defined.
2772 * eval.c (catchlist, handlerlist): Export only if BYTE_MARK_STACK.
2773 (mark_backtrace): Define only if BYTE_MARK_STACK.
2774 * xdisp.c (message_enable_multibyte): Now static.
2775
2776 Declare Lisp_Object Q* variables to be 'static' if not exported.
2777 This makes it easier for human readers (and static analyzers)
2778 to see whether these variables are used from other modules.
2779 * alloc.c, buffer.c, bytecode.c, callint.c, casetab.c, category.c:
2780 * ccl.c, character.c, charset.c, cmds.c, coding.c, composite.c:
2781 * data.c, dbusbind.c, dired.c, editfns.c, eval.c, fileio.c, fns.c:
2782 * font.c, frame.c, fringe.c, ftfont.c, image.c, keyboard.c, keymap.c:
2783 * lread.c, macros.c, minibuf.c, print.c, process.c, search.c:
2784 * sound.c, syntax.c, textprop.c, window.c, xdisp.c, xfaces.c, xfns.c:
2785 * xmenu.c, xselect.c:
2786 Declare Q* vars static if they are not used in other modules.
2787 * ccl.h, character.h, charset.h, coding.h, composite.h, font.h:
2788 * frame.h, intervals.h, keyboard.h, lisp.h, process.h, syntax.h:
2789 Remove decls of unexported vars.
2790 * keyboard.h (EVENT_HEAD_UNMODIFIED): Remove now-unused macro.
2791
2792 * lisp.h (DEFINE_FUNC): Make sname 'static'.
2793
2794 Make Emacs functions such as Fatom 'static' by default.
2795 This makes it easier for human readers (and static analyzers)
2796 to see whether these functions can be called from other modules.
2797 DEFUN now defines a static function. To make the function external
2798 so that it can be used in other C modules, use the new macro DEFUE.
2799 * lisp.h (Funibyte_char_to_multibyte, Fsyntax_table_p):
2800 (Finit_image_library):
2801 (Feval_region, Fbacktrace, Ffetch_bytecode, Fswitch_to_buffer):
2802 (Ffile_executable_p, Fmake_symbolic_link, Fcommand_execute):
2803 (Fget_process, Fdocumentation_property, Fbyte_code, Ffile_attributes):
2804 Remove decls, since these functions are now static.
2805 (Funintern, Fget_internal_run_time): New decls, since these functions
2806 were already external.
2807
2808 * alloc.c, buffer.c, callint.c, callproc.c, casefiddle.c, casetab.c:
2809 * ccl.c, character.c, chartab.c, cmds.c, coding.c, data.c, dispnew.c:
2810 * doc.c, editfns.c, emacs.c, eval.c, fileio.c, filelock.c, floatfns.c:
2811 * fns.c, font.c, fontset.c, frame.c, image.c, indent.c:
2812 * keyboard.c, keymap.c, lread.c:
2813 * macros.c, marker.c, menu.c, minibuf.c, print.c, process.c, search.c:
2814 * syntax.c, term.c, terminal.c, textprop.c, undo.c:
2815 * window.c, xdisp.c, xfaces.c, xfns.c, xmenu.c, xsettings.c:
2816 Mark functions with DEFUE instead of DEFUN,
2817 if they are used in other modules.
2818 * buffer.c (Fset_buffer_major_mode, Fdelete_overlay): New forward
2819 decls for now-static functions.
2820 * buffer.h (Fdelete_overlay): Remove decl.
2821 * callproc.c (Fgetenv_internal): Mark as internal.
2822 * composite.c (Fremove_list_of_text_properties): Remove decl.
2823 (Fcomposition_get_gstring): New forward static decl.
2824 * composite.h (Fcomposite_get_gstring): Remove decl.
2825 * dired.c (Ffile_attributes): New forward static decl.
2826 * doc.c (Fdocumntation_property): New forward static decl.
2827 * eval.c (Ffetch_bytecode): New forward static decl.
2828 (Funintern): Remove extern decl; now in .h file where it belongs.
2829 * fileio.c (Fmake_symbolic_link): New forward static decl.
2830 * image.c (Finit_image_library): New forward static decl.
2831 * insdel.c (Fcombine_after_change_execute): Make forward decl static.
2832 * intervals.h (Fprevious_property_change):
2833 (Fremove_list_of_text_properties): Remove decls.
2834 * keyboard.c (Fthis_command_keys): Remove decl.
2835 (Fcommand_execute): New forward static decl.
2836 * keymap.c (Flookup_key): New forward static decl.
2837 (Fcopy_keymap): Now static.
2838 * keymap.h (Flookup_key): Remove decl.
2839 * process.c (Fget_process): New forward static decl.
2840 (Fprocess_datagram_address): Mark as internal.
2841 * syntax.c (Fsyntax_table_p): New forward static decl.
2842 (skip_chars): Remove duplicate decl.
2843 * textprop.c (Fprevious_property_change): New forward static decl.
2844 * window.c (Fset_window_fringes, Fset_window_scroll_bars):
2845 Now internal.
2846 (Fset_window_margins, Fset_window_vscroll): New forward static decls.
2847 * window.h (Fset_window_vscroll, Fset_window_margins): Remove decls.
2848
2849 * editfns.c (Fformat): Remove unreachable code.
2850
2851 2011-04-14 Andreas Schwab <schwab@linux-m68k.org>
2852
2853 * fileio.c (Finsert_file_contents): Fix typo in 2005-05-13
2854 change. (Bug#8496)
2855
2856 2011-04-13 Eli Zaretskii <eliz@gnu.org>
2857
2858 * xdisp.c (handle_invisible_prop): Don't call bidi_paragraph_init
2859 when at ZV. (Bug#8487)
2860
2861 2011-04-12 Andreas Schwab <schwab@linux-m68k.org>
2862
2863 * charset.c (Fclear_charset_maps): Use xfree instead of free.
2864 (Bug#8437)
2865 * keyboard.c (parse_tool_bar_item): Likewise.
2866 * sound.c (sound_cleanup, alsa_close): Likewise.
2867 * termcap.c (tgetent): Likewise.
2868 * xfns.c (x_default_font_parameter): Likewise.
2869 * xsettings.c (read_and_apply_settings): Likewise.
2870
2871 * alloc.c (overrun_check_malloc, overrun_check_realloc)
2872 (overrun_check_free): Protoize.
2873
2874 2011-04-12 Paul Eggert <eggert@cs.ucla.edu>
2875
2876 * sysdep.c (emacs_read, emacs_write): Check for negative sizes
2877 since callers should never pass a negative size.
2878 Change the signature to match that of plain 'read' and 'write'; see
2879 <http://lists.gnu.org/archive/html/emacs-devel/2011-04/msg00397.html>.
2880 * lisp.h: Update prototypes of emacs_write and emacs_read.
2881
2882 2011-04-11 Eli Zaretskii <eliz@gnu.org>
2883
2884 * xdisp.c (redisplay_window): Don't try to determine the character
2885 position of the scroll margin if the window start point w->startp
2886 is outside the buffer's accessible region. (Bug#8468)
2887
2888 2011-04-10 Eli Zaretskii <eliz@gnu.org>
2889
2890 Fix write-region and its subroutines for buffers > 2GB.
2891 * fileio.c (a_write, e_write): Modify declaration of arguments and
2892 local variables to support buffers larger than 2GB.
2893 (Fcopy_file): Use EMACS_INT for return value of emacs_read.
2894
2895 * sysdep.c (emacs_write, emacs_read): Use ssize_t for last
2896 argument, local variables, and return value.
2897
2898 * lisp.h: Update prototypes of emacs_write and emacs_read.
2899
2900 * sound.c (vox_write): Use ssize_t for return value of emacs_write.
2901
2902 2011-04-10 Paul Eggert <eggert@cs.ucla.edu>
2903
2904 * xdisp.c (vmessage): Use memchr, not strnlen, which some hosts lack.
2905
2906 Fix more problems found by GCC 4.6.0's static checks.
2907
2908 * xdisp.c (vmessage): Use a better test for character truncation.
2909
2910 * charset.c (load_charset_map): <, not <=, for optimization,
2911 and to avoid potential problems with integer overflow.
2912 * chartab.c (sub_char_table_set_range, char_table_set_range): Likewise.
2913 * casetab.c (set_identity, shuffle): Likewise.
2914 * editfns.c (Fformat): Likewise.
2915 * syntax.c (skip_chars): Likewise.
2916
2917 * xmenu.c (set_frame_menubar): Allocate smaller local vectors.
2918 This also lets GCC 4.6.0 generate slightly better loop code.
2919
2920 * callint.c (Fcall_interactively): <, not <=, for optimization.
2921 (Fcall_interactively): Count the number of arguments produced,
2922 not the number of arguments given. This is simpler and lets GCC
2923 4.6.0 generate slightly better code.
2924
2925 * ftfont.c: Distingish more carefully between FcChar8 and char.
2926 The previous code passed unsigned char * to a functions like
2927 strlen and xstrcasecmp that expect char *, which does not
2928 conform to the C standard.
2929 (get_adstyle_property, ftfont_pattern_entity): Use FcChar8 for
2930 arguments to FcPatternGetString, and explicitly cast FcChar8 * to
2931 char * when the C standard requires it.
2932
2933 * keyboard.c (read_char): Remove unused var.
2934
2935 * eval.c: Port to Windows vsnprintf (Bug#8435).
2936 Include <limits.h>.
2937 (SIZE_MAX): Define if the headers do not.
2938 (verror): Do not give up if vsnprintf returns a negative count.
2939 Instead, grow the buffer. This ports to Windows vsnprintf, which
2940 does not conform to C99. Problem reported by Eli Zaretskii.
2941 Also, simplify the allocation scheme, by avoiding the need for
2942 calling realloc, and removing the ALLOCATED variable.
2943
2944 * eval.c (verror): Initial buffer size is 4000 (not 200) bytes.
2945
2946 Remove invocations of doprnt, as Emacs now uses vsnprintf.
2947 But keep the doprint source code for now, as we might revamp it
2948 and use it again (Bug#8435).
2949 * lisp.h (doprnt): Remove.
2950 * Makefile.in (base_obj): Remove doprnt.o.
2951 * deps.mk (doprnt.o): Remove.
2952
2953 error: Print 32- and 64-bit integers portably (Bug#8435).
2954 Without this change, on typical 64-bit hosts error ("...%d...", N)
2955 was used to print both 32- and 64-bit integers N, which relied on
2956 undefined behavior.
2957 * lisp.h, src/m/amdx86-64.h, src/m/ia64.h, src/m/ibms390x.h (pEd):
2958 New macro.
2959 * lisp.h (error, verror): Mark as printf-like functions.
2960 * eval.c (verror): Use vsnprintf, not doprnt, to do the real work.
2961 Report overflow in size calculations when allocating printf buffer.
2962 Do not truncate output string at its first null byte.
2963 * xdisp.c (vmessage): Use vsnprintf, not doprnt, to do the real work.
2964 Truncate the output at a character boundary, since vsnprintf does not
2965 do that.
2966 * charset.c (check_iso_charset_parameter): Convert internal
2967 character to string before calling 'error', since %c now has the
2968 printf meaning.
2969 * coding.c (Fdecode_sjis_char, Fdecode_big5_char): Avoid int
2970 overflow when computing char to be passed to 'error'. Do not
2971 pass Lisp_Object to 'error'; pass the integer instead.
2972 * nsfns.m (Fns_do_applescript): Use int, not long, since it's
2973 formatted with plain %d.
2974
2975 * eval.c (internal_lisp_condition_case): Don't pass spurious arg.
2976
2977 * keyboard.c (access_keymap_keyremap): Print func name, not garbage.
2978
2979 * coding.c (Fdecode_sjis_char): Don't assume CODE fits in int.
2980
2981 * xterm.c (x_catch_errors): Remove duplicate declaration.
2982
2983 * term.c (maybe_fatal): Mark its 3rd arg as a printf format, too.
2984
2985 * xdisp.c, lisp.h (message_nolog): Remove; unused.
2986
2987 2011-04-10 Jim Meyering <meyering@redhat.com>
2988
2989 use ssize_t and size_t for read- and write-like emacs_gnutls_* functions
2990 * gnutls.c (emacs_gnutls_read): Adjust signature to be more read-like:
2991 return ssize_t not "int", and use size_t as the buffer length.
2992 (emacs_gnutls_write): Likewise, and make the buffer pointer "const".
2993 * gnutls.h: Update declarations.
2994 * process.c (read_process_output): Use ssize_t, to match.
2995 (send_process): Likewise.
2996
2997 2011-04-09 Chong Yidong <cyd@stupidchicken.com>
2998
2999 * image.c (Fimagemagick_types): Doc fix, and comment cleanup.
3000
3001 2011-04-09 Chong Yidong <cyd@stupidchicken.com>
3002
3003 * ftfont.c (get_adstyle_property, ftfont_pattern_entity):
3004 Use unsigned char, to match FcChar8 type definition.
3005
3006 * xterm.c (handle_one_xevent):
3007 * xmenu.c (create_and_show_popup_menu):
3008 * xselect.c (x_decline_selection_request)
3009 (x_reply_selection_request): Avoid type-punned deref of X events.
3010
3011 2011-04-09 Eli Zaretskii <eliz@gnu.org>
3012
3013 Fix some uses of `int' instead of EMACS_INT.
3014 * search.c (string_match_1, fast_string_match)
3015 (fast_c_string_match_ignore_case, fast_string_match_ignore_case)
3016 (scan_buffer, find_next_newline_no_quit)
3017 (find_before_next_newline, search_command, Freplace_match)
3018 (Fmatch_data): Make some `int' variables be EMACS_INT.
3019
3020 * xdisp.c (display_count_lines): 3rd argument and return value now
3021 EMACS_INT. All callers changed.
3022 (pint2hrstr): Last argument is now EMACS_INT.
3023
3024 * coding.c (detect_coding_utf_8, detect_coding_emacs_mule)
3025 (detect_coding_iso_2022, detect_coding_sjis, detect_coding_big5)
3026 (detect_coding_ccl, detect_coding_charset, decode_coding_utf_8)
3027 (decode_coding_utf_16, decode_coding_emacs_mule)
3028 (decode_coding_iso_2022, decode_coding_sjis, decode_coding_big5)
3029 (decode_coding_ccl, decode_coding_charset)
3030 <consumed_chars, consumed_chars_base>: Declare EMACS_INT.
3031 (decode_coding_iso_2022, decode_coding_emacs_mule)
3032 (decode_coding_sjis, decode_coding_big5, decode_coding_charset)
3033 <char_offset, last_offset>: Declare EMACS_INT.
3034 (encode_coding_utf_8, encode_coding_utf_16)
3035 (encode_coding_emacs_mule, encode_invocation_designation)
3036 (encode_designation_at_bol, encode_coding_iso_2022)
3037 (encode_coding_sjis, encode_coding_big5, encode_coding_ccl)
3038 (encode_coding_raw_text, encode_coding_charset) <produced_chars>:
3039 Declare EMACS_INT.
3040 (ASSURE_DESTINATION): Declare more_bytes EMACS_INT.
3041 (encode_invocation_designation): Last argument P_NCHARS is now
3042 EMACS_INT.
3043 (decode_eol): Declare pos_byte, pos, and pos_end EMACS_INT.
3044 (produce_chars): from_nchars and to_nchars are now EMACS_INT.
3045
3046 * coding.h (struct coding_system) <head_ascii>: Declare EMACS_INT.
3047 All users changed.
3048
3049 * ccl.c (Fccl_execute_on_string): Declare some variables
3050 EMACS_INT.
3051
3052 2011-04-08 Samuel Thibault <sthibault@debian.org> (tiny change)
3053
3054 * term.c (init_tty): Fix incorrect ifdef placement (Bug#8450).
3055
3056 2011-03-19 Christoph Scholtes <cschol2112@googlemail.com>
3057
3058 * process.c (Fformat_network_address): Doc fix.
3059
3060 2011-04-08 T.V. Raman <tv.raman.tv@gmail.com> (tiny change)
3061
3062 * xml.c (parse_region): Avoid creating spurious whiespace nodes.
3063
3064 2011-04-08 Chong Yidong <cyd@stupidchicken.com>
3065
3066 * keyboard.c (read_char): Call Lisp function help-form-show,
3067 instead of using internal_with_output_to_temp_buffer.
3068 (Qhelp_form_show): New var.
3069 (syms_of_keyboard): Use DEFSYM macro.
3070
3071 * print.c (internal_with_output_to_temp_buffer): Function deleted.
3072
3073 * lisp.h (internal_with_output_to_temp_buffer): Remove prototype.
3074
3075 2011-04-06 Chong Yidong <cyd@stupidchicken.com>
3076
3077 * process.c (Flist_processes): Remove to Lisp.
3078 (list_processes_1): Delete.
3079
3080 2011-04-06 Eli Zaretskii <eliz@gnu.org>
3081
3082 * msdos.c (careadlinkat, careadlinkatcwd): MS-DOS replacements.
3083
3084 * w32.c (careadlinkat, careadlinkatcwd): New always-fail stubs.
3085
3086 2011-04-06 Paul Eggert <eggert@cs.ucla.edu>
3087
3088 Fix more problems found by GCC 4.6.0's static checks.
3089
3090 * xmenu.c (Fx_popup_dialog): Don't assume string is free of formats.
3091
3092 * menu.c (Fx_popup_menu): Don't assume error_name lacks printf formats.
3093
3094 * lisp.h (message, message_nolog, fatal): Mark as printf-like.
3095
3096 * xdisp.c (vmessage): Mark as a printf-like function.
3097
3098 * term.c (vfatal, maybe_fatal): Mark as printf-like functions.
3099
3100 * sound.c (sound_warning): Don't crash if arg contains a printf format.
3101
3102 * image.c (tiff_error_handler, tiff_warning_handler): Mark as
3103 printf-like functions.
3104 (tiff_load): Add casts to remove these marks before passing them
3105 to system-supplied API.
3106
3107 * eval.c (Fsignal): Remove excess argument to 'fatal'.
3108
3109 * coding.c (EMIT_ONE_BYTE, EMIT_TWO_BYTES): Use unsigned, not int.
3110 This avoids several warnings with gcc -Wstrict-overflow.
3111 (DECODE_COMPOSITION_RULE): If the rule is invalid, goto invalid_code
3112 directly, rather than having caller test rule sign. This avoids
3113 some unnecessary tests.
3114 * composite.h (COMPOSITION_ENCODE_RULE_VALID): New macro.
3115 (COMPOSITION_ENCODE_RULE): Arguments now must be valid. This
3116 affects only one use, in DECODE_COMPOSITION_RULE, which is changed.
3117
3118 * xfont.c (xfont_text_extents): Remove var that was set but not used.
3119 (xfont_open): Avoid unnecessary tests.
3120
3121 * composite.c (composition_gstring_put_cache): Use unsigned integer.
3122
3123 * composite.h, composite.c (composition_gstring_put_cache):
3124 Use EMACS_INT, not int, for length.
3125
3126 * composite.h (COMPOSITION_DECODE_REFS): New macro,
3127 breaking out part of COMPOSITION_DECODE_RULE.
3128 (COMPOSITION_DECODE_RULE): Use it.
3129 * composite.c (get_composition_id): Remove unused local vars,
3130 by using the new macro.
3131
3132 * textprop.c (set_text_properties_1): Change while to do-while,
3133 since the condition is always true at first.
3134
3135 * intervals.c (graft_intervals_into_buffer): Mark var as used.
3136 (interval_deletion_adjustment): Return unsigned value.
3137 All uses changed.
3138
3139 * process.c (list_processes_1, create_pty, read_process_output):
3140 (exec_sentinel): Remove vars that were set but not used.
3141 (create_pty): Remove unnecessary "volatile"s.
3142 (Fnetwork_interface_info): Avoid possibility of int overflow.
3143 (read_process_output): Do adaptive read buffering even if carryover.
3144 (read_process_output): Simplify nbytes computation if buffered.
3145
3146 * bytecode.c (exec_byte_code): Rename local to avoid shadowing.
3147
3148 * syntax.c (scan_words): Remove var that was set but not used.
3149 (update_syntax_table): Use unsigned instead of int.
3150
3151 * lread.c (lisp_file_lexically_bound_p): Use ints rather than endptrs.
3152 (lisp_file_lexically_bound_p, read1): Use unsigned instead of int.
3153 (safe_to_load_p): Make the end-of-loop test the inverse of the in-loop.
3154
3155 * print.c (print_error_message): Avoid int overflow.
3156
3157 * font.c (font_list_entities): Redo for clarity,
3158 so that reader need not know FONT_DPI_INDEX + 1 == FONT_SPACING_INDEX.
3159
3160 * font.c (font_find_for_lface, Ffont_get_glyphs): Remove unused vars.
3161 (font_score): Avoid potential overflow in diff calculation.
3162
3163 * fns.c (substring_both): Remove var that is set but not used.
3164 (sxhash): Redo loop for clarity and to avoid wraparound warning.
3165
3166 * eval.c (funcall_lambda): Rename local to avoid shadowing.
3167
3168 * alloc.c (mark_object_loop_halt, mark_object): Use size_t, not int.
3169 Otherwise, GCC 4.6.0 optimizes the loop check away since the check
3170 can always succeed if overflow has undefined behavior.
3171
3172 * search.c (boyer_moore, wordify): Remove vars set but not used.
3173 (wordify): Omit three unnecessary tests.
3174
3175 * indent.c (MULTIBYTE_BYTES_WIDTH): Don't compute wide_column.
3176 All callers changed. This avoids the need for an unused var.
3177
3178 * casefiddle.c (casify_region): Remove var that is set but not used.
3179
3180 * dired.c (file_name_completion): Remove var that is set but not used.
3181
3182 * fileio.c (Finsert_file_contents): Make EOF condition clearer.
3183
3184 * fileio.c (Finsert_file_contents): Avoid signed integer overflow.
3185 (Finsert_file_contents): Remove unnecessary code checking fd.
3186
3187 * minibuf.c (read_minibuf_noninteractive): Use size_t for sizes.
3188 Check for integer overflow on size calculations.
3189
3190 * buffer.c (Fprevious_overlay_change): Remove var that is set
3191 but not used.
3192
3193 * keyboard.c (menu_bar_items, read_char_minibuf_menu_prompt):
3194 Remove vars that are set but not used.
3195 (timer_check_2): Don't assume timer-list and idle-timer-list are lists.
3196 (timer_check_2): Mark vars as initialized.
3197
3198 * gtkutil.c (xg_get_file_with_chooser): Mark var as initialized.
3199
3200 * image.c (lookup_image): Remove var that is set but not used.
3201 (xbm_load): Use parse_p, for gcc -Werror=unused-but-set-variable.
3202
3203 * fontset.c (Finternal_char_font, Ffontset_info): Remove vars
3204 that are set but not used.
3205
3206 * xfns.c (make_invisible_cursor): Don't return garbage
3207 if XCreateBitmapFromData fails (Bug#8410).
3208
3209 * xselect.c (x_get_local_selection, x_handle_property_notify):
3210 Remove vars that are set but not used.
3211
3212 * xfns.c (x_create_tip_frame): Remove var that is set but not used.
3213 (make_invisible_cursor): Initialize a possibly-uninitialized variable.
3214
3215 * xterm.c (x_scroll_bar_to_input_event) [!USE_GTK]:
3216 Remove var that is set but not used.
3217 (scroll_bar_windows_size): Now size_t, not int.
3218 (x_send_scroll_bar_event): Use size_t, not int, for sizes.
3219 Check for overflow.
3220
3221 * xfaces.c (realize_named_face): Remove vars that are set but not used.
3222 (map_tty_color) [!defined MSDOS]: Likewise.
3223
3224 * term.c (tty_write_glyphs): Use size_t; this avoids overflow warning.
3225
3226 * coding.c: Remove vars that are set but not used.
3227 (DECODE_COMPOSITION_RULE): Remove 2nd arg, which is unused.
3228 All callers changed.
3229 (decode_coding_utf_8, decode_coding_utf_16 decode_coding_emacs_mule):
3230 (decode_coding_iso_2022, encode_coding_sjis, encode_coding_big5):
3231 (decode_coding_charset): Remove vars that are set but not used.
3232
3233 * bytecode.c (Fbyte_code) [!defined BYTE_CODE_SAFE]: Remove var
3234 that is set but not used.
3235
3236 * print.c (print_object): Remove var that is set but not used.
3237
3238 Replace 2 copies of readlink code with 1 gnulib version (Bug#8401).
3239 The gnulib version avoids calling malloc in the usual case,
3240 and on 64-bit hosts doesn't have some arbitrary 32-bit limits.
3241 * fileio.c (Ffile_symlink_p): Use emacs_readlink.
3242 * filelock.c (current_lock_owner): Likewise.
3243 * lisp.h (READLINK_BUFSIZE, emacs_readlink): New function.
3244 * sysdep.c: Include allocator.h, careadlinkat.h.
3245 (emacs_no_realloc_allocator): New static constant.
3246 (emacs_readlink): New function.
3247 * deps.mk (sysdep.o): Depend on ../lib/allocator.h and on
3248 ../lib/careadlinkat.h.
3249
3250 2011-04-04 Stefan Monnier <monnier@iro.umontreal.ca>
3251
3252 * keyboard.c (safe_run_hook_funcall): Fix last change (don't stop at the
3253 first non-nil return value).
3254
3255 2011-04-03 Jan Djärv <jan.h.d@swipnet.se>
3256
3257 * nsterm.m (ns_update_auto_hide_menu_bar): Define MAC_OS_X_VERSION_10_6
3258 if not defined (Bug#8403).
3259
3260 2011-04-02 Juanma Barranquero <lekktu@gmail.com>
3261
3262 * xdisp.c (display_count_lines): Remove parameter `start',
3263 unused since 1998-01-01T02:27:27Z!rms@gnu.org. All callers changed.
3264 (get_char_face_and_encoding): Remove parameter `multibyte_p',
3265 unused since 2008-05-14T01:40:23Z!handa@m17n.org. All callers changed.
3266 (fill_stretch_glyph_string): Remove parameters `row' and `area',
3267 unused at least since Kim's GUI unification at 2003-03-16T20:45:46Z!storm@cua.dk
3268 and thereabouts. All callers changed.
3269 (get_per_char_metric): Remove parameter `f', unused since
3270 2008-05-14T01:40:23Z!handa@m17n.org. All callers changed.
3271
3272 2011-04-02 Jim Meyering <meyering@redhat.com>
3273
3274 do not dereference NULL upon failed strdup
3275 * nsfont.m (ns_descriptor_to_entity): Use xstrdup, not strdup.
3276 (ns_get_family): Likewise.
3277
3278 2011-04-02 Juanma Barranquero <lekktu@gmail.com>
3279
3280 * eval.c (unwind_to_catch) [DEBUG_GCPRO]: Remove redundant assignment.
3281
3282 2011-04-02 Jan Djärv <jan.h.d@swipnet.se>
3283
3284 * nsterm.m (ns_update_auto_hide_menu_bar): Only for OSX 10.6 or
3285 later (Bug#8403).
3286
3287 2011-04-01 Stefan Monnier <monnier@iro.umontreal.ca>
3288
3289 Add lexical binding.
3290
3291 * window.c (Ftemp_output_buffer_show): New fun.
3292 (Fsave_window_excursion):
3293 * print.c (Fwith_output_to_temp_buffer): Move to subr.el.
3294
3295 * lread.c (lisp_file_lexically_bound_p): New function.
3296 (Fload): Bind Qlexical_binding.
3297 (readevalloop): Remove `evalfun' arg.
3298 Bind Qinternal_interpreter_environment.
3299 (Feval_buffer): Bind Qlexical_binding.
3300 (defvar_int, defvar_bool, defvar_lisp_nopro, defvar_kboard):
3301 Mark as dynamic.
3302 (syms_of_lread): Declare `lexical-binding'.
3303
3304 * lisp.h (struct Lisp_Symbol): New field `declared_special'.
3305
3306 * keyboard.c (eval_dyn): New fun.
3307 (menu_item_eval_property): Use it.
3308
3309 * image.c (parse_image_spec): Use Ffunctionp.
3310
3311 * fns.c (concat, mapcar1): Accept byte-code-functions.
3312
3313 * eval.c (Fsetq): Handle lexical vars.
3314 (Fdefun, Fdefmacro, Ffunction): Make closures when needed.
3315 (Fdefconst, Fdefvaralias, Fdefvar): Mark as dynamic.
3316 (FletX, Flet): Obey lexical binding.
3317 (Fcommandp): Handle closures.
3318 (Feval): New `lexical' arg.
3319 (eval_sub): New function extracted from Feval. Use it almost
3320 everywhere where Feval was used. Look up vars in lexical env.
3321 Handle closures.
3322 (Ffunctionp): Move from subr.el.
3323 (Ffuncall): Handle closures.
3324 (apply_lambda): Remove `eval_flags'.
3325 (funcall_lambda): Handle closures and new byte-code-functions.
3326 (Fspecial_variable_p): New function.
3327 (syms_of_eval): Initialize the Vinternal_interpreter_environment var,
3328 but without exporting it to Lisp.
3329
3330 * doc.c (Fdocumentation, store_function_docstring):
3331 * data.c (Finteractive_form): Handle closures.
3332
3333 * callint.c (Fcall_interactively): Preserve lexical-binding mode for
3334 interactive spec.
3335
3336 * bytecode.c (Bstack_ref, Bstack_set, Bstack_set2, BdiscardN):
3337 New byte-codes.
3338 (exec_byte_code): New function extracted from Fbyte_code to handle new
3339 calling convention for byte-code-functions. Add new byte-codes.
3340
3341 * buffer.c (defvar_per_buffer): Set new `declared_special' field.
3342
3343 * alloc.c (Fmake_symbol): Init new `declared_special' field.
3344
3345 2011-03-31 Juanma Barranquero <lekktu@gmail.com>
3346
3347 * xdisp.c (redisplay_internal): Fix prototype.
3348
3349 2011-03-31 Eli Zaretskii <eliz@gnu.org>
3350
3351 * xdisp.c (SCROLL_LIMIT): New macro.
3352 (try_scrolling): Use it when setting scroll_limit.
3353 Limit scrolling to 100 screen lines.
3354 (redisplay_window): Even when falling back on "recentering",
3355 position point in the window according to scroll-conservatively,
3356 scroll-margin, and scroll-*-aggressively variables. (Bug#6671)
3357
3358 (try_scrolling): When point is above the window, allow searching
3359 as far as scroll_max, or one screenful, to compute vertical
3360 distance from PT to the scroll margin position. This prevents
3361 try_scrolling from unnecessarily failing when
3362 scroll-conservatively is set to a value slightly larger than the
3363 window height. Clean up the case of PT below the margin at bottom
3364 of window: scroll_max can no longer be INT_MAX. When aggressive
3365 scrolling is in use, don't let point enter the opposite scroll
3366 margin as result of the scroll.
3367 (syms_of_xdisp) <scroll-conservatively>: Document the
3368 threshold of 100 lines for never-recentering scrolling.
3369
3370 2011-03-31 Juanma Barranquero <lekktu@gmail.com>
3371
3372 * dispextern.h (move_it_by_lines):
3373 * xdisp.c (move_it_by_lines): Remove parameter `need_y_p', unused
3374 since 2000-12-29T14:24:09Z!gerd@gnu.org. All callers changed.
3375 (message_log_check_duplicate): Remove parameters `prev_bol' and
3376 `this_bol', unused since 1998-01-01T02:27:27Z!rms@gnu.org. All callers changed.
3377 (redisplay_internal): Remove parameter `preserve_echo_area',
3378 unused since 1999-07-21T21:43:52Z!gerd@gnu.org. All callers changed.
3379
3380 * indent.c (Fvertical_motion):
3381 * window.c (window_scroll_pixel_based, Frecenter):
3382 Don't pass `need_y_p' to `move_it_by_lines'.
3383
3384 2011-03-30 Stefan Monnier <monnier@iro.umontreal.ca>
3385
3386 * eval.c (struct backtrace): Don't cheat with negative numbers, but do
3387 steal a few bits to be more compact.
3388 (interactive_p, Fbacktrace, Fbacktrace_frame, mark_backtrace):
3389 Remove unneeded casts.
3390
3391 * bytecode.c (Fbyte_code): CAR and CDR can GC.
3392
3393 2011-03-30 Zachary Kanfer <zkanfer@gmail.com> (tiny change)
3394
3395 * keyboard.c (Fexecute_extended_command): Do log the "suggest key
3396 binding" message (bug#7967).
3397
3398 2011-03-30 Paul Eggert <eggert@cs.ucla.edu>
3399
3400 Fix more problems found by GCC 4.6.0's static checks.
3401
3402 * unexelf.c (unexec) [! (defined _SYSTYPE_SYSV || defined __sgi)]:
3403 Remove unused local var.
3404
3405 * editfns.c (Fmessage_box): Remove unused local var.
3406
3407 * xdisp.c (try_window_reusing_current_matrix, x_produce_glyphs):
3408 (note_mode_line_or_margin_highlight, note_mouse_highlight):
3409 Omit unused local vars.
3410 * window.c (shrink_windows): Omit unused local var.
3411 * menu.c (digest_single_submenu): Omit unused local var.
3412 * dispnew.c (update_window) [PERIODIC_PREEMPTION_CHECKING]:
3413 Omit unused local var.
3414
3415 * keyboard.c (parse_modifiers_uncached, parse_modifiers):
3416 Don't assume string length fits in int.
3417 (keyremap_step, read_key_sequence): Use size_t for sizes.
3418 (read_key_sequence): Don't check last_real_key_start redundantly.
3419
3420 * callproc.c (Fcall_process, Fcall_process_region): Use SAFE_ALLOCA
3421 instead of alloca (Bug#8344).
3422
3423 * eval.c (Fbacktrace): Don't assume nargs fits in int.
3424 (Fbacktrace_frame): Don't assume nframes fits in int.
3425
3426 * syntax.c (scan_sexps_forward): Avoid pointer wraparound.
3427
3428 * xterm.c (x_make_frame_visible, same_x_server): Redo to avoid overflow
3429 concerns.
3430
3431 * term.c (produce_glyphless_glyph): Remove unnecessary test.
3432
3433 * cm.c (calccost): Turn while-do into do-while, for clarity.
3434
3435 * keyboard.c (syms_of_keyboard): Use the same style as later
3436 in this function when indexing through an array. This also
3437 works around GCC bug 48267.
3438
3439 * image.c (tiff_load): Fix off-by-one image count (Bug#8336).
3440
3441 * xselect.c (x_check_property_data): Return correct size (Bug#8335).
3442
3443 * chartab.c (sub_char_table_ref_and_range): Redo for slight
3444 efficiency gain, and to bypass a gcc -Wstrict-overflow warning.
3445
3446 * keyboard.c, keyboard.h (num_input_events): Now size_t.
3447 This avoids undefined behavior on integer overflow, and is a bit
3448 more convenient anyway since it is compared to a size_t variable.
3449
3450 Variadic C functions now count arguments with size_t, not int.
3451 This avoids an unnecessary limitation on 64-bit machines, which
3452 caused (substring ...) to crash on large vectors (Bug#8344).
3453 * lisp.h (struct Lisp_Subr.function.aMANY): Now takes size_t, not int.
3454 (DEFUN_ARGS_MANY, internal_condition_case_n, safe_call): Likewise.
3455 All variadic functions and their callers changed accordingly.
3456 (struct gcpro.nvars): Now size_t, not int. All uses changed.
3457 * data.c (arith_driver, float_arith_driver): Likewise.
3458 * editfns.c (general_insert_function): Likewise.
3459 * eval.c (struct backtrace.nargs, interactive_p)
3460 (internal_condition_case_n, run_hook_with_args, apply_lambda)
3461 (funcall_lambda, mark_backtrace): Likewise.
3462 * fns.c (concat): Likewise.
3463 * frame.c (x_set_frame_parameters): Likewise.
3464 * fns.c (get_key_arg): Now accepts and returns size_t, and returns
3465 0 if not found, not -1. All callers changed.
3466
3467 * alloc.c (garbage_collect): Don't assume stack size fits in int.
3468 (stack_copy_size): Now size_t, not int.
3469 (stack_copy, stack_copy_size): Define only if MAX_SAVE_STACK > 0.
3470
3471 2011-03-28 Juanma Barranquero <lekktu@gmail.com>
3472
3473 * coding.c (encode_designation_at_bol): Remove parameter `charbuf_end',
3474 unused since 2002-03-01T01:17:24Z!handa@m17n.org and 2008-02-01T16:01:31Z!miles@gnu.org.
3475 All callers changed.
3476
3477 * lisp.h (multibyte_char_to_unibyte):
3478 * character.c (multibyte_char_to_unibyte): Remove parameter `rev_tbl',
3479 unused since 2002-03-01T01:16:34Z!handa@m17n.org and 2008-02-01T16:01:31Z!miles@gnu.org.
3480 * character.h (CHAR_TO_BYTE8):
3481 * cmds.c (internal_self_insert):
3482 * editfns.c (general_insert_function):
3483 * keymap.c (push_key_description):
3484 * search.c (Freplace_match):
3485 * xdisp.c (message_dolog, set_message_1): All callers changed.
3486
3487 2011-03-28 Stefan Monnier <monnier@iro.umontreal.ca>
3488
3489 * keyboard.c (safe_run_hook_funcall): New function.
3490 (safe_run_hooks_1, safe_run_hooks_error, safe_run_hooks): On error,
3491 don't set the hook to nil, but remove the offending function instead.
3492 (Qcommand_hook_internal): Remove, unused.
3493 (syms_of_keyboard): Don't initialize Qcommand_hook_internal nor define
3494 Vcommand_hook_internal.
3495
3496 * eval.c (enum run_hooks_condition): Remove.
3497 (funcall_nil, funcall_not): New functions.
3498 (run_hook_with_args): Call each function through a `funcall' argument.
3499 Remove `cond' argument, now redundant.
3500 (Frun_hooks, Frun_hook_with_args, Frun_hook_with_args_until_success)
3501 (Frun_hook_with_args_until_failure): Adjust accordingly.
3502 (run_hook_wrapped_funcall, Frun_hook_wrapped): New functions.
3503
3504 2011-03-28 Juanma Barranquero <lekktu@gmail.com>
3505
3506 * dispextern.h (string_buffer_position): Remove declaration.
3507
3508 * print.c (strout): Remove parameter `multibyte', unused since
3509 1999-08-21T19:30:21Z!gerd@gnu.org. All callers changed.
3510
3511 * search.c (boyer_moore): Remove parameters `len', `pos' and `lim',
3512 never used since function introduction in 1998-02-08T21:33:56Z!rms@gnu.org.
3513 All callers changed.
3514
3515 * w32.c (_wsa_errlist): Use braces for struct initializers.
3516
3517 * xdisp.c (string_buffer_position_lim): Remove parameter `w',
3518 never used since function introduction in 2001-03-09T18:41:50Z!gerd@gnu.org.
3519 All callers changed.
3520 (string_buffer_position): Likewise. Also, make static (it's never
3521 used outside xdisp.c).
3522 (cursor_row_p): Remove parameter `w', unused since
3523 2000-10-17T16:08:57Z!gerd@gnu.org. All callers changed.
3524 (decode_mode_spec): Remove parameter `precision', introduced during
3525 Gerd Moellmann's rewrite at 1999-07-21T21:43:52Z!gerd@gnu.org, but never used.
3526 All callers changed.
3527
3528 2011-03-27 Jan Djärv <jan.h.d@swipnet.se>
3529
3530 * nsterm.m (syms_of_nsterm): Use doc: for ns-auto-hide-menu-bar.
3531
3532 2011-03-27 Anders Lindgren <andlind@gmail.com>
3533
3534 * nsterm.m (ns_menu_bar_is_hidden): New variable.
3535 (ns_constrain_all_frames, ns_menu_bar_should_be_hidden)
3536 (ns_update_auto_hide_menu_bar): New functions.
3537 (ns_update_begin): Call ns_update_auto_hide_menu_bar.
3538 (applicationDidBecomeActive): Call ns_update_auto_hide_menu_bar and
3539 ns_constrain_all_frames.
3540 (constrainFrameRect): Return at once if ns_menu_bar_should_be_hidden.
3541 (syms_of_nsterm): DEFVAR ns-auto-hide-menu-bar, init to Qnil.
3542
3543 2011-03-27 Jan Djärv <jan.h.d@swipnet.se>
3544
3545 * nsmenu.m (runDialogAt): Remove argument to timer_check.
3546
3547 2011-03-27 Glenn Morris <rgm@gnu.org>
3548
3549 * syssignal.h: Replace RETSIGTYPE with void.
3550 * atimer.c, data.c, dispnew.c, emacs.c, floatfns.c, keyboard.c:
3551 * keyboard.h, lisp.h, process.c, sysdep.c, xterm.c:
3552 Replace SIGTYPE with void everywhere.
3553 * s/usg5-4-common.h (SIGTYPE): Remove definition.
3554 * s/template.h (SIGTYPE): Remove commented out definition.
3555
3556 2011-03-26 Eli Zaretskii <eliz@gnu.org>
3557
3558 * xdisp.c (redisplay_window): Don't check buffer's clip_changed
3559 flag as a prerequisite for invoking try_scrolling. (Bug#6671)
3560
3561 2011-03-26 Juanma Barranquero <lekktu@gmail.com>
3562
3563 * w32.c (read_unc_volume): Use parameter `henum', instead of
3564 global variable `wget_enum_handle'.
3565
3566 * keymap.c (describe_vector): Remove parameters `indices' and
3567 `char_table_depth', unused since 2002-03-01T01:43:26Z!handa@m17n.org.
3568 (describe_map, Fdescribe_vector): Adjust calls to `describe_vector'.
3569
3570 * keyboard.h (timer_check, show_help_echo): Remove unused parameters.
3571
3572 * keyboard.c (timer_check): Remove parameter `do_it_now',
3573 unused since 1996-04-12T06:01:29Z!rms@gnu.org.
3574 (show_help_echo): Remove parameter `ok_to_overwrite_keystroke_echo',
3575 unused since 2008-04-19T19:30:53Z!monnier@iro.umontreal.ca.
3576
3577 * keyboard.c (read_char):
3578 * w32menu.c (w32_menu_display_help):
3579 * xmenu.c (show_help_event, menu_help_callback):
3580 Adjust calls to `show_help_echo'.
3581
3582 * gtkutil.c (xg_maybe_add_timer):
3583 * keyboard.c (readable_events):
3584 * process.c (wait_reading_process_output):
3585 * xmenu.c (x_menu_wait_for_event): Adjust calls to `timer_check'.
3586
3587 * insdel.c (adjust_markers_gap_motion):
3588 Remove; no-op since 1998-01-02T21:29:48Z!rms@gnu.org.
3589 (gap_left, gap_right): Don't call it.
3590
3591 2011-03-25 Chong Yidong <cyd@stupidchicken.com>
3592
3593 * xdisp.c (handle_fontified_prop): Discard changes to clip_changed
3594 incurred during fontification.
3595
3596 2011-03-25 Juanma Barranquero <lekktu@gmail.com>
3597
3598 * buffer.c (defvar_per_buffer): Remove unused parameter `doc'.
3599 (DEFVAR_PER_BUFFER): Don't pass it.
3600
3601 * dispnew.c (row_equal_p, add_row_entry): Remove unused parameter `w'.
3602 (scrolling_window): Don't pass it.
3603
3604 2011-03-25 Juanma Barranquero <lekktu@gmail.com>
3605
3606 * dispextern.h (glyph_matric): Use #if GLYPH_DEBUG, not #ifdef.
3607
3608 * fileio.c (check_executable) [DOS_NT]: Remove unused variables `len'
3609 and `suffix'.
3610 (Fset_file_selinux_context) [HAVE_LIBSELINUX]: Move here declaration
3611 of variables specific to SELinux and computation of `encoded_absname'.
3612
3613 * image.c (XPutPixel): Remove unused variable `height'.
3614
3615 * keyboard.c (make_lispy_event): Remove unused variable `hpos'.
3616
3617 * unexw32.c (get_section_info): Remove unused variable `section'.
3618
3619 * w32.c (stat): Remove unused variables `drive_root' and `devtype'.
3620 (system_process_attributes): Remove unused variable `sess'.
3621 (sys_read): Remove unused variable `err'.
3622
3623 * w32fns.c (top): Wrap variables with #if GLYPH_DEBUG, not #ifdef.
3624 (w32_wnd_proc): Remove unused variable `isdead'.
3625 (unwind_create_frame): Use #if GLYPH_DEBUG, not #ifdef.
3626 (Fx_server_max_request_size): Remove unused variable `dpyinfo'.
3627 (x_create_tip_frame): Remove unused variable `tem'.
3628
3629 * w32inevt.c (w32_console_read_socket):
3630 Remove unused variable `no_events'.
3631
3632 * w32term.c (x_draw_composite_glyph_string_foreground):
3633 Remove unused variable `width'.
3634
3635 2011-03-24 Juanma Barranquero <lekktu@gmail.com>
3636
3637 * w32term.c (x_set_glyph_string_clipping):
3638 Don't pass uninitialized region to CombineRgn.
3639
3640 2011-03-23 Juanma Barranquero <lekktu@gmail.com>
3641
3642 * w32fns.c (x_set_menu_bar_lines): Remove unused variable `olines'.
3643 (w32_wnd_proc): Pass NULL to Windows API, not uninitialized buffer.
3644 (Fx_close_connection): Remove unused variable `i'.
3645
3646 * w32font.c (w32font_draw): Return number of glyphs.
3647 (w32font_open_internal): Remove unused variable `i'.
3648 (w32font_driver): Add missing initializer.
3649
3650 * w32menu.c (utf8to16): Remove unused variable `utf16'.
3651 (fill_in_menu): Remove unused variable `items_added'.
3652
3653 * w32term.c (last_mouse_press_frame): Remove static global variable.
3654 (w32_clip_to_row): Remove unused variable `f'.
3655 (x_delete_terminal): Remove unused variable `i'.
3656
3657 * w32uniscribe.c (uniscribe_shape): Remove unused variable `nclusters'.
3658 (NOTHING): Remove unused static global variable.
3659 (uniscribe_check_otf): Remove unused variable `table'.
3660 (uniscribe_font_driver): Add missing initializers.
3661
3662 2011-03-23 Julien Danjou <julien@danjou.info>
3663
3664 * term.c (Fsuspend_tty, Fresume_tty):
3665 * minibuf.c (read_minibuf, run_exit_minibuf_hook):
3666 * window.c (temp_output_buffer_show):
3667 * insdel.c (signal_before_change):
3668 * frame.c (Fhandle_switch_frame):
3669 * fileio.c (Fdo_auto_save):
3670 * emacs.c (Fkill_emacs):
3671 * editfns.c (save_excursion_restore):
3672 * cmds.c (internal_self_insert):
3673 * callint.c (Fcall_interactively):
3674 * buffer.c (Fkill_all_local_variables):
3675 * keyboard.c (Fcommand_execute, Fsuspend_emacs, safe_run_hooks_1):
3676 Use Frun_hooks.
3677 (command_loop_1): Use Frun_hooks. Call safe_run_hooks
3678 unconditionnaly since it does the check itself.
3679
3680 2011-03-23 Paul Eggert <eggert@cs.ucla.edu>
3681
3682 Fix more problems found by GCC 4.5.2's static checks.
3683
3684 * coding.c (encode_coding_raw_text): Avoid unnecessary test
3685 the first time through the loop, since we know p0 < p1 then.
3686 This also avoids a gcc -Wstrict-overflow warning.
3687
3688 * lisp.h (SAFE_ALLOCA, SAFE_ALLOCA_LISP): Avoid 'int' overflow
3689 leading to a memory leak, possible in functions like
3690 load_charset_map_from_file that can allocate an unbounded number
3691 of objects (Bug#8318).
3692
3693 * xmenu.c (set_frame_menubar): Use EMACS_UINT, not int, for indexes
3694 that could (at least in theory) be that large.
3695
3696 * xdisp.c (message_log_check_duplicate): Return unsigned long, not int.
3697 This is less likely to overflow, and avoids undefined behavior if
3698 overflow does occur. All callers changed. Use strtoul to scan
3699 for the unsigned long integer.
3700 (pint2hrstr): Simplify and tune code slightly.
3701 This also avoids a (bogus) GCC warning with gcc -Wstrict-overflow.
3702
3703 * scroll.c (do_scrolling): Work around GCC bug 48228.
3704 See <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48228>.
3705
3706 * frame.c (Fmodify_frame_parameters): Simplify loop counter.
3707 This also avoids a warning with gcc -Wstrict-overflow.
3708 (validate_x_resource_name): Simplify count usage.
3709 This also avoids a warning with gcc -Wstrict-overflow.
3710
3711 * fileio.c (Fcopy_file): Report error if fchown or fchmod
3712 fail (Bug#8306).
3713
3714 * emacs.c (Fdaemon_initialized): Do not ignore I/O errors (Bug#8303).
3715
3716 * process.c (Fmake_network_process): Use socklen_t, not int,
3717 where POSIX says socklen_t is required in portable programs.
3718 This fixes a porting bug on hosts like 64-bit HP-UX, where
3719 socklen_t is wider than int (Bug#8277).
3720 (Fmake_network_process, server_accept_connection):
3721 (wait_reading_process_output, read_process_output):
3722 Likewise.
3723
3724 * process.c: Rename or move locals to avoid shadowing.
3725 (list_processes_1, Fmake_network_process):
3726 (read_process_output_error_handler, exec_sentinel_error_handler):
3727 Rename or move locals.
3728 (Fmake_network_process): Define label "retry_connect" only if needed.
3729 (Fnetwork_interface_info): Fix pointer signedness.
3730 (process_send_signal): Add cast to avoid pointer signedness problem.
3731 (FIRST_PROC_DESC, IF_NON_BLOCKING_CONNECT): Remove unused macros.
3732 (create_process): Use 'volatile' to avoid vfork clobbering (Bug#8298).
3733
3734 Make tparam.h and terminfo.c consistent.
3735 * cm.c (tputs, tgoto, BC, UP): Remove extern decls.
3736 Include tparam.h instead, since it declares them.
3737 * cm.h (PC): Remove extern decl; tparam.h now does this.
3738 * deps.mk (cm.o, terminfo.o): Depend on tparam.h.
3739 * terminfo.c: Include tparam.h, to check interfaces.
3740 (tparm): Make 1st arg a const pointer in decl. Put it at top level.
3741 (tparam): Adjust signature to match interface in tparam.h;
3742 this removes some undefined behavior. Check that outstring and len
3743 are zero, which they always are with Emacs.
3744 * tparam.h (PC, BC, UP): New extern decls.
3745
3746 * xftfont.c (xftfont_shape): Now static, and defined only if needed.
3747 (xftfont_open): Rename locals to avoid shadowing.
3748
3749 * ftfont.c (ftfont_resolve_generic_family): Fix pointer signedness.
3750 (ftfont_otf_capability, ftfont_shape): Omit decls if not needed.
3751 (OTF_TAG_SYM): Omit macro if not needed.
3752 (ftfont_list): Remove unused local.
3753 (get_adstyle_property, ftfont_pattern_entity):
3754 (ftfont_lookup_cache, ftfont_open, ftfont_anchor_point):
3755 Rename locals to avoid shadowing.
3756
3757 * xfont.c (xfont_list_family): Mark var as initialized.
3758
3759 * xml.c (make_dom): Now static.
3760
3761 * composite.c (composition_compute_stop_pos): Rename local to
3762 avoid shadowing.
3763 (composition_reseat_it): Remove unused locals.
3764 (find_automatic_composition, composition_adjust_point): Likewise.
3765 (composition_update_it): Mark var as initialized.
3766 (find_automatic_composition): Mark vars as initialized,
3767 with a FIXME (Bug#8290).
3768
3769 character.h: Rename locals to avoid shadowing.
3770 * character.h (PREV_CHAR_BOUNDARY, FETCH_STRING_CHAR_ADVANCE):
3771 (FETCH_STRING_CHAR_AS_MULTIBYTE_ADVANCE, FETCH_CHAR_ADVANCE):
3772 (FETCH_CHAR_ADVANCE_NO_CHECK, INC_POS, DEC_POS, BUF_INC_POS):
3773 (BUF_DEC_POS): Be more systematic about renaming local temporaries
3774 to avoid shadowing.
3775
3776 * textprop.c (property_change_between_p): Remove; unused.
3777
3778 * intervals.c (interval_start_pos): Now static.
3779
3780 * intervals.h (CHECK_TOTAL_LENGTH): Avoid empty "else".
3781
3782 * atimer.c (start_atimer, append_atimer_lists, set_alarm):
3783 Rename locals to avoid shadowing.
3784
3785 * sound.c (wav_play, au_play, Fplay_sound_internal):
3786 Fix pointer signedness.
3787 (alsa_choose_format): Remove unused local var.
3788 (wav_play): Initialize a variable to 0, to prevent undefined
3789 behavior (Bug#8278).
3790
3791 * region-cache.c (insert_cache_boundary): Redo var to avoid shadowing.
3792
3793 * region-cache.h (pp_cache): New decl, for gcc -Wmissing-prototypes.
3794
3795 * callproc.c (Fcall_process): Use 'volatile' to avoid vfork
3796 clobbering (Bug#8298).
3797 * sysdep.c (sys_subshell): Likewise.
3798 Previously, the sys_subshell 'volatile' was incorrectly IF_LINTted out.
3799
3800 * lisp.h (child_setup): Now NO_RETURN unless DOS_NT.
3801 This should get cleaned up, so that child_setup has the
3802 same signature on all platforms.
3803
3804 * callproc.c (call_process_cleanup): Now static.
3805 (relocate_fd): Rename locals to avoid shadowing.
3806
3807 2011-03-22 Chong Yidong <cyd@stupidchicken.com>
3808
3809 * xterm.c (x_clear_frame): Remove XClearWindow call. This appears
3810 not to be necessary, and produces flickering.
3811
3812 2011-03-20 Glenn Morris <rgm@gnu.org>
3813
3814 * config.in: Remove file.
3815
3816 2011-03-20 Juanma Barranquero <lekktu@gmail.com>
3817
3818 * minibuf.c (Vcompleting_read_function): Don't declare, global variables
3819 are now in src/globals.h.
3820 (syms_of_minibuf): Remove spurious & from previous change.
3821
3822 2011-03-20 Leo <sdl.web@gmail.com>
3823
3824 * minibuf.c (completing-read-function): New variable.
3825 (completing-read-default): Rename from completing-read.
3826 (completing-read): Call completing-read-function.
3827
3828 2011-03-19 Juanma Barranquero <lekktu@gmail.com>
3829
3830 * xfaces.c (Fx_load_color_file):
3831 Read color file from absolute filename (bug#8250).
3832
3833 2011-03-19 Juanma Barranquero <lekktu@gmail.com>
3834
3835 * makefile.w32-in: Update dependencies.
3836
3837 2011-03-17 Eli Zaretskii <eliz@gnu.org>
3838
3839 * makefile.w32-in ($(BLD)/unexw32.$(O)): Depend on $(SRC)/unexec.h.
3840
3841 2011-03-17 Paul Eggert <eggert@cs.ucla.edu>
3842
3843 Fix more problems found by GCC 4.5.2's static checks.
3844
3845 * process.c (make_serial_process_unwind, send_process_trap):
3846 (sigchld_handler): Now static.
3847
3848 * process.c (allocate_pty): Let PTY_ITERATION declare iteration vars.
3849 That way, the code declares only the vars that it needs.
3850 * s/aix4-2.h (PTY_ITERATION): Declare iteration vars.
3851 * s/cygwin.h (PTY_ITERATION): Likewise.
3852 * s/darwin.h (PTY_ITERATION): Likewise.
3853 * s/gnu-linux.h (PTY_ITERATION): Likewise.
3854
3855 * s/irix6-5.h (PTY_OPEN): Declare stb, to loosen coupling.
3856 * process.c (allocate_pty): Don't declare stb unless it's needed.
3857
3858 * bytecode.c (MAYBE_GC): Rewrite so as not to use empty "else".
3859 (CONSTANTLIM): Remove; unused.
3860 (METER_CODE, Bscan_buffer, Bread_char, Bset_mark):
3861 Define only if needed.
3862
3863 * unexelf.c (unexec): Name an expression,
3864 to avoid gcc -Wbad-function-cast warning.
3865 Use a different way to cause a compilation error if anyone uses
3866 n rather than nn, a way that does not involve shadowing.
3867 (ELF_BSS_SECTION_NAME, OLD_PROGRAM_H): Remove; unused.
3868
3869 * deps.mk (unexalpha.o): Remove; unused.
3870
3871 New file unexec.h, the (simple) interface for unexec (Bug#8267).
3872 * unexec.h: New file.
3873 * deps.mk (emacs.o, unexaix.o, unexcw.o, unexcoff.o, unexelf.o):
3874 (unexhp9k800.o, unexmacosx.o, unexsol.o, unexw32.o):
3875 Depend on unexec.h.
3876 * emacs.c [!defined CANNOT_DUMP]: Include unexec.h.
3877 * unexaix.c, unexcoff.c, unexcw.c, unexelf.c, unexhp9k800.c:
3878 * unexmacosx.c, unexsol.c, unexw32.c: Include unexec.h.
3879 Change as necessary to match prototype in unexec.h.
3880
3881 * syntax.c (Fforward_comment, scan_lists): Rename locals to avoid
3882 shadowing.
3883 (back_comment, skip_chars): Mark vars as initialized.
3884
3885 * character.h (FETCH_STRING_CHAR_ADVANCE_NO_CHECK, BUF_INC_POS):
3886 Rename locals to avoid shadowing.
3887
3888 * lread.c (read1): Rewrite so as not to use empty "else".
3889 (Fload, readevalloop, read1): Rename locals to avoid shadowing.
3890
3891 * print.c (Fredirect_debugging_output): Fix pointer signedess.
3892
3893 * lisp.h (debug_output_compilation_hack): Add decl here, to avoid
3894 warning when compiling print.c.
3895
3896 * font.c (font_unparse_fcname): Abort in an "impossible" situation
3897 instead of using an uninitialized var.
3898 (font_sort_entities): Mark var as initialized.
3899
3900 * character.h (FETCH_CHAR_ADVANCE): Rename locals to avoid shadowing.
3901
3902 * font.c (font_unparse_xlfd): Don't mix pointers to variables with
3903 pointers to constants.
3904 (font_parse_fcname): Remove unused vars.
3905 (font_delete_unmatched): Now static.
3906 (font_get_spec): Remove; unused.
3907 (font_style_to_value, font_prop_validate_style, font_unparse_fcname):
3908 (font_update_drivers, Ffont_get_glyphs, font_add_log):
3909 Rename or move locals to avoid shadowing.
3910
3911 * fns.c (require_nesting_list, require_unwind): Now static.
3912 (Ffillarray): Rename locals to avoid shadowing.
3913
3914 * floatfns.c (domain_error2): Define only if needed.
3915 (Ffrexp, Fldexp): Rename locals to avoid shadowing.
3916
3917 * alloc.c (mark_backtrace): Move decl from here ...
3918 * lisp.h: ... to here, so that it can be checked.
3919
3920 * eval.c (call_debugger, do_debug_on_call, grow_specpdl): Now static.
3921 (Fdefvar): Rewrite so as not to use empty "else".
3922 (lisp_indirect_variable): Name an expression,
3923 to avoid gcc -Wbad-function-cast warning.
3924 (Fdefvar): Rename locals to avoid shadowing.
3925
3926 * callint.c (quotify_arg, quotify_args): Now static.
3927 (Fcall_interactively): Rename locals to avoid shadowing.
3928 Use const pointer when appropriate.
3929
3930 * lisp.h (get_system_name, get_operating_system_release):
3931 Move decls here, to check interfaces.
3932 * process.c (get_operating_system_release): Move decl to lisp.h.
3933 * xrdb.c (get_system_name): Likewise.
3934 * editfns.c (init_editfns, Fuser_login_name, Fuser_uid):
3935 (Fuser_real_uid, Fuser_full_name): Remove unnecessary casts,
3936 some of which prompt warnings from gcc -Wbad-function-cast.
3937 (Fformat_time_string, Fencode_time, Finsert_char):
3938 (Ftranslate_region_internal, Fformat):
3939 Rename or remove local vars to avoid shadowing.
3940 (Ftranslate_region_internal): Mark var as initialized.
3941
3942 * doc.c (Fdocumentation, Fsnarf_documentation): Move locals to
3943 avoid shadowing.
3944
3945 * lisp.h (eassert): Check that the argument compiles, even if
3946 ENABLE_CHECKING is not defined.
3947
3948 * data.c (Findirect_variable): Name an expression, to avoid
3949 gcc -Wbad-function-cast warning.
3950 (default_value, arithcompare, arith_driver, arith_error): Now static.
3951 (store_symval_forwarding): Rename local to avoid shadowing.
3952 (Fmake_variable_buffer_local, Fmake_local_variable):
3953 Mark variables as initialized.
3954 (do_blv_forwarding, do_symval_forwarding): Remove; unused.
3955
3956 * alloc.c (check_cons_list): Do not define unless GC_CHECK_CONS_LIST.
3957 (Fmake_vector, Fvector, Fmake_byte_code, Fgarbage_collect):
3958 Rename locals to avoid shadowing.
3959 (mark_stack): Move local variables into the #ifdef region where
3960 they're used.
3961 (BLOCK_INPUT_ALLOC, UNBLOCK_INPUT_ALLOC): Define only if
3962 ! defined SYSTEM_MALLOC && ! defined SYNC_INPUT, as they are not
3963 needed otherwise.
3964 (CHECK_ALLOCATED): Define only if GC_CHECK_MARKED_OBJECTS.
3965 (GC_STRING_CHARS): Remove; not used.
3966 (Fmemory_limit): Cast sbrk's returned value to char *.
3967
3968 * lisp.h (check_cons_list): Declare if GC_CHECK_CONS_LIST; this
3969 avoids undefined behavior in theory.
3970
3971 * regex.c (IF_LINT): Add defn, for benefit of ../lib-src.
3972
3973 Use functions, not macros, for up- and down-casing (Bug#8254).
3974 * buffer.h (DOWNCASE_TABLE, UPCASE_TABLE, DOWNCASE, UPPERCASEP):
3975 (NOCASEP, LOWERCASEP, UPCASE, UPCASE1): Remove. All callers changed
3976 to use the following functions instead of these macros.
3977 (downcase): Adjust to lack of DOWNCASE_TABLE. Return int, not
3978 EMACS_INT, since callers assume the returned value fits in int.
3979 (upcase1): Likewise, for UPCASE_TABLE.
3980 (uppercasep, lowercasep, upcase): New static inline functions.
3981 * editfns.c (Fchar_equal): Remove no-longer-needed workaround for
3982 the race-condition problem in the old DOWNCASE.
3983
3984 * regex.c (CHARSET_LOOKUP_RANGE_TABLE_RAW, POP_FAILURE_REG_OR_COUNT):
3985 Rename locals to avoid shadowing.
3986 (regex_compile, re_match_2_internal): Move locals to avoid shadowing.
3987 (regex_compile, re_search_2, re_match_2_internal):
3988 Remove unused local vars.
3989 (FREE_VAR): Rewrite so as not to use empty "else",
3990 which gcc can warn about.
3991 (regex_compile, re_match_2_internal): Mark locals as initialized.
3992 (RETALLOC_IF): Define only if needed.
3993 (WORDCHAR_P): Likewise. This one is never needed, but is used
3994 only in a comment talking about a compiler bug, so put inside
3995 the #if 0 of that comment.
3996 (CHARSET_LOOKUP_BITMAP, FAIL_STACK_FULL, RESET_FAIL_STACK):
3997 (PUSH_FAILURE_ELT, BUF_PUSH_3, STOP_ADDR_VSTRING):
3998 Remove; unused.
3999
4000 * search.c (boyer_moore): Rename locals to avoid shadowing.
4001 * character.h (FETCH_STRING_CHAR_AS_MULTIBYTE_ADVANCE):
4002 (PREV_CHAR_BOUNDARY): Likewise.
4003
4004 * search.c (simple_search): Remove unused var.
4005
4006 * dired.c (compile_pattern): Move decl from here ...
4007 * lisp.h: ... to here, so that it can be checked.
4008 (struct re_registers): New forward decl.
4009
4010 * character.h (INC_POS, DEC_POS): Rename locals to avoid shadowing.
4011
4012 * indent.c (MULTIBYTE_BYTES_WIDTH): New args bytes, width.
4013 All uses changed.
4014 (MULTIBYTE_BYTES_WIDTH, scan_for_column, compute_motion):
4015 Rename locals to avoid shadowing.
4016 (Fvertical_motion): Mark locals as initialized.
4017
4018 * casefiddle.c (casify_object, casify_region): Now static.
4019 (casify_region): Mark local as initialized.
4020
4021 * cmds.c (internal_self_insert): Rename local to avoid shadowing.
4022
4023 * lisp.h (GCPRO2_VAR, GCPRO3_VAR, GCPRO4_VAR, GCPRO5_VAR, GCPRO6_VAR):
4024 New macros, so that the caller can use some names other than
4025 gcpro1, gcpro2, etc.
4026 (GCPRO2, GCPRO3, GCPRO4, GCPRO5, GCPRO6): Reimplement in terms
4027 of the new macros.
4028 (GCPRO1_VAR, UNGCPRO_VAR): Change the meaning of the second
4029 argument, for consistency with GCPRO2_VAR, etc: it is now the
4030 prefix of the variable, not the variable itself. All uses
4031 changed.
4032 * dired.c (directory_files_internal, file_name_completion):
4033 Rename locals to avoid shadowing.
4034
4035 Fix a race condition diagnosed by gcc -Wsequence-point (Bug#8254).
4036 An expression of the form (DOWNCASE (x) == DOWNCASE (y)), found in
4037 dired.c's scmp function, had undefined behavior.
4038 * lisp.h (DOWNCASE_TABLE, UPCASE_TABLE, DOWNCASE, UPPERCASEP):
4039 (NOCASEP, LOWERCASEP, UPCASE, UPCASE1): Move from here ...
4040 * buffer.h: ... to here, because these macros use current_buffer,
4041 and the new implementation with inline functions needs to have
4042 current_buffer in scope now, rather than later when the macros
4043 are used.
4044 (downcase, upcase1): New static inline functions.
4045 (DOWNCASE, UPCASE1): Reimplement using these functions.
4046 This avoids undefined behavior in expressions like
4047 DOWNCASE (x) == DOWNCASE (y), which previously suffered
4048 from race conditions in accessing the global variables
4049 case_temp1 and case_temp2.
4050 * casetab.c (case_temp1, case_temp2): Remove; no longer needed.
4051 * lisp.h (case_temp1, case_temp2): Remove their decls.
4052 * character.h (ASCII_CHAR_P): Move from here ...
4053 * lisp.h: ... to here, so that the inline functions mentioned
4054 above can use them.
4055
4056 * dired.c (directory_files_internal_unwind): Now static.
4057
4058 * fileio.c (file_name_as_directory, directory_file_name):
4059 (barf_or_query_if_file_exists, auto_save_error, auto_save_1):
4060 Now static.
4061 (file_name_as_directory): Use const pointers when appropriate.
4062 (Fexpand_file_name): Likewise. In particular, newdir might
4063 point at constant storage, so make it a const pointer.
4064 (Fmake_directory_internal, Fread_file_name): Remove unused vars.
4065 (Ffile_selinux_context, Fset_file_selinux_context): Fix pointer
4066 signedness issues.
4067 (Fset_file_times, Finsert_file_contents, auto_save_error):
4068 Rename locals to avoid shadowing.
4069
4070 * minibuf.c (choose_minibuf_frame_1): Now static.
4071 (Ftry_completion, Fall_completions): Rename or remove locals
4072 to avoid shadowing.
4073
4074 * marker.c (bytepos_to_charpos): Remove; unused.
4075
4076 * lisp.h (verify_bytepos, count_markers): New decls,
4077 so that gcc does not warn that these functions aren't declared.
4078
4079 * insdel.c (check_markers, make_gap_larger, make_gap_smaller):
4080 (reset_var_on_error, Fcombine_after_change_execute_1): Now static.
4081 (CHECK_MARKERS): Redo to avoid gcc -Wempty-body diagnostic.
4082 (copy_text): Remove unused local var.
4083
4084 * filelock.c (within_one_second): Now static.
4085 (lock_file_1): Rename local to avoid shadowing.
4086
4087 * buffer.c (fix_overlays_before): Mark locals as initialized.
4088 (fix_start_end_in_overlays): Likewise. This function should be
4089 simplified by using pointers-to-pointers, but that's a different
4090 matter.
4091 (switch_to_buffer_1): Now static.
4092 (Fkill_buffer, record_buffer, Fbury_buffer, Fset_buffer_multibyte):
4093 (report_overlay_modification): Rename locals to avoid shadowing.
4094
4095 * sysdep.c (system_process_attributes): Rename vars to avoid shadowing.
4096 Fix pointer signedness issue.
4097 (sys_subshell): Mark local as volatile if checking for lint,
4098 to suppress a gcc -Wclobbered warning that does not seem to be right.
4099 (MAXPATHLEN): Define only if needed.
4100
4101 * process.c (serial_open, serial_configure): Move decls from here ...
4102 * systty.h: ... to here, so that they can be checked.
4103
4104 * fns.c (get_random, seed_random): Move extern decls from here ...
4105 * lisp.h: ... to here, so that they can be checked.
4106
4107 * sysdep.c (reset_io): Now static.
4108 (wait_for_termination_signal): Remove; unused.
4109
4110 * keymap.c (keymap_parent, keymap_memberp, map_keymap_internal):
4111 (copy_keymap_item, append_key, push_text_char_description):
4112 Now static.
4113 (Fwhere_is_internal): Don't test CONSP (sequences) unnecessarily.
4114 (DENSE_TABLE_SIZE): Remove; unused.
4115 (get_keymap, access_keymap, Fdefine_key, Fwhere_is_internal):
4116 (describe_map_tree):
4117 Rename locals to avoid shadowing.
4118
4119 * keyboard.c: Declare functions static if they are not used elsewhere.
4120 (echo_char, echo_dash, cmd_error, top_level_2):
4121 (poll_for_input, handle_async_input): Now static.
4122 (read_char, kbd_buffer_get_event, make_lispy_position):
4123 (make_lispy_event, make_lispy_movement, apply_modifiers):
4124 (decode_keyboard_code, tty_read_avail_input, menu_bar_items):
4125 (parse_tool_bar_item, read_key_sequence, Fread_key_sequence):
4126 (Fread_key_sequence_vector): Rename locals to avoid shadowing.
4127 (read_key_sequence, read_char): Mark locals as initialized.
4128 (Fexit_recursive_edit, Fabort_recursive_edit): Mark with NO_RETURN.
4129
4130 * keyboard.h (make_ctrl_char): New decl.
4131 (mark_kboards): Move decl here ...
4132 * alloc.c (mark_kboards): ... from here.
4133
4134 * lisp.h (force_auto_save_soon): New decl.
4135
4136 * emacs.c (init_cmdargs): Rename local to avoid shadowing.
4137 (DEFINE_DUMMY_FUNCTION): New macro.
4138 (__do_global_ctors, __do_global_ctors_aux, __do_global_dtors, __main):
4139 Use it.
4140 (main): Add casts to avoid warnings
4141 if GCC considers string literals to be constants.
4142
4143 * lisp.h (fatal_error_signal): Add decl, since it's exported.
4144
4145 * dbusbind.c: Pointer signedness fixes.
4146 (xd_signature, xd_append_arg, xd_initialize):
4147 (Fdbus_call_method, Fdbus_call_method_asynchronously):
4148 (Fdbus_method_return_internal, Fdbus_method_error_internal):
4149 (Fdbus_send_signal, xd_read_message_1, Fdbus_register_service):
4150 (Fdbus_register_signal): Use SSDATA when the context wants char *.
4151
4152 * dbusbind.c (Fdbus_init_bus): Add cast to avoid warning
4153 if GCC considers string literals to be constants.
4154 (Fdbus_register_service, Fdbus_register_method): Remove unused vars.
4155
4156 2011-03-16 Stefan Monnier <monnier@iro.umontreal.ca>
4157
4158 * print.c (PRINT_CIRCLE_CANDIDATE_P): New macro.
4159 (print_preprocess, print_object): New macro to fix last change.
4160
4161 * print.c (print_preprocess): Don't forget font objects.
4162
4163 2011-03-16 Juanma Barranquero <lekktu@gmail.com>
4164
4165 * emacs.c (USAGE3): Doc fixes.
4166
4167 2011-03-15 Andreas Schwab <schwab@linux-m68k.org>
4168
4169 * coding.c (detect_coding_iso_2022): Reorganize code to clarify
4170 structure.
4171
4172 2011-03-14 Juanma Barranquero <lekktu@gmail.com>
4173
4174 * lisp.h (VWindow_system, Qfile_name_history):
4175 * keyboard.h (lispy_function_keys) [WINDOWSNT]:
4176 * w32term.h (w32_system_caret_hwnd, w32_system_caret_height)
4177 (w32_system_caret_x, w32_system_caret_y): Declare extern.
4178
4179 * w32select.c: Don't #include "keyboard.h".
4180 (run_protected): Add extern declaration for waiting_for_input.
4181
4182 * w32.c (Qlocal, noninteractive1, inhibit_window_system):
4183 * w32console.c (detect_input_pending, read_input_pending)
4184 (encode_terminal_code):
4185 * w32fns.c (quit_char, lispy_function_keys, Qtooltip)
4186 (w32_system_caret_hwnd, w32_system_caret_height, w32_system_caret_x)
4187 (w32_system_caret_y, Qfile_name_history):
4188 * w32font.c (w32font_driver, QCantialias, QCotf, QClang):
4189 * w32inevt.c (reinvoke_input_signal, lispy_function_keys):
4190 * w32menu.c (Qmenu_bar, QCtoggle, QCradio, Qoverriding_local_map)
4191 (Qoverriding_terminal_local_map, Qmenu_bar_update_hook):
4192 * w32proc.c (Qlocal, report_file_error):
4193 * w32term.c (Vwindow_system, updating_frame):
4194 * w32uniscribe.c (initialized, uniscribe_font_driver):
4195 Remove unneeded extern declarations.
4196
4197 2011-03-14 Chong Yidong <cyd@stupidchicken.com>
4198
4199 * buffer.c (Fmake_indirect_buffer): Fix incorrect assertions.
4200
4201 2011-03-13 Chong Yidong <cyd@stupidchicken.com>
4202
4203 * buffer.h (BUF_BEGV, BUF_BEGV_BYTE, BUF_ZV, BUF_ZV_BYTE, BUF_PT)
4204 (BUF_PT_BYTE): Rewrite to handle indirect buffers (Bug#8219).
4205 These macros can no longer be used for assignment.
4206
4207 * buffer.c (Fget_buffer_create, Fmake_indirect_buffer):
4208 Assign struct members directly, instead of using BUF_BEGV etc.
4209 (record_buffer_markers, fetch_buffer_markers): New functions for
4210 recording and fetching special buffer markers.
4211 (set_buffer_internal_1, set_buffer_temp): Use them.
4212
4213 * lread.c (unreadchar): Use SET_BUF_PT_BOTH.
4214
4215 * insdel.c (adjust_point): Use SET_BUF_PT_BOTH.
4216
4217 * intervals.c (temp_set_point_both): Use SET_BUF_PT_BOTH.
4218 (get_local_map): Use SET_BUF_BEGV_BOTH and SET_BUF_ZV_BOTH.
4219
4220 * xdisp.c (hscroll_window_tree):
4221 (reconsider_clip_changes): Use PT instead of BUF_PT.
4222
4223 2011-03-13 Eli Zaretskii <eliz@gnu.org>
4224
4225 * makefile.w32-in ($(BLD)/editfns.$(O)): Depend on
4226 $(EMACS_ROOT)/lib/intprops.h.
4227
4228 2011-03-13 Paul Eggert <eggert@cs.ucla.edu>
4229
4230 Fix more problems found by GCC 4.5.2's static checks.
4231
4232 * gtkutil.c (xg_get_pixbuf_from_pixmap): Add cast from char *
4233 to unsigned char * to avoid compiler diagnostic.
4234 (xg_free_frame_widgets): Make it clear that a local variable is
4235 needed only if USE_GTK_TOOLTIP.
4236 (gdk_window_get_screen): Make it clear that this macro is needed
4237 only if USE_GTK_TOOLTIP.
4238 (int_gtk_range_get_value): New function, which avoids a diagnostic
4239 from gcc -Wbad-function-cast.
4240 (xg_set_toolkit_scroll_bar_thumb): Use it.
4241 (xg_tool_bar_callback, xg_tool_item_stale_p): Rewrite to avoid
4242 diagnostic from gcc -Wbad-function-cast.
4243 (get_utf8_string, xg_get_file_with_chooser):
4244 Rename locals to avoid shadowing.
4245 (create_dialog): Move locals to avoid shadowing.
4246
4247 * xgselect.c (xg_select): Remove unused var.
4248
4249 * image.c (four_corners_best): Mark locals as initialized.
4250 (gif_load): Initialize transparent_p to zero (Bug#8238).
4251 Mark another local as initialized.
4252 (my_png_error, my_error_exit): Mark with NO_RETURN.
4253
4254 * image.c (clear_image_cache): Now static.
4255 (DIM, HAVE_STDLIB_H_1): Remove unused macros.
4256 (xpm_load): Redo to avoid "discards qualifiers" gcc warning.
4257 (x_edge_detection): Remove unnecessary cast that
4258 gcc -Wbad-function-cast diagnoses.
4259 (gif_load): Fix pointer signedness.
4260 (clear_image_cache, xbm_read_bitmap_data, x_detect_edges):
4261 (jpeg_load, gif_load): Rename locals to avoid shadowing.
4262
4263 2011-03-12 Paul Eggert <eggert@cs.ucla.edu>
4264
4265 Improve quality of tests for time stamp overflow.
4266 For example, without this patch (encode-time 0 0 0 1 1
4267 1152921504606846976) returns the obviously-bogus value (-948597
4268 62170) on my RHEL 5.5 x86-64 host. With the patch, it correctly
4269 reports time overflow. See
4270 <http://lists.gnu.org/archive/html/emacs-devel/2011-03/msg00470.html>.
4271 * deps.mk (editfns.o): Depend on ../lib/intprops.h.
4272 * editfns.c: Include limits.h and intprops.h.
4273 (TIME_T_MIN, TIME_T_MAX): New macros.
4274 (time_overflow): Move earlier, to before first use.
4275 (hi_time, lo_time): New functions, for an accurate test for
4276 out-of-range times.
4277 (Fcurrent_time, Fget_internal_run_time, make_time): Use them.
4278 (Fget_internal_run_time): Don't assume time_t fits in int.
4279 (make_time): Use list2 instead of Fcons twice.
4280 (Fdecode_time): More accurate test for out-of-range times.
4281 (check_tm_member): New function.
4282 (Fencode_time): Use it, to test for out-of-range times.
4283 (lisp_time_argument): Don't rely on undefined left-shift and
4284 right-shift behavior when checking for time stamp overflow.
4285
4286 * editfns.c (time_overflow): New function, refactoring common code.
4287 (Fformat_time_string, Fdecode_time, Fencode_time):
4288 (Fcurrent_time_string): Use it.
4289
4290 Move 'make_time' to be next to its inverse 'lisp_time_argument'.
4291 * dired.c (make_time): Move to ...
4292 * editfns.c (make_time): ... here.
4293 * systime.h: Note the move.
4294
4295 2011-03-12 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
4296
4297 * fringe.c (update_window_fringes): Remove unused variables.
4298
4299 * unexmacosx.c (copy_data_segment): Also copy __got section.
4300 (Bug#8223)
4301
4302 2011-03-12 Eli Zaretskii <eliz@gnu.org>
4303
4304 * termcap.c [MSDOS]: Include "msdos.h".
4305 (find_capability, tgetnum, tgetflag, tgetstr, tputs, tgetent):
4306 Constify `char *' arguments and their references according to
4307 prototypes in tparam.h.
4308
4309 * deps.mk (termcap.o): Depend on tparam.h and msdos.h.
4310
4311 * msdos.c (XMenuAddPane): 3rd argument is `const char *' now.
4312 Adapt all references accordingly.
4313
4314 * msdos.h (XMenuAddPane): 3rd argument is `const char *' now.
4315
4316 2011-03-11 Tom Tromey <tromey@redhat.com>
4317
4318 * buffer.c (syms_of_buffer): Remove obsolete comment.
4319
4320 2011-03-11 Eli Zaretskii <eliz@gnu.org>
4321
4322 * termhooks.h (encode_terminal_code): Declare prototype.
4323
4324 * msdos.c (encode_terminal_code): Don't declare prototype.
4325
4326 * term.c (encode_terminal_code): Now external again, used by
4327 w32console.c and msdos.c.
4328
4329 * makefile.w32-in ($(BLD)/term.$(O), ($(BLD)/tparam.$(O)):
4330 Depend on $(SRC)/tparam.h, see 2011-03-11T07:24:21Z!eggert@cs.ucla.edu.
4331
4332 2011-03-11 Paul Eggert <eggert@cs.ucla.edu>
4333
4334 Fix some minor problems found by GCC 4.5.2's static checks.
4335
4336 * fringe.c (update_window_fringes): Mark locals as initialized
4337 (Bug#8227).
4338 (destroy_fringe_bitmap, init_fringe_bitmap): Now static.
4339
4340 * alloc.c (mark_fringe_data): Move decl from here ...
4341 * lisp.h (mark_fringe_data) [HAVE_WINDOW_SYSTEM]: ... to here,
4342 to check its interface.
4343 (init_fringe_once): Do not declare unless HAVE_WINDOW_SYSTEM.
4344
4345 * fontset.c (free_realized_fontset): Now static.
4346 (Fset_fontset_font): Rename local to avoid shadowing.
4347 (fontset_font): Mark local as initialized.
4348 (FONTSET_SPEC, FONTSET_REPERTORY, RFONT_DEF_REPERTORY): Remove; unused.
4349
4350 * xrdb.c: Include "xterm.h", to check x_load_resources's interface.
4351
4352 * xselect.c (x_disown_buffer_selections): Remove; not used.
4353 (TRACE3) [!defined TRACE_SELECTION]: Remove; not used.
4354 (x_own_selection, Fx_disown_selection_internal): Rename locals
4355 to avoid shadowing.
4356 (x_handle_dnd_message): Remove local to avoid shadowing.
4357
4358 * lisp.h (GCPRO1_VAR, UNGCPRO_VAR): New macros,
4359 so that the caller can use some name other than gcpro1.
4360 (GCPRO1, UNGCPRO): Reimplement in terms of the new macros.
4361 * xfns.c (Fx_create_frame, x_create_tip_frame, Fx_show_tip):
4362 (Fx_backspace_delete_keys_p):
4363 Use them to avoid shadowing, and rename vars to avoid shadowing.
4364 (x_decode_color, x_set_name, x_window): Now static.
4365 (Fx_create_frame): Add braces to silence GCC warning.
4366 (Fx_file_dialog, Fx_select_font): Fix pointer signedness.
4367 (x_real_positions, xg_set_icon_from_xpm_data, x_create_tip_frame):
4368 Remove unused locals.
4369 (Fx_create_frame, x_create_tip_frame, Fx_show_tip):
4370 (Fx_backspace_delete_keys_p): Rename locals to avoid shadowing.
4371 Some of these renamings use the new GCPRO1_VAR and UNGCPRO_VAR
4372 macros.
4373
4374 * xterm.h (x_mouse_leave): New decl.
4375
4376 * xterm.c (x_copy_dpy_color, x_focus_on_frame, x_unfocus_frame):
4377 Remove unused functions.
4378 (x_shift_glyphs_for_insert, XTflash, XTring_bell):
4379 (x_calc_absolute_position): Now static.
4380 (XTread_socket): Don't define label "out" unless it's used.
4381 Don't declare local "event" unless it's used.
4382 (x_iconify_frame, x_free_frame_resources): Don't declare locals
4383 unless they are used.
4384 (XEMBED_VERSION, xembed_set_info): Don't define unless needed.
4385 (x_fatal_error_signal): Remove; not used.
4386 (x_draw_image_foreground, redo_mouse_highlight, XTmouse_position):
4387 (x_scroll_bar_report_motion, handle_one_xevent, x_draw_bar_cursor):
4388 (x_error_catcher, x_connection_closed, x_error_handler):
4389 (x_error_quitter, xembed_send_message, x_iconify_frame):
4390 (my_log_handler): Rename locals to avoid shadowing.
4391 (x_delete_glyphs, x_ins_del_lines): Mark with NO_RETURN.
4392 (x_connection_closed): Tell GCC not to suggest NO_RETURN.
4393
4394 * xfaces.c (clear_face_cache, Fx_list_fonts, Fface_font):
4395 Rename or move locals to avoid shadowing.
4396 (tty_defined_color, merge_face_heights): Now static.
4397 (free_realized_faces_for_fontset): Remove; not used.
4398 (Fx_list_fonts): Mark variable that gcc -Wuninitialized
4399 does not deduce is never used uninitialized.
4400 (STRDUPA, LSTRDUPA, FONT_POINT_SIZE_QUANTUM): Remove; not used.
4401 (LFACEP): Define only if XASSERTS, as it's not needed otherwise.
4402
4403 * terminal.c (store_terminal_param): Now static.
4404
4405 * xmenu.c (menu_highlight_callback): Now static.
4406 (set_frame_menubar): Remove unused local.
4407 (xmenu_show): Rename parameter to avoid shadowing.
4408 (xmenu_show, xdialog_show, xmenu_show): Make local pointers "const"
4409 since they might point to immutable storage.
4410 (next_menubar_widget_id): Declare only if USE_X_TOOLKIT,
4411 since it's unused otherwise.
4412
4413 * xdisp.c (produce_glyphless_glyph): Initialize lower_xoff.
4414 Add a FIXME, since the code still doesn't look right. (Bug#8215)
4415 (Fcurrent_bidi_paragraph_direction): Simplify slightly; this
4416 avoids a gcc -Wuninitialized diagnostic.
4417 (display_line, BUILD_COMPOSITE_GLYPH_STRING, draw_glyphs):
4418 (note_mouse_highlight): Mark variables that gcc -Wuninitialized
4419 does not deduce are never used uninitialized.
4420
4421 * lisp.h (IF_LINT): New macro, copied from ../lib-src/emacsclient.c.
4422
4423 * xdisp.c (redisplay_window): Rename local to avoid shadowing.
4424 * window.c (window_loop, size_window):
4425 (run_window_configuration_change_hook, enlarge_window): Likewise.
4426
4427 * window.c (display_buffer): Now static.
4428 (size_window): Mark variables that gcc -Wuninitialized
4429 does not deduce are never used uninitialized.
4430 * window.h (check_all_windows): New decl, to forestall
4431 gcc -Wmissing-prototypes diagnostic.
4432 * dispextern.h (bidi_dump_cached_states): Likewise.
4433
4434 * charset.h (CHECK_CHARSET_GET_CHARSET): Rename locals to avoid
4435 shadowing.
4436 * charset.c (map_charset_for_dump, Fchar_charset): Likewise.
4437 Include <limits.h>.
4438 (Fsort_charsets): Redo min/max calculation to shorten the code a bit
4439 and to avoid gcc -Wuninitialized warning.
4440 (load_charset_map): Mark variables that gcc -Wuninitialized
4441 does not deduce are never used uninitialized.
4442 (load_charset): Abort instead of using uninitialized var (Bug#8229).
4443
4444 * coding.c (coding_set_source, coding_set_destination):
4445 Use "else { /* comment */ }" rather than "else /* comment */;"
4446 for clarity, and to avoid gcc -Wempty-body warning.
4447 (Fdefine_coding_system_internal): Don't redeclare 'i' inside
4448 a block, when the outer 'i' will do.
4449 (decode_coding_utf_8, decode_coding_utf_16, detect_coding_emacs_mule):
4450 (emacs_mule_char, decode_coding_emacs_mule, detect_coding_iso_2022):
4451 (decode_coding_iso_2022, decode_coding_sjis, decode_coding_big5):
4452 (decode_coding_raw_text, decode_coding_charset, get_translation_table):
4453 (Fdecode_sjis_char, Fdefine_coding_system_internal):
4454 Rename locals to avoid shadowing.
4455 * character.h (FETCH_STRING_CHAR_ADVANCE): Likewise.
4456 * coding.c (emacs_mule_char, encode_invocation_designation):
4457 Now static, since they're not used elsewhere.
4458 (decode_coding_iso_2022): Add "default: abort ();" as a safety check.
4459 (decode_coding_object, encode_coding_object, detect_coding_system):
4460 (decode_coding_emacs_mule): Mark variables that gcc
4461 -Wuninitialized does not deduce are never used uninitialized.
4462 (detect_coding_iso_2022): Initialize a local variable that might
4463 be used uninitialized. Leave a FIXME because it's not clear that
4464 this initialization is needed. (Bug#8211)
4465 (ISO_CODE_LF, ISO_CODE_CR, CODING_ISO_FLAG_EUC_TW_SHIFT):
4466 (ONE_MORE_BYTE_NO_CHECK, UTF_BOM, UTF_16_INVALID_P):
4467 (SHIFT_OUT_OK, ENCODE_CONTROL_SEQUENCE_INTRODUCER):
4468 (ENCODE_DIRECTION_R2L, ENCODE_DIRECTION_L2R):
4469 Remove unused macros.
4470
4471 * category.c (hash_get_category_set): Remove unused local var.
4472 (copy_category_table): Now static, since it's not used elsewhere.
4473 * character.c (string_count_byte8): Likewise.
4474
4475 * ccl.c (CCL_WRITE_STRING, CCL_ENCODE_CHAR, Fccl_execute_on_string):
4476 (Fregister_code_conversion_map): Rename locals to avoid shadowing.
4477
4478 * chartab.c (copy_sub_char_table): Now static, since it's not used
4479 elsewhere.
4480 (sub_char_table_ref_and_range, char_table_ref_and_range):
4481 Rename locals to avoid shadowing.
4482 (ASET_RANGE, GET_SUB_CHAR_TABLE): Remove unused macros.
4483
4484 * bidi.c (bidi_check_type): Now static, since it's not used elsewhere.
4485 (BIDI_BOB): Remove unused macro.
4486
4487 * cm.c (cmgoto): Mark variables that gcc -Wuninitialized does not
4488 deduce are never used uninitialized.
4489 * term.c (encode_terminal_code): Likewise.
4490
4491 * term.c (encode_terminal_code): Now static. Remove unused local.
4492
4493 * tparam.h: New file.
4494 * term.c, tparam.h: Include it.
4495 * deps.mk (term.o, tparam.o): Depend on tparam.h.
4496 * term.c (tputs, tgetent, tgetflag, tgetnum, tparam, tgetstr):
4497 Move these decls to tparam.h, and make them agree with what
4498 is actually in tparam.c. The previous trick of using incompatible
4499 decls in different modules does not conform to the C standard.
4500 All callers of tparam changed to use tparam's actual API.
4501 * tparam.c (tparam1, tparam, tgoto):
4502 Use const pointers where appropriate.
4503
4504 * cm.c (calccost, cmgoto): Use const pointers where appropriate.
4505 * cm.h (struct cm): Likewise.
4506 * dispextern.h (do_line_insertion_deletion_costs): Likewise.
4507 * scroll.c (ins_del_costs, do_line_insertion_deletion_costs): Likewise.
4508 * term.c (tty_ins_del_lines, calculate_costs, struct fkey_table):
4509 (term_get_fkeys_1, append_glyphless_glyph, produce_glyphless_glyph):
4510 (turn_on_face, init_tty): Likewise.
4511 * termchar.h (struct tty_display_info): Likewise.
4512
4513 * term.c (term_mouse_position): Rename local to avoid shadowing.
4514
4515 * alloc.c (mark_ttys): Move decl from here ...
4516 * lisp.h (mark_ttys): ... to here, so that it's checked against defn.
4517
4518 2011-03-11 Andreas Schwab <schwab@linux-m68k.org>
4519
4520 * .gdbinit (pwinx, xbuffer): Fix access to buffer name.
4521
4522 2011-03-09 Juanma Barranquero <lekktu@gmail.com>
4523
4524 * search.c (compile_pattern_1): Remove argument regp, unused since
4525 revid:rms@gnu.org-19941211082627-3x1g1wyqkjmwloig.
4526 (compile_pattern): Don't pass it.
4527
4528 2011-03-08 Jan Djärv <jan.h.d@swipnet.se>
4529
4530 * xterm.h (DEFAULT_GDK_DISPLAY): New define.
4531 (GDK_WINDOW_XID, gtk_widget_get_preferred_size): New defines
4532 for ! HAVE_GTK3.
4533 (GTK_WIDGET_TO_X_WIN): Use GDK_WINDOW_XID.
4534
4535 * xmenu.c (menu_position_func): Call gtk_widget_get_preferred_size.
4536
4537 * gtkutil.c: Include gtkx.h if HAVE_GTK3. If ! HAVE_GTK3, define
4538 gdk_window_get_screen, gdk_window_get_geometry,
4539 gdk_x11_window_lookup_for_display and GDK_KEY_g.
4540 (xg_set_screen): Use DEFAULT_GDK_DISPLAY.
4541 (xg_get_pixbuf_from_pixmap): New function.
4542 (xg_get_pixbuf_from_pix_and_mask): Change parameters from GdkPixmap
4543 to Pixmap, take frame as parameter, remove GdkColormap parameter.
4544 Call xg_get_pixbuf_from_pixmap instead of
4545 gdk_pixbuf_get_from_drawable.
4546 (xg_get_image_for_pixmap): Do not make GdkPixmaps, call
4547 xg_get_pixbuf_from_pix_and_mask with Pixmap parameters instead.
4548 (xg_check_special_colors): Use GtkStyleContext and its functions
4549 for HAVE_GTK3.
4550 (xg_prepare_tooltip, xg_hide_tooltip): Call gdk_window_get_screen.
4551 (xg_prepare_tooltip, create_dialog, menubar_map_cb)
4552 (xg_update_frame_menubar, xg_tool_bar_detach_callback)
4553 (xg_tool_bar_attach_callback, xg_update_tool_bar_sizes):
4554 Call gtk_widget_get_preferred_size.
4555 (xg_frame_resized): gdk_window_get_geometry only takes 5
4556 parameters.
4557 (xg_win_to_widget, xg_event_is_for_menubar):
4558 Call gdk_x11_window_lookup_for_display.
4559 (xg_set_widget_bg): New function.
4560 (delete_cb): New function.
4561 (xg_create_frame_widgets): Connect delete-event to delete_cb.
4562 Call xg_set_widget_bg. Only set backgrund pixmap for ! HAVE_GTK3
4563 (xg_set_background_color): Call xg_set_widget_bg.
4564 (xg_set_frame_icon): Call xg_get_pixbuf_from_pix_and_mask.
4565 (xg_create_scroll_bar): vadj is a GtkAdjustment for HAVE_GTK3.
4566 Only call gtk_range_set_update_policy if ! HAVE_GTK3.
4567 (xg_make_tool_item): Only connect xg_tool_bar_item_expose_callback
4568 if ! HAVE_GTK3.
4569 (update_frame_tool_bar): Call gtk_widget_hide.
4570 (xg_initialize): Use GDK_KEY_g.
4571
4572 * xsmfns.c (gdk_set_sm_client_id): Define to gdk_set_sm_client_id
4573 if ! HAVE_GTK3
4574 (x_session_initialize): Call gdk_x11_set_sm_client_id.
4575
4576 * xterm.c (XFillRectangle): Use cairo routines for HAVE_GTK3.
4577 (x_term_init): Disable Xinput(2) with GDK_CORE_DEVICE_EVENTS.
4578 Load ~/emacs.d/gtkrc only for ! HAVE_GTK3.
4579
4580 2011-03-08 Juanma Barranquero <lekktu@gmail.com>
4581
4582 * w32xfns.c (select_palette): Check success of RealizePalette against
4583 GDI_ERROR, not zero.
4584
4585 See ChangeLog.11 for earlier changes.
4586
4587 ;; Local Variables:
4588 ;; coding: utf-8
4589 ;; End:
4590
4591 Copyright (C) 2011 Free Software Foundation, Inc.
4592
4593 This file is part of GNU Emacs.
4594
4595 GNU Emacs is free software: you can redistribute it and/or modify
4596 it under the terms of the GNU General Public License as published by
4597 the Free Software Foundation, either version 3 of the License, or
4598 (at your option) any later version.
4599
4600 GNU Emacs is distributed in the hope that it will be useful,
4601 but WITHOUT ANY WARRANTY; without even the implied warranty of
4602 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4603 GNU General Public License for more details.
4604
4605 You should have received a copy of the GNU General Public License
4606 along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.