d86ae3602756ba3211943ac42d8ba5a558b498db
[bpt/emacs.git] / src / ChangeLog
1 2011-07-28 Paul Eggert <eggert@cs.ucla.edu>
2
3 * coding.c: Integer and memory overflow fixes.
4 (produce_chars): Redo buffer-overflow calculations to avoid
5 unnecessary integer overflow. Check for size overflow.
6 (encode_coding_object): Don't update size until xmalloc succeeds.
7
8 * character.c (Fstring): Check for size-calculation overflow.
9
10 * ccl.c: Integer and memory overflow fixes.
11 (Fccl_execute_on_string): Check for memory overflow.
12 Use ptrdiff_t rather than EMACS_INT where ptrdiff_t will do.
13 Redo buffer-overflow calculations to avoid integer overflow.
14
15 * callproc.c (child_setup): Don't assume strlen fits in int.
16
17 * buffer.c: Memory overflow fixes.
18 (overlays_at, overlays_in, record_overlay_string, overlay_strings):
19 Don't update size of array until after memory allocation succeeds,
20 because xmalloc/xrealloc may not return.
21
22 * bidi.c: Integer overflow fix.
23 (bidi_shelve_header_size): New constant.
24 (bidi_cache_ensure_space, bidi_shelve_cache): Use it.
25 (bidi_cache_ensure_space): Avoid integer overflow when allocating.
26
27 2011-07-19 Paul Eggert <eggert@cs.ucla.edu>
28
29 Use ptrdiff_t for composition IDs.
30 * character.c (lisp_string_width):
31 * composite.c (composition_table_size, n_compositions)
32 (get_composition_id, composition_gstring_from_id):
33 * dispextern.h (struct glyph_string.cmp_id, struct composition_it.id):
34 * xdisp.c (BUILD_COMPOSITE_GLYPH_STRING):
35 * window.c (Frecenter):
36 Use ptrdiff_t, not int, for composition IDs.
37 * composite.c (get_composition_id): Check for integer overflow.
38 * composite.h: Adjust prototypes to match the above changes.
39
40 Use ptrdiff_t for hash table indexes.
41 * category.c (hash_get_category_set):
42 * ccl.c (ccl_driver):
43 * charset.h (struct charset.hash_index, CHECK_CHARSET_GET_ID):
44 * coding.c (coding_system_charset_list, detect_coding_system):
45 * coding.h (struct coding_system.id):
46 * composite.c (get_composition_id, gstring_lookup_cache):
47 * fns.c (hash_lookup, hash_put, Fgethash, Fputhash):
48 * image.c (xpm_get_color_table_h):
49 * lisp.h (hash_lookup, hash_put):
50 * minibuf.c (Ftest_completion):
51 Use ptrdiff_t for hash table indexes, not int (which is too
52 narrow, on 64-bit hosts) or EMACS_INT (which is too wide, on
53 32-bit --with-wide-int hosts).
54
55 * charset.c (Fdefine_charset_internal): Check for integer overflow.
56 Add a FIXME comment about memory leaks.
57 (syms_of_charset): Don't assume xmalloc returns.
58
59 Don't assume that stated character widths fit in int.
60 * character.c (Fchar_width, c_string_width, lisp_string_width):
61 * character.h (CHAR_WIDTH):
62 * indent.c (MULTIBYTE_BYTES_WIDTH):
63 Use sanitize_char_width to avoid undefined and/or bad behavior
64 with outlandish widths.
65 * character.h (sanitize_tab_width): Renamed from sanitize_width,
66 now that we have two such functions. All uses changed.
67 (sanitize_char_width): New inline function.
68
69 Don't assume that tab-width fits in int.
70 * character.h (sanitize_width): New inline function.
71 (SANE_TAB_WIDTH): New macro.
72 (ASCII_CHAR_WIDTH): Use it.
73 * indent.c (sane_tab_width): Remove. All uses replaced by
74 SANE_TAB_WIDTH (current_buffer).
75 * xdisp.c (init_iterator): Use SANE_TAB_WIDTH.
76
77 * fileio.c: Integer overflow issues with file modes.
78 (Fset_file_modes, auto_save_1): Don't assume EMACS_INT fits in int.
79
80 * charset.c (read_hex): New arg OVERFLOW. All uses changed.
81 Remove unreachable code.
82 (read_hex, load_charset_map_from_file): Check for integer overflow.
83
84 * xterm.c: don't go over XClientMessageEvent limit
85 (scroll_bar_windows_size): Now ptrdiff_t, as we prefer signed.
86 (x_send_scroll_bar_event): Likewise. Check that the size does not
87 exceed limits imposed by XClientMessageEvent, as well as the usual
88 ptrdiff_t and size_t limits.
89
90 * keyboard.c: Overflow, signedness and related fixes.
91 (make_lispy_movement): Use same integer type in forward decl
92 that is used in the definition.
93 (read_key_sequence, keyremap_step):
94 Change bufsize argument back to int, undoing my 2011-03-30 change.
95 We prefer signed types, and int is wide enough here.
96 (parse_tool_bar_item): Don't assume tool_bar_max_label_size is less
97 than TYPE_MAXIMUM (EMACS_INT) / 2. Don't let the label size grow
98 larger than STRING_BYTES_BOUND. Use ptrdiff_t for Emacs string
99 length, not size_t. Use ptrdiff_t for index, not int.
100 (keyremap_step, read_key_sequence): Redo bufsize check to avoid
101 possibility of integer overflow.
102
103 Overflow, signedness and related fixes for images.
104
105 * dispextern.h (struct it.stack[0].u.image.image_id)
106 (struct_it.image_id, struct image.id, struct image_cache.size)
107 (struct image_cache.used, struct image_cache.ref_count):
108 * gtkutil.c (update_frame_tool_bar):
109 * image.c (x_reference_bitmap, Fimage_size, Fimage_mask_p)
110 (Fimage_metadata, free_image_cache, clear_image_cache, lookup_image)
111 (cache_image, mark_image_cache, x_kill_gs_process, Flookup_image):
112 * nsmenu.m (update_frame_tool_bar):
113 * xdisp.c (calc_pixel_width_or_height):
114 * xfns.c (image_cache_refcount):
115 Image IDs are now ptrdiff_t, not int, to avoid arbitrary limits
116 on typical 64-bit hosts.
117
118 * image.c (RANGED_INTEGERP, TYPE_RANGED_INTEGERP): New macros.
119 (x_bitmap_pixmap, x_create_x_image_and_pixmap):
120 Omit unnecessary casts to int.
121 (parse_image_spec): Check that integers fall into 'int' range
122 when the callers expect that.
123 (image_ascent): Redo ascent calculation to avoid int overflow.
124 (clear_image_cache): Avoid overflow when sqrt (INT_MAX) < nimages.
125 (lookup_image): Remove unnecessary tests.
126 (xbm_image_p): Locals are now of int, not EMACS_INT,
127 since parse_image_check makes sure they fit into int.
128 (png_load, gif_load, svg_load_image):
129 Prefer int to unsigned where either will do.
130 (tiff_handler): New function, combining the cores of the
131 old tiff_error_handler and tiff_warning_handler. This
132 function is rewritten to use vsnprintf and thereby avoid
133 stack buffer overflows. It uses only the features of vsnprintf
134 that are common to both POSIX and native Microsoft.
135 (tiff_error_handler, tiff_warning_handler): Use it.
136 (tiff_load, gif_load, imagemagick_load_image):
137 Don't assume :index value fits in 'int'.
138 (gif_load): Omit unnecessary cast to double, and avoid double-rounding.
139 (imagemagick_load_image): Check that crop parameters fit into
140 the integer types that MagickCropImage accepts. Don't assume
141 Vimagemagick_render_type has a nonnegative value. Don't assume
142 size_t fits in 'long'.
143 (gs_load): Use printmax_t to print the widest integers possible.
144 Check for integer overflow when computing image height and width.
145
146 2011-07-19 Paul Eggert <eggert@cs.ucla.edu>
147
148 Integer signedness and overflow and related fixes. (Bug#9079)
149
150 * bidi.c: Integer size and overflow fixes.
151 (bidi_cache_size, bidi_cache_idx, bidi_cache_last_idx)
152 (bidi_cache_start, bidi_cache_fetch_state, bidi_cache_search)
153 (bidi_cache_find_level_change, bidi_cache_ensure_space)
154 (bidi_cache_iterator_state, bidi_cache_find, bidi_cache_start_stack)
155 (bidi_find_other_level_edge):
156 Use ptrdiff_t instead of EMACS_INT where either will do.
157 This works better on 32-bit hosts configured --with-wide-int.
158 (bidi_cache_ensure_space): Check for size-calculation overflow.
159 Use % rather than repeated addition, for better worst-case speed.
160 Don't set bidi_cache_size until after xrealloc returns, because it
161 might not return.
162 (bidi_dump_cached_states): Use ptrdiff_t, not int, to avoid overflow.
163 (bidi_cache_ensure_space): Also check that the bidi cache size
164 does not exceed that of the largest Lisp string or buffer. See Eli
165 Zaretskii in <http://debbugs.gnu.org/cgi/bugreport.cgi?bug=9079#29>.
166
167 * alloc.c (__malloc_size_t): Remove.
168 All uses replaced by size_t. See Andreas Schwab's note
169 <http://debbugs.gnu.org/cgi/bugreport.cgi?bug=9079#8>.
170
171 * image.c: Improve checking for integer overflow.
172 (check_image_size): Assume that f is nonnull, since
173 it is always nonnull in practice. This is one less thing to
174 worry about when checking for integer overflow later.
175 (x_check_image_size): New function, which checks for integer
176 overflow issues inside X.
177 (x_create_x_image_and_pixmap, xbm_read_bitmap_data): Use it.
178 This removes the need for a memory_full check.
179 (xbm_image_p): Rewrite to avoid integer multiplication overflow.
180 (Create_Pixmap_From_Bitmap_Data, xbm_load): Use x_check_image_size.
181 (xbm_read_bitmap_data): Change locals back to 'int', since
182 their values must fit in 'int'.
183 (xpm_load_image, png_load, tiff_load):
184 Invoke x_create_x_image_and_pixmap earlier,
185 to avoid much needless work if the image is too large.
186 (tiff_load): Treat overly large images as if
187 x_create_x_image_and_pixmap failed, not as malloc failures.
188 (gs_load): Use x_check_image_size.
189
190 * gtkutil.c: Omit integer casts.
191 (xg_get_pixbuf_from_pixmap): Remove unnecessary cast.
192 (xg_set_toolkit_scroll_bar_thumb): Rewrite to avoid need for cast.
193
194 * image.c (png_load): Don't assume height * row_bytes fits in 'int'.
195
196 * xfaces.c (Fbitmap_spec_p): Fix integer overflow bug.
197 Without this fix, (bitmap-spec-p '(34359738368 1 "x"))
198 would wrongly return t on a 64-bit host.
199
200 * dispnew.c (init_display): Use *_RANGE_OVERFLOW macros.
201 The plain *_OVERFLOW macros run afoul of GCC bug 49705
202 <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49705>
203 and therefore cause GCC to emit a bogus diagnostic in some cases.
204
205 * image.c: Integer signedness and overflow and related fixes.
206 This is not an exhaustive set of fixes, but it's time to
207 record what I've got.
208 (lookup_pixel_color, check_image_size): Remove redundant decls.
209 (check_image_size): Don't assume that arbitrary EMACS_INT values
210 fit in 'int', or that arbitrary 'double' values fit in 'int'.
211 (x_alloc_image_color, x_create_x_image_and_pixmap, png_load)
212 (tiff_load, imagemagick_load_image):
213 Check for overflow in size calculations.
214 (x_create_x_image_and_pixmap): Remove unnecessary test for
215 xmalloc returning NULL; that can't happen.
216 (xbm_read_bitmap_data): Don't assume sizes fit into 'int'.
217 (xpm_color_bucket): Use better integer hashing function.
218 (xpm_cache_color): Don't possibly over-allocate memory.
219 (struct png_memory_storage, tiff_memory_source, tiff_seek_in_memory)
220 (gif_memory_source):
221 Use ptrdiff_t, not int or size_t, to record sizes.
222 (png_load): Don't assume values greater than 2**31 fit in 'int'.
223 (our_stdio_fill_input_buffer): Prefer ptrdiff_t to size_t when
224 either works, as we prefer signed integers.
225 (tiff_read_from_memory, tiff_write_from_memory):
226 Return tsize_t, not size_t, since that's what the TIFF API wants.
227 (tiff_read_from_memory): Don't fail simply because the read would
228 go past EOF; instead, return a short read.
229 (tiff_load): Omit no-longer-needed casts.
230 (Fimagemagick_types): Don't assume size fits into 'int'.
231
232 Improve hashing quality when configured --with-wide-int.
233 * fns.c (hash_string): New function, taken from sxhash_string.
234 Do not discard information about ASCII character case; this
235 discarding is no longer needed.
236 (sxhash-string): Use it. Change sig to match it. Caller changed.
237 * lisp.h: Declare it.
238 * lread.c (hash_string): Remove, since we now use fns.c's version.
239 The fns.c version returns a wider integer if --with-wide-int is
240 specified, so this should help the quality of the hashing a bit.
241
242 * emacs.c: Integer overflow minor fix.
243 (heap_bss_diff): Now uprintmax_t, not unsigned long. All used changed.
244 Define only if GNU_LINUX.
245 (main, Fdump_emacs): Set and use heap_bss_diff only if GNU_LINUX.
246
247 * dispnew.c: Integer signedness and overflow fixes.
248 Remove unnecessary forward decls, that were a maintenance hassle.
249 (history_tick): Now uprintmax_t, so it's more likely to avoid overflow.
250 All uses changed.
251 (adjust_glyph_matrix, realloc_glyph_pool, adjust_frame_message_buffer)
252 (scrolling_window): Use ptrdiff_t, not int, for byte count.
253 (prepare_desired_row, line_draw_cost):
254 Use int, not unsigned, where either works.
255 (save_current_matrix, restore_current_matrix):
256 Use ptrdiff_t, not size_t, where either works.
257 (init_display): Check for overflow more accurately, and without
258 relying on undefined behavior.
259
260 * editfns.c (pWIDE, pWIDElen, signed_wide, unsigned_wide):
261 Remove, replacing with the new symbols in lisp.h. All uses changed.
262 * fileio.c (make_temp_name):
263 * filelock.c (lock_file_1, lock_file):
264 * xdisp.c (message_dolog):
265 Don't assume PRIdMAX etc. works; this isn't portable to pre-C99 hosts.
266 Use pMd etc. instead.
267 * lisp.h (printmax_t, uprintmax_t, pMd, pMu): New types and macros,
268 replacing the pWIDE etc. symbols removed from editfns.c.
269
270 * keyboard.h (num_input_events): Now uintmax_t.
271 This is (very slightly) less likely to mess up due to wraparound.
272 All uses changed.
273
274 * buffer.c: Integer signedness fixes.
275 (alloc_buffer_text, enlarge_buffer_text):
276 Use ptrdiff_t rather than size_t when either will do, as we prefer
277 signed integers.
278
279 * alloc.c: Integer signedness and overflow fixes.
280 Do not impose an arbitrary 32-bit limit on malloc sizes when debugging.
281 (__malloc_size_t): Default to size_t, not to int.
282 (pure_size, pure_bytes_used_before_overflow, stack_copy_size)
283 (Fgarbage_collect, mark_object_loop_halt, mark_object):
284 Prefer ptrdiff_t to size_t when either would do, as we prefer
285 signed integers.
286 (XMALLOC_OVERRUN_CHECK_OVERHEAD): New macro.
287 (xmalloc_overrun_check_header, xmalloc_overrun_check_trailer):
288 Now const. Initialize with values that are in range even if char
289 is signed.
290 (XMALLOC_PUT_SIZE, XMALLOC_GET_SIZE): Remove, replacing with ...
291 (xmalloc_put_size, xmalloc_get_size): New functions. All uses changed.
292 These functions do the right thing with sizes > 2**32.
293 (check_depth): Now ptrdiff_t, not int.
294 (overrun_check_malloc, overrun_check_realloc, overrun_check_free):
295 Adjust to new way of storing sizes. Check for size overflow bugs
296 in rest of code.
297 (STRING_BYTES_MAX): Adjust to new overheads. The old code was
298 slightly wrong anyway, as it missed one instance of
299 XMALLOC_OVERRUN_CHECK_OVERHEAD.
300 (refill_memory_reserve): Omit needless cast to size_t.
301 (mark_object_loop_halt): Mark as externally visible.
302
303 * xselect.c: Integer signedness and overflow fixes.
304 (Fx_register_dnd_atom, x_handle_dnd_message):
305 Use ptrdiff_t, not size_t, since we prefer signed.
306 (Fx_register_dnd_atom): Check for ptrdiff_t (and size_t) overflow.
307 * xterm.h (struct x_display_info): Use ptrdiff_t, not size_t, for
308 x_dnd_atoms_size and x_dnd_atoms_length.
309
310 * doprnt.c: Prefer signed to unsigned when either works.
311 * eval.c (verror):
312 * doprnt.c (doprnt):
313 * lisp.h (doprnt):
314 * xdisp.c (vmessage):
315 Use ptrdiff_t, not size_t, when using or implementing doprnt,
316 since the sizes cannot exceed ptrdiff_t bounds anyway, and we
317 prefer signed arithmetic to avoid comparison confusion.
318 * doprnt.c (doprnt): Avoid a "+ 1" that can't overflow,
319 but is a bit tricky.
320
321 Assume freestanding C89 headers, string.h, stdlib.h.
322 * data.c, doprnt.c, floatfns.c, print.c:
323 Include float.h unconditionally.
324 * gmalloc.c: Assume C89-at-least behavior for preprocessor,
325 limits.h, stddef.h, string.h. Use memset instead of 'flood'.
326 * regex.c: Likewise for stddef.h, string.h.
327 (ISASCII): Remove; can assume it returns 1 now. All uses removed.
328 * s/aix4-2.h (HAVE_STRING_H): Remove obsolete undef.
329 * s/ms-w32.h (HAVE_LIMITS_H, HAVE_STRING_H, HAVE_STDLIB_H)
330 (STDC_HEADERS): Remove obsolete defines.
331 * sysdep.c: Include limits.h unconditionally.
332
333 Assume support for memcmp, memcpy, memmove, memset.
334 * lisp.h, sysdep.c (memcmp, memcpy, memmove, memset):
335 * regex.c (memcmp, memcpy):
336 Remove; we assume C89 now.
337
338 * gmalloc.c (memcpy, memset, memmove): Remove; we assume C89 now.
339 (__malloc_safe_bcopy): Remove; no longer needed.
340
341 * lisp.h (struct vectorlike_header, struct Lisp_Subr): Signed sizes.
342 Use EMACS_INT, not EMACS_UINT, for sizes. The code works equally
343 well either way, and we prefer signed to unsigned.
344
345 2011-07-19 Paul Eggert <eggert@cs.ucla.edu>
346
347 Port to OpenBSD.
348 See http://lists.gnu.org/archive/html/emacs-devel/2011-07/msg00688.html
349 and the surrounding thread.
350 * minibuf.c (read_minibuf_noninteractive): Rewrite to use getchar
351 rather than fgets, and retry after EINTR. Otherwise, 'emacs
352 --batch -f byte-compile-file' fails on OpenBSD if an inactivity
353 timer goes off.
354 * s/openbsd.h (BROKEN_SIGIO): Define.
355 * unexelf.c (unexec) [__OpenBSD__]:
356 Don't update the .mdebug section of the Alpha COFF symbol table.
357
358 2011-07-19 Lars Magne Ingebrigtsen <larsi@gnus.org>
359
360 * lread.c (syms_of_lread): Clarify when `lexical-binding' is used
361 (bug#8460).
362
363 2011-07-18 Paul Eggert <eggert@cs.ucla.edu>
364
365 * fileio.c (Fcopy_file) [!MSDOS]: Tighten created file's mask.
366 This fixes some race conditions on the permissions of any newly
367 created file.
368
369 * alloc.c (valid_pointer_p): Use pipe, not open.
370 This fixes some permissions issues when debugging.
371
372 * fileio.c (Fcopy_file): Adjust mode if fchown fails. (Bug#9002)
373 If fchown fails to set both uid and gid, try to set just gid,
374 as that is sometimes allowed. Adjust the file's mode to eliminate
375 setuid or setgid bits that are inappropriate if fchown fails.
376
377 2011-07-18 Stefan Monnier <monnier@iro.umontreal.ca>
378
379 * xdisp.c (next_element_from_string, next_element_from_buffer): Use EQ
380 to compare Lisp_Objects.
381 * gnutls.c (syms_of_gnutls): Rename Vgnutls_log_level to
382 global_gnutls_log_level, don't mistake it for a Lisp_Object.
383 (init_gnutls_functions, emacs_gnutls_handle_error): Fix up uses.
384
385 2011-07-17 Andreas Schwab <schwab@linux-m68k.org>
386
387 * lread.c (read_integer): Unread even EOF character.
388 (read1): Likewise. Properly record start position of symbol.
389
390 * lread.c (read1): Read `#:' as empty uninterned symbol if no
391 symbol character follows.
392
393 2011-07-17 Paul Eggert <eggert@cs.ucla.edu>
394
395 * fileio.c (Fcopy_file): Pacify gcc re fchown. (Bug#9002)
396 This works around a problem with the previous change to Fcopy_file.
397 Recent glibc declares fchown with __attribute__((warn_unused_result)),
398 and without this change, GCC might complain about discarding
399 fchown's return value.
400
401 2011-07-16 Juanma Barranquero <lekktu@gmail.com>
402
403 * makefile.w32-in (GLOBAL_SOURCES): Add gnutls.c (followup to bug#9059).
404
405 2011-07-16 Paul Eggert <eggert@cs.ucla.edu>
406
407 * fileio.c (Fcopy_file): Don't diagnose fchown failures. (Bug#9002)
408
409 2011-07-16 Lars Magne Ingebrigtsen <larsi@gnus.org>
410
411 * gnutls.c (syms_of_gnutls): Define `gnutls-log-level' here, since
412 it's used from the C level.
413
414 * process.c: Use the same condition for POLL_FOR_INPUT in both
415 keyboard.c and process.c (bug#1858).
416
417 2011-07-09 Lawrence Mitchell <wence@gmx.li>
418
419 * gnutls.c (Qgnutls_bootprop_min_prime_bits): New variable.
420 (Fgnutls_boot): Use it.
421
422 2011-07-15 Andreas Schwab <schwab@linux-m68k.org>
423
424 * doc.c (Fsubstitute_command_keys): Revert last change.
425
426 2011-07-15 Lars Magne Ingebrigtsen <larsi@gnus.org>
427
428 * doc.c (Fsubstitute_command_keys): Clarify that \= really only
429 quotes the next character, and doesn't affect other longer
430 sequences (bug#8935).
431
432 * lread.c (syms_of_lread): Clarify that is isn't only
433 `eval-buffer' and `eval-defun' that's affected by
434 `lexical-binding' (bug#8460).
435
436 2011-07-15 Eli Zaretskii <eliz@gnu.org>
437
438 * xdisp.c (move_it_in_display_line_to): Fix vertical motion with
439 bidi redisplay when a line includes both an image and is
440 truncated.
441
442 2011-07-14 Paul Eggert <eggert@cs.ucla.edu>
443
444 Fix minor problems found by static checking.
445 * bidi.c (bidi_cache_size): Now EMACS_INT, not size_t.
446 (elsz): Now a signed constant, not a size_t var. We prefer signed
447 types to unsigned, to avoid integer comparison confusion. Without
448 this change, GCC 4.6.1 with -Wunsafe-loop-optimizations complains
449 "cannot optimize loop, the loop counter may overflow", a symptom
450 of the confusion.
451 * indent.c (Fvertical_motion): Mark locals as initialized.
452 * xdisp.c (reseat_to_string): Fix pointer signedness issue.
453
454 2011-07-14 Lars Magne Ingebrigtsen <larsi@gnus.org>
455
456 * search.c (Fre_search_backward): Mention `case-fold-search' in
457 all the re_search_* functions (bug#8138).
458
459 * keyboard.c (Fopen_dribble_file): Document when the file is
460 closed (bug#8056).
461
462 2011-07-14 Eli Zaretskii <eliz@gnu.org>
463
464 * bidi.c (bidi_dump_cached_states): Fix format of displaying
465 bidi_cache_idx.
466
467 Support bidi reordering of display and overlay strings.
468 * xdisp.c (compute_display_string_pos)
469 (compute_display_string_end): Accept additional argument STRING.
470 (init_iterator, reseat_1): Initialize bidi_it->string.s to NULL.
471 (reseat_to_string): Initialize bidi_it->string.s and
472 bidi_it->string.schars.
473 (Fcurrent_bidi_paragraph_direction): Initialize itb.string.s to
474 NULL (avoids a crash in bidi_paragraph_init). Initialize
475 itb.string.lstring.
476 (init_iterator): Call bidi_init_it only of a valid
477 buffer position was specified. Initialize paragraph_embedding to
478 L2R.
479 (reseat_to_string): Initialize the bidi iterator.
480 (display_string): If we need to ignore text properties of
481 LISP_STRING, set IT->stop_charpos to IT->end_charpos. (The
482 original value of -1 will not work with bidi.)
483 (compute_display_string_pos): First arg is now struct
484 `text_pos *'; all callers changed. Support display properties on
485 Lisp strings.
486 (compute_display_string_end): Support display properties on Lisp
487 strings.
488 (init_iterator, reseat_1, reseat_to_string): Initialize the
489 string.bufpos member to 0 (zero, for compatibility with IT_CHARPOS
490 when iterating on a string not from display properties).
491 (compute_display_string_pos, compute_display_string_end): Fix
492 calculation of the object to scan. Fixes an error when using
493 arrow keys.
494 (next_element_from_buffer): Don't abort when IT_CHARPOS is before
495 base_level_stop; instead, set base_level_stop to BEGV. Fixes
496 crashes in vertical-motion.
497 (next_element_from_buffer): Improve commentary for when
498 the iterator is before prev_stop.
499 (init_iterator): Initialize bidi_p from the default value of
500 bidi-display-reordering, not from buffer-local value. Use the
501 buffer-local value only if initializing for buffer iteration.
502 (handle_invisible_prop): Support invisible properties on strings
503 that are being bidi-reordered.
504 (set_iterator_to_next): Support bidi reordering of C strings and
505 Lisp strings.
506 (next_element_from_string): Support bidi reordering of Lisp
507 strings.
508 (handle_stop_backwards): Support Lisp strings as well.
509 (display_string): Support display of R2L glyph rows. Use
510 IT_STRING_CHARPOS when displaying from a Lisp string.
511 (init_iterator): Don't initialize it->bidi_p for strings
512 here.
513 (reseat_to_string): Initialize it->bidi_p for strings here.
514 (next_element_from_string, next_element_from_c_string)
515 (next_element_from_buffer): Add xassert's for correspondence
516 between IT's object being iterated and it->bidi_it.string
517 structure.
518 (face_before_or_after_it_pos): Support bidi iteration.
519 (next_element_from_c_string): Handle the case of the first string
520 character that is not the first one in the visual order.
521 (get_visually_first_element): New function, refactored from common
522 parts of next_element_from_buffer, next_element_from_string, and
523 next_element_from_c_string.
524 (tool_bar_lines_needed, redisplay_tool_bar)
525 (display_menu_bar): Force left-to-right direction. Add a FIXME
526 comment for making that be controlled by a user option.
527 (push_it, pop_it): Save and restore the state of the
528 bidi iterator. Save and restore the bidi_p flag.
529 (pop_it): Iterate out of display property for string iteration as
530 well.
531 (iterate_out_of_display_property): Support iteration over strings.
532 (handle_single_display_spec): Set up it->bidi_it for iteration
533 over a display string, and call bidi_init_it.
534 (handle_single_display_spec, next_overlay_string)
535 (get_overlay_strings_1, push_display_prop): Set up the bidi
536 iterator for displaying display or overlay strings.
537 (forward_to_next_line_start): Don't use the shortcut if
538 bidi-iterating.
539 (back_to_previous_visible_line_start): If handle_display_prop
540 pushed the iterator stack, restore the internal state of the bidi
541 iterator by calling bidi_pop_it same number of times.
542 (reseat_at_next_visible_line_start): If ON_NEWLINE_P is non-zero,
543 and we are bidi-iterating, don't decrement the iterator position;
544 instead, set the first_elt flag in the bidi iterator, to produce
545 the same effect.
546 (reseat_1): Remove redundant setting of string_from_display_prop_p.
547 (push_display_prop): xassert that we are iterating a buffer.
548 (push_it, pop_it): Save and restore paragraph_embedding member.
549 (handle_single_display_spec, next_overlay_string)
550 (get_overlay_strings_1, reseat_1, reseat_to_string)
551 (push_display_prop): Set up the `unibyte' member of bidi_it.string
552 correctly. Don't assume unibyte strings are not bidi-reordered.
553 (compute_display_string_pos)
554 (compute_display_string_end): Fix handling the case of C string.
555 (push_it, pop_it): Save and restore from_disp_prop_p.
556 (handle_single_display_spec, push_display_prop): Set the
557 from_disp_prop_p flag.
558 (get_overlay_strings_1): Reset the from_disp_prop_p flag.
559 (pop_it): Call iterate_out_of_display_property only if we are
560 popping after iteration over a string that came from a display
561 property. Fix a typo in popping stretch info. Add an assertion
562 for verifying that the iterator position is in sync with the bidi
563 iterator.
564 (handle_single_display_spec, get_overlay_strings_1)
565 (push_display_prop): Fix initialization of paragraph direction for
566 string when that of the parent object is not yet determined.
567 (reseat_1): Call bidi_init_it to resync the bidi
568 iterator with IT's position. (Bug#7616)
569 (find_row_edges): If ROW->start.pos gives position
570 smaller than min_pos, use it as ROW->minpos. (Bug#7616)
571 (handle_stop, back_to_previous_visible_line_start, reseat_1):
572 Reset the from_disp_prop_p flag.
573 (SAVE_IT, RESTORE_IT): New macros.
574 (pos_visible_p, face_before_or_after_it_pos)
575 (back_to_previous_visible_line_start)
576 (move_it_in_display_line_to, move_it_in_display_line)
577 (move_it_to, move_it_vertically_backward, move_it_by_lines)
578 (try_scrolling, redisplay_window, display_line): Use them when
579 saving a temporary copy of the iterator and restoring it back.
580 (back_to_previous_visible_line_start, reseat_1)
581 (init_iterator): Empty the bidi cache "stack".
582 (move_it_in_display_line_to): If iterator ended up at
583 EOL, but we never saw any buffer positions smaller than
584 to_charpos, return MOVE_POS_MATCH_OR_ZV. Fixes vertical cursor
585 motion in bidi-reordered lines.
586 (move_it_in_display_line_to): Record prev_method and prev_pos
587 immediately before the call to set_iterator_to_next. Fixes cursor
588 motion in bidi-reordered lines with stretch glyphs and strings
589 displayed in margins. (Bug#8133) (Bug#8867)
590 Return MOVE_POS_MATCH_OR_ZV only if iterator position is past
591 TO_CHARPOS.
592 (pos_visible_p): Support positions in bidi-reordered lines. Save
593 and restore bidi cache.
594
595 * bidi.c (bidi_level_of_next_char): clen should be EMACS_NT, not int.
596 (bidi_paragraph_info): Delete unused struct.
597 (bidi_cache_idx, bidi_cache_last_idx): Declare EMACS_INT.
598 (bidi_cache_start): New variable.
599 (bidi_cache_reset): Reset bidi_cache_idx to bidi_cache_start, not
600 to zero.
601 (bidi_cache_fetch_state, bidi_cache_search)
602 (bidi_cache_find_level_change, bidi_cache_iterator_state)
603 (bidi_cache_find, bidi_peek_at_next_level)
604 (bidi_level_of_next_char, bidi_find_other_level_edge)
605 (bidi_move_to_visually_next): Compare cache index with
606 bidi_cache_start rather than with zero.
607 (bidi_fetch_char): Accept new argument STRING; all callers
608 changed. Support iteration over a string. Support strings with
609 display properties. Support unibyte strings. Fix the type of
610 `len' according to what STRING_CHAR_AND_LENGTH expects.
611 (bidi_paragraph_init, bidi_resolve_explicit_1)
612 (bidi_resolve_explicit, bidi_resolve_weak)
613 (bidi_level_of_next_char, bidi_move_to_visually_next): Support
614 iteration over a string.
615 (bidi_set_sor_type, bidi_resolve_explicit_1)
616 (bidi_resolve_explicit, bidi_type_of_next_char): ignore_bn_limit
617 can now be zero (for strings); special values 0 and -1 were
618 changed to -1 and -2, respectively.
619 (bidi_char_at_pos): New function.
620 (bidi_paragraph_init, bidi_resolve_explicit, bidi_resolve_weak):
621 Call it instead of FETCH_MULTIBYTE_CHAR.
622 (bidi_move_to_visually_next): Abort if charpos or bytepos were not
623 initialized to valid values.
624 (bidi_init_it): Don't initialize charpos and bytepos with invalid
625 values.
626 (bidi_level_of_next_char): Allow the sentinel "position" to pass
627 the test for valid cached positions. Fix the logic for looking up
628 the sentinel state in the cache. GCPRO the Lisp string we are
629 iterating.
630 (bidi_push_it, bidi_pop_it): New functions.
631 (bidi_initialize): Initialize the bidi cache start stack pointer.
632 (bidi_cache_ensure_space): New function, refactored from part of
633 bidi_cache_iterator_state. Don't assume the required size is just
634 one BIDI_CACHE_CHUNK away.
635 (bidi_cache_start_stack, bidi_push_it): Use IT_STACK_SIZE.
636 (bidi_count_bytes, bidi_char_at_pos): New functions.
637 (bidi_cache_search): Don't assume bidi_cache_last_idx is
638 always valid if bidi_cache_idx is valid.
639 (bidi_cache_find_level_change): xassert that bidi_cache_last_idx
640 is valid if it's going to be used.
641 (bidi_shelve_cache, bidi_unshelve_cache): New functions.
642 (bidi_cache_fetch_state, bidi_cache_search)
643 (bidi_cache_find_level_change, bidi_cache_ensure_space)
644 (bidi_cache_iterator_state, bidi_cache_find)
645 (bidi_find_other_level_edge, bidi_cache_start_stack): All
646 variables related to cache indices are now EMACS_INT.
647
648 * dispextern.h (struct bidi_string_data): New structure.
649 (struct bidi_it): New member `string'. Make flag members be 1-bit
650 fields, and put them last in the struct.
651 (compute_display_string_pos, compute_display_string_end): Update
652 prototypes.
653 (bidi_push_it, bidi_pop_it): Add prototypes.
654 (struct iterator_stack_entry): New members bidi_p,
655 paragraph_embedding, and from_disp_prop_p.
656 (struct it): Member bidi_p is now a bit field 1 bit wide.
657 (bidi_shelve_cache, bidi_unshelve_cache): Declare
658 prototypes.
659
660 * .gdbinit (xvectype, xvector, xcompiled, xchartable, xboolvector)
661 (xpr, xfont, xbacktrace): Use "header.size" when accessing vectors
662 and vector-like objects.
663
664 * dispnew.c (buffer_posn_from_coords): Save and restore the bidi
665 cache around display iteration.
666
667 * window.c (Fwindow_end, window_scroll_pixel_based)
668 (displayed_window_lines, Frecenter): Save and restore the bidi
669 cache around display iteration.
670
671 2011-07-14 Lars Magne Ingebrigtsen <larsi@gnus.org>
672
673 * editfns.c (Fdelete_region): Clarify the use of the named
674 parameters (bug#6788).
675
676 2011-07-14 Martin Rudalics <rudalics@gmx.at>
677
678 * indent.c (Fvertical_motion): Set and restore w->pointm when
679 saving and restoring the window's buffer (Bug#9006).
680
681 2011-07-13 Lars Magne Ingebrigtsen <larsi@gnus.org>
682
683 * editfns.c (Fstring_to_char): Clarify just what is returned
684 (bug#6576). Text by Eli Zaretskii.
685
686 2011-07-13 Juanma Barranquero <lekktu@gmail.com>
687
688 * gnutls.c (init_gnutls_functions): Honor gnutls_log_level (bug#9059).
689
690 2011-07-13 Eli Zaretskii <eliz@gnu.org>
691
692 * buffer.c (mmap_find): Fix a typo.
693
694 2011-07-13 Johan Bockgård <bojohan@gnu.org>
695
696 Fix execution of x selection hooks.
697 * xselect.c (Qx_lost_selection_functions)
698 (Qx_sent_selection_functions): New vars.
699 (syms_of_xselect): DEFSYM them.
700 (x_handle_selection_request): Pass Qx_sent_selection_functions
701 rather than Vx_sent_selection_functions to Frun_hook_with_args.
702 (x_handle_selection_clear,x_clear_frame_selections):
703 Pass Qx_lost_selection_functions rather than
704 Vx_lost_selection_functions to Frun_hook_with_args.
705
706 2011-07-13 Paul Eggert <eggert@cs.ucla.edu>
707
708 * buffer.c (Fget_buffer_create): Initialize inhibit_shrinking.
709 The old code sometimes used this field without initializing it.
710
711 * alloc.c (gc_sweep): Don't read past end of array.
712 In theory, the old code could also have corrupted Emacs internals,
713 though it'd be very unlikely.
714
715 2011-07-12 Andreas Schwab <schwab@linux-m68k.org>
716
717 * character.c (Fcharacterp): Don't advertise optional ignored
718 argument. (Bug#4026)
719
720 2011-07-12 Lars Magne Ingebrigtsen <larsi@gnus.org>
721
722 * keymap.c (syms_of_keymap): Clarify that "modifier" is "modifier
723 key" (bug#4257).
724
725 * window.c (Fset_window_start): Doc fix (bug#4199).
726 (Fset_window_hscroll): Ditto.
727
728 2011-07-12 Paul Eggert <eggert@cs.ucla.edu>
729
730 Fix minor new problems caught by GCC 4.6.1.
731 * term.c (init_tty): Remove unused local.
732 * xsettings.c (store_monospaced_changed): Define this function only
733 if (defined HAVE_GSETTINGS || defined HAVE_GCONF), as it's
734 not used otherwise.
735
736 2011-07-12 Chong Yidong <cyd@stupidchicken.com>
737
738 * xdisp.c (Vresize_mini_windows): Minor doc fix (Bug#3300).
739
740 2011-07-11 Lars Magne Ingebrigtsen <larsi@gnus.org>
741
742 * xdisp.c (syms_of_xdisp): Make it explicit that the mini-windows
743 are the mini-buffer and the echo area (bug#3320).
744
745 * term.c (init_tty): Remove support for supdup, c10 and perq
746 terminals, which are no longer supported (bug#1482).
747
748 2011-07-10 Johan Bockgård <bojohan@gnu.org>
749
750 * xdisp.c (Ftool_bar_lines_needed): Fix WINDOWP check.
751
752 2011-07-10 Jan Djärv <jan.h.d@swipnet.se>
753
754 * xmenu.c (menu_highlight_callback): Only pass frame to show_help_event
755 for non-popups (Bug#3642).
756
757 2011-07-10 Andreas Schwab <schwab@linux-m68k.org>
758
759 * alloc.c (reset_malloc_hooks): Protoize.
760 * buffer.c (mmap_init, mmap_find, mmap_free_1, mmap_enlarge)
761 (mmap_set_vars, mmap_alloc, mmap_free, mmap_realloc): Likewise.
762 * cm.c (losecursor): Likewise.
763 * data.c (fmod): Likewise.
764 * dispnew.c (swap_glyphs_in_rows): Likewise.
765 * emacs.c (memory_warning_signal): Likewise.
766 * floatfns.c (float_error): Likewise.
767 * font.c (check_gstring, check_otf_features, otf_tag_symbol)
768 (otf_open, font_otf_capability, generate_otf_features)
769 (font_otf_DeviceTable, font_otf_ValueRecord, font_otf_Anchor):
770 Likewise.
771 * image.c (pbm_read_file): Likewise.
772 * indent.c (string_display_width): Likewise.
773 * intervals.c (check_for_interval, search_for_interval)
774 (inc_interval_count, count_intervals, root_interval)
775 (adjust_intervals_for_insertion, make_new_interval): Likewise.
776 * lread.c (defalias): Likewise.
777 * ralloc.c (r_alloc_check): Likewise.
778 * regex.c (set_image_of_range_1, set_image_of_range)
779 (regex_grow_registers): Likewise.
780 * sysdep.c (strerror): Likewise.
781 * termcap.c (valid_filename_p, tprint, main): Likewise.
782 * tparam.c (main): Likewise.
783 * unexhp9k800.c (run_time_remap, save_data_space)
784 (update_file_ptrs, read_header, write_header, calculate_checksum)
785 (copy_file, copy_rest, display_header): Likewise.
786 * widget.c (mark_shell_size_user_specified, create_frame_gcs):
787 Likewise.
788 * xdisp.c (check_it): Likewise.
789 * xfaces.c (register_color, unregister_color, unregister_colors):
790 Likewise.
791 * xfns.c (print_fontset_result): Likewise.
792 * xrdb.c (member, fatal, main): Likewise.
793
794 2011-07-10 Paul Eggert <eggert@cs.ucla.edu>
795
796 Fix minor problems found by static checking (Bug#9031).
797 * chartab.c (char_table_set_range, map_sub_char_table):
798 Remove unused locals.
799 (uniprop_table): Now static.
800 * composite.c (_work_char): Remove unused static var.
801
802 2011-07-09 Juanma Barranquero <lekktu@gmail.com>
803
804 * chartab.c (uniprop_table_uncompress): Remove unused local variable.
805
806 2011-07-09 Jan Djärv <jan.h.d@swipnet.se>
807
808 * gtkutil.c (qttip_cb): Remove code without function.
809
810 2011-07-09 Eli Zaretskii <eliz@gnu.org>
811
812 * w32.c (pthread_sigmask): New stub.
813
814 2011-07-08 Paul Eggert <eggert@cs.ucla.edu>
815
816 Use pthread_sigmask, not sigprocmask (Bug#9010).
817 sigprocmask is portable only for single-threaded applications, and
818 Emacs can be multi-threaded when it uses GTK.
819 * Makefile.in (LIB_PTHREAD_SIGMASK): New macro.
820 (LIBES): Use it.
821 * callproc.c (Fcall_process):
822 * process.c (create_process):
823 * sysdep.c (sys_sigblock, sys_sigunblock, sys_sigsetmask):
824 Use pthread_sigmask, not sigprocmask.
825
826 2011-07-08 Jan Djärv <jan.h.d@swipnet.se>
827
828 * gtkutil.c (qttip_cb): Set line wrap to FALSE for tooltip widget.
829 (xg_prepare_tooltip): Revert text in x->ttip_lbl, margins was
830 wrong (Bug#8591).
831
832 2011-07-08 Jan Djärv <jan.h.d@swipnet.se>
833
834 * gtkutil.c (xg_prepare_tooltip): Fix indentation and comment.
835 Put text in x->ttip_lbl instead of gtk_tooltip_set_text (Bug#8591).
836 (xg_hide_tooltip): Fix comment.
837
838 * nsterm.m (initFrameFromEmacs): Don't use ns_return_types
839 in registerServicesMenuSendTypes.
840 (validRequestorForSendType): Don't check ns_return_types.
841
842 * nsfns.m (Fx_open_connection): Put NSStringPboardType into
843 ns_return_type.
844
845 2011-07-08 Jason Rumney <jasonr@gnu.org>
846
847 * w32fns.c (w32_wnd_proc) [WM_TIMER, WM_SET_CURSOR]: Avoid using
848 frame struct members of non-existent frames (Bug#6284).
849
850 2011-07-08 Jan Djärv <jan.h.d@swipnet.se>
851
852 * nsterm.m (keyDown): Call to wantsToDelayTextChangeNotifications and
853 variable firstTime not needed on OSX >= 10.6.
854 (setPosition): setFloatValue:knobProportion: is deprecated on OSX
855 >= 10.5. Use setKnobProportion, setDoubleValue.
856
857 * nsterm.h (MAC_OS_X_VERSION_10_3, MAC_OS_X_VERSION_10_4)
858 (MAC_OS_X_VERSION_10_5): Define if not defined.
859 (EmacsView, EmacsTooltip): Implements NSWindowDelegate on OSX >= 10.6.
860 (EmacsMenu): Implements NSMenuDelegate on OSX >= 10.6.
861 (EmacsToolbar): Implements NSToolbarDelegate on OSX >= 10.6.
862
863 * nsselect.m (ns_string_from_pasteboard): Don't use deprecated methods
864 cString and lossyCString on OSX >= 10.4
865
866 * nsmenu.m (fillWithWidgetValue): Don't use depercated method
867 sizeToFit on OSX >= 10.2.
868
869 * nsimage.m (allocInitFromFile): Don't use deprecated method
870 bestRepresentationForDevice on OSX >= 10.6.
871
872 * nsfns.m (check_ns_display_info): Cast to long and use %ld in error
873 to avoid warning.
874
875 * emacs.c: Declare unexec_init_emacs_zone.
876
877 * nsgui.h: Fix compiler warning about gnulib redefining verify.
878
879 * nsselect.m (ns_get_local_selection): Change to extern (Bug#8842).
880
881 * nsmenu.m (ns_update_menubar): Remove useless setDelegate call
882 on svcsMenu (Bug#8842).
883
884 * nsfns.m (Fx_open_connection): Remove NSStringPboardType from
885 ns_return_types.
886 (Fns_list_services): Just return Qnil on 10.6, code not working there.
887
888 * nsterm.m (QUTF8_STRING): Declare.
889 (initFrameFromEmacs): Call registerServicesMenuSendTypes.
890 (validRequestorForSendType): Return type is (id).
891 Change indexOfObjectIdenticalTo to indexOfObject.
892 Check if we have local selection before returning self (Bug#8842).
893 (writeSelectionToPasteboard): Put local selection into paste board
894 if we have a local selection (Bug#8842).
895 (syms_of_nsterm): DEFSYM QUTF8_STRING.
896
897 * nsterm.h (MAC_OS_X_VERSION_10_6): Define here instead of nsterm.m.
898 (ns_get_local_selection): Declare.
899
900 2011-07-07 Lars Magne Ingebrigtsen <larsi@gnus.org>
901
902 * keymap.c (describe_map_tree): Don't insert a double newline at
903 the end of the buffer (bug#1169) and return whether we inserted
904 something.
905
906 * callint.c (Fcall_interactively): Change "reading args" to
907 "providing args" to try to clarify what it does (bug#1010).
908
909 2011-07-07 Kenichi Handa <handa@m17n.org>
910
911 * composite.c (composition_compute_stop_pos): Ignore a static
912 composition starting before CHARPOS (Bug#8915).
913
914 * xdisp.c (handle_composition_prop): Likewise.
915
916 2011-07-07 Eli Zaretskii <eliz@gnu.org>
917
918 * term.c (produce_glyphs) <xassert>: Allow IT_GLYPHLESS in it->what.
919 (Bug#9015)
920
921 2011-07-07 Kenichi Handa <handa@m17n.org>
922
923 * character.h (unicode_category_t): New enum type.
924
925 * chartab.c (uniprop_decoder_t, uniprop_encoder_t): New types.
926 (Qchar_code_property_table): New variable.
927 (UNIPROP_TABLE_P, UNIPROP_GET_DECODER)
928 (UNIPROP_COMPRESSED_FORM_P): New macros.
929 (char_table_ascii): Uncompress the compressed values.
930 (sub_char_table_ref): New arg is_uniprop. Callers changed.
931 Uncompress the compressed values.
932 (sub_char_table_ref_and_range): Likewise.
933 (char_table_ref_and_range): Uncompress the compressed values.
934 (sub_char_table_set): New arg is_uniprop. Callers changed.
935 Uncompress the compressed values.
936 (sub_char_table_set_range): Args changed. Callers changed.
937 (char_table_set_range): Adjuted for the above change.
938 (map_sub_char_table): Delete args default_val and parent. Add arg
939 top. Give decoded values to a Lisp function.
940 (map_char_table): Adjusted for the above change. Give decoded
941 values to a Lisp function. Gcpro more variables.
942 (uniprop_table_uncompress)
943 (uniprop_decode_value_run_length): New functions.
944 (uniprop_decoder, uniprop_decoder_count): New variables.
945 (uniprop_get_decoder, uniprop_encode_value_character)
946 (uniprop_encode_value_run_length, uniprop_encode_value_numeric):
947 New functions.
948 (uniprop_encoder, uniprop_encoder_count): New variables.
949 (uniprop_get_encoder, uniprop_table)
950 (Funicode_property_table_internal, Fget_unicode_property_internal)
951 (Fput_unicode_property_internal): New functions.
952 (syms_of_chartab): DEFSYM Qchar_code_property_table, defsubr
953 Sunicode_property_table_internal, Sget_unicode_property_internal,
954 and Sput_unicode_property_internal. Defvar_lisp
955 char-code-property-alist.
956
957 * composite.c (CHAR_COMPOSABLE_P): Adjusted for the change of
958 Vunicode_category_table.
959
960 * font.c (font_range): Adjusted for the change of
961 Vunicode_category_table.
962
963 2011-07-07 Dan Nicolaescu <dann@ics.uci.edu>
964
965 * m/iris4d.h: Remove file, move contents ...
966 * s/irix6-5.h: ... here.
967
968 2011-07-06 Paul Eggert <eggert@cs.ucla.edu>
969
970 Remove unportable assumption about struct layout (Bug#8884).
971 * alloc.c (mark_buffer):
972 * buffer.c (reset_buffer_local_variables, Fbuffer_local_variables)
973 (clone_per_buffer_values): Don't assume that
974 sizeof (struct buffer) is a multiple of sizeof (Lisp_Object).
975 This isn't true in general, and it's particularly not true
976 if Emacs is configured with --with-wide-int.
977 * buffer.h (FIRST_FIELD_PER_BUFFER, LAST_FIELD_PER_BUFFER):
978 New macros, used in the buffer.c change.
979
980 2011-07-05 Jan Djärv <jan.h.d@swipnet.se>
981
982 * xsettings.c: Use both GConf and GSettings if both are available.
983 (store_config_changed_event): Add comment.
984 (dpyinfo_valid, store_font_name_changed, map_tool_bar_style)
985 (store_tool_bar_style_changed): New functions.
986 (store_monospaced_changed): Add comment. Call dpyinfo_valid.
987 (struct xsettings): Move font inside HAVE_XFT.
988 (GSETTINGS_TOOL_BAR_STYLE, GSETTINGS_FONT_NAME): New defines.
989 (GSETTINGS_MONO_FONT): Renamed from SYSTEM_MONO_FONT.
990 Move inside HAVE_XFT.
991 (something_changed_gsettingsCB): Renamed from something_changedCB.
992 Check for changes in GSETTINGS_TOOL_BAR_STYLE and GSETTINGS_FONT_NAME
993 also.
994 (GCONF_TOOL_BAR_STYLE, GCONF_FONT_NAME): New defines.
995 (GCONF_MONO_FONT): Renamed from SYSTEM_MONO_FONT. Move inside HAVE_XFT.
996 (something_changed_gconfCB): Renamed from something_changedCB.
997 Check for changes in GCONF_TOOL_BAR_STYLE and GCONF_FONT_NAME also.
998 (parse_settings): Move check for font inside HAVE_XFT.
999 (read_settings, apply_xft_settings): Add comment.
1000 (read_and_apply_settings): Add comment. Call map_tool_bar_style and
1001 store_tool_bar_style_changed. Move check for font inside HAVE_XFT and
1002 call store_font_name_changed.
1003 (xft_settings_event): Add comment.
1004 (init_gsettings): Add comment. Get values for GSETTINGS_TOOL_BAR_STYLE
1005 and GSETTINGS_FONT_NAME. Move check for fonts within HAVE_XFT.
1006 (init_gconf): Add comment. Get values for GCONF_TOOL_BAR_STYLE
1007 and GCONF_FONT_NAME. Move check for fonts within HAVE_XFT.
1008 (xsettings_initialize): Call init_gsettings last.
1009 (xsettings_get_system_font, xsettings_get_system_normal_font): Add
1010 comment.
1011
1012 2011-07-05 Paul Eggert <eggert@cs.ucla.edu>
1013
1014 Random fixes. E.g., (random) never returned negative values.
1015 * fns.c (Frandom): Use GET_EMACS_TIME for random seed, and add the
1016 subseconds part to the entropy, as that's a bit more random.
1017 Prefer signed to unsigned, since the signedness doesn't matter and
1018 in general we prefer signed. When given a limit, use a
1019 denominator equal to INTMASK + 1, not to VALMASK + 1, because the
1020 latter isn't right if USE_2_TAGS_FOR_INTS.
1021 * sysdep.c (get_random): Return a value in the range 0..INTMASK,
1022 not 0..VALMASK. Don't discard "excess" bits that random () returns.
1023
1024 2011-07-04 Stefan Monnier <monnier@iro.umontreal.ca>
1025
1026 * textprop.c (text_property_stickiness):
1027 Obey Vtext_property_default_nonsticky.
1028 (syms_of_textprop): Add `display' to Vtext_property_default_nonsticky.
1029 * w32fns.c (syms_of_w32fns):
1030 * xfns.c (syms_of_xfns): Don't Add `display' since it's there by default.
1031
1032 2011-07-04 Paul Eggert <eggert@cs.ucla.edu>
1033
1034 * fileio.c (barf_or_query_if_file_exists): Use S_ISDIR.
1035 This is more efficient than Ffile_directory_p and avoids a minor race.
1036
1037 2011-07-04 Lars Magne Ingebrigtsen <larsi@gnus.org>
1038
1039 * buffer.c (Foverlay_put): Say what the return value is
1040 (bug#7835).
1041
1042 * fileio.c (barf_or_query_if_file_exists): Check first if the file
1043 is a directory before asking whether to use the file name
1044 (bug#7564).
1045 (barf_or_query_if_file_exists): Make the "File is a directory"
1046 error be more correct.
1047
1048 * fns.c (Frequire): Remove the mention of the .gz files, since
1049 that's installation-specific, but keep the mention of
1050 `get-load-suffixes'.
1051
1052 2011-07-04 Paul Eggert <eggert@cs.ucla.edu>
1053
1054 * editfns.c (Fformat_time_string): Don't assume strlen fits in int.
1055 Report string overflow if the output is too long.
1056
1057 2011-07-04 Juanma Barranquero <lekktu@gmail.com>
1058
1059 * gnutls.c (Fgnutls_boot): Don't mention :verify-error.
1060 (syms_of_gnutls): Remove duplicate DEFSYM for
1061 Qgnutls_bootprop_verify_hostname_error, an error for
1062 Qgnutls_bootprop_verify_error (which is no longer used).
1063
1064 * eval.c (find_handler_clause): Remove parameters `sig' and `data',
1065 unused since 2011-01-26T20:02:07Z!monnier@iro.umontreal.ca. All callers changed.
1066 Also (re)move comments that are misplaced or no longer relevant.
1067
1068 2011-07-03 Lars Magne Ingebrigtsen <larsi@gnus.org>
1069
1070 * callint.c (Finteractive): Clarify the meaning of "@" (bug#8813).
1071
1072 2011-07-03 Chong Yidong <cyd@stupidchicken.com>
1073
1074 * xfaces.c (Finternal_merge_in_global_face): Modify the foreground
1075 and background color parameters if they have been changed.
1076
1077 2011-07-03 Lars Magne Ingebrigtsen <larsi@gnus.org>
1078
1079 * editfns.c (Fformat): Clarify the - and 0 flags (bug#6659).
1080
1081 2011-07-03 Paul Eggert <eggert@cs.ucla.edu>
1082
1083 * xsettings.c (SYSTEM_FONT): Define only when used.
1084 No need to define when HAVE_GSETTINGS || !HAVE_XFT.
1085
1086 * keymap.c (access_keymap_1): Now static.
1087
1088 2011-07-02 Chong Yidong <cyd@stupidchicken.com>
1089
1090 * keyboard.c (command_loop_1): If a down-mouse event is unbound,
1091 leave any prefix arg for the up event (Bug#1586).
1092
1093 2011-07-02 Lars Magne Ingebrigtsen <larsi@gnus.org>
1094
1095 * lread.c (syms_of_lread): Mention single symbols defined by
1096 `defvar' or `defconst' (bug#7154).
1097
1098 * fns.c (Frequire): Mention .el.gz files (bug#7314).
1099 (Frequire): Mention get-load-suffixes.
1100
1101 2011-07-02 Martin Rudalics <rudalics@gmx.at>
1102
1103 * window.h (window): Remove clone_number slot.
1104 * window.c (Fwindow_clone_number, Fset_window_clone_number):
1105 Remove.
1106 (make_parent_window, make_window, saved_window)
1107 (Fset_window_configuration, save_window_save): Don't deal with
1108 clone numbers.
1109 * buffer.c (Qclone_number): Remove declaration.
1110 (sort_overlays, overlay_strings): Don't deal with clone numbers.
1111
1112 2011-07-02 Stefan Monnier <monnier@iro.umontreal.ca>
1113
1114 Add multiple inheritance to keymaps.
1115 * keymap.c (Fmake_composed_keymap): New function.
1116 (Fset_keymap_parent): Simplify.
1117 (fix_submap_inheritance): Remove.
1118 (access_keymap_1): New function extracted from access_keymap to handle
1119 embedded parents and handle lists of maps.
1120 (access_keymap): Use it.
1121 (Fkeymap_prompt, map_keymap_internal, map_keymap, store_in_keymap)
1122 (Fcopy_keymap): Handle embedded parents.
1123 (Fcommand_remapping, define_as_prefix): Simplify.
1124 (Fkey_binding): Simplify.
1125 (syms_of_keymap): Move minibuffer-local-completion-map,
1126 minibuffer-local-filename-completion-map,
1127 minibuffer-local-must-match-map, and
1128 minibuffer-local-filename-must-match-map to Elisp.
1129 (syms_of_keymap): Defsubr make-composed-keymap.
1130 * keyboard.c (menu_bar_items): Use map_keymap_canonical.
1131 (parse_menu_item): Trivial simplification.
1132
1133 2011-07-01 Glenn Morris <rgm@gnu.org>
1134
1135 * Makefile.in (SETTINGS_LIBS): Fix typo.
1136
1137 2011-07-01 Kazuhiro Ito <kzhr@d1.dion.ne.jp> (tiny patch)
1138
1139 * coding.c (Fencode_coding_string): Record the last coding system
1140 used, as the function doc string says (bug#8738).
1141
1142 2011-07-01 Jan Djärv <jan.h.d@swipnet.se>
1143
1144 * xsettings.c (store_monospaced_changed): Take new font as arg and
1145 check for change against current_mono_font.
1146 (EMACS_TYPE_SETTINGS): Remove this and related defines.
1147 (emacs_settings_constructor, emacs_settings_get_property)
1148 (emacs_settings_set_property, emacs_settings_class_init)
1149 (emacs_settings_init, gsettings_obj): Remove.
1150 (something_changedCB): New function for HAVE_GSETTINGS.
1151 (something_changedCB): HAVE_GCONF: Call store_monospaced_changed
1152 with value as argument.
1153 (init_gsettings): Check that GSETTINGS_SCHEMA exists before calling
1154 g_settings_new (Bug#8967). Do not create gsettings_obj.
1155 Remove calls to g_settings_bind. Connect something_changedCB to
1156 "changed".
1157
1158 * xgselect.c: Add defined (HAVE_GSETTINGS).
1159 (xgselect_initialize): Ditto.
1160
1161 * process.c: Add defined (HAVE_GSETTINGS) for xgselect.h
1162 (wait_reading_process_output): Add defined (HAVE_GSETTINGS) for
1163 xg_select.
1164
1165 2011-07-01 Paul Eggert <eggert@cs.ucla.edu>
1166
1167 * eval.c (struct backtrace): Simplify and port the data structure.
1168 Do not assume that "int nargs : BITS_PER_INT - 2;" produces a
1169 signed bit field, as this assumption is not portable and it makes
1170 Emacs crash when compiled with Sun C 5.8 on sparc. Do not use
1171 "char debug_on_exit : 1" as this is not portable either; instead,
1172 use the portable "unsigned int debug_on_exit : 1". Remove unused
1173 member evalargs. Remove obsolete comments about cc bombing out.
1174
1175 2011-06-30 Jan Djärv <jan.h.d@swipnet.se>
1176
1177 * xsettings.c: Include glib-object.h, gio/gio.h if HAVE_GSETTINGS.
1178 Let HAVE_GSETTINGS override HAVE_GCONF.
1179 (store_monospaced_changed): New function.
1180 (EMACS_SETTINGS): A new type derived from GObject to handle
1181 GSettings notifications.
1182 (emacs_settings_constructor, emacs_settings_get_property)
1183 (emacs_settings_set_property, emacs_settings_class_init):
1184 New functions.
1185 (gsettings_client, gsettings_obj): New variables.
1186 (GSETTINGS_SCHEMA): New define.
1187 (something_changedCB): Call store_monospaced_changed.
1188 (init_gsettings): New function.
1189 (xsettings_initialize): Call init_gsettings.
1190 (syms_of_xsettings): Initialize gsettings_client, gsettings_obj
1191 to NULL.
1192
1193 * Makefile.in (SETTINGS_CFLAGS, SETTINGS_LIBS): Renamed from
1194 GCONF_CFLAGS/LIBS.
1195
1196 2011-06-29 Martin Rudalics <rudalics@gmx.at>
1197
1198 * window.c (resize_root_window, grow_mini_window)
1199 (shrink_mini_window): Rename Qresize_root_window to
1200 Qwindow_resize_root_window and Qresize_root_window_vertically to
1201 Qwindow_resize_root_window_vertically.
1202
1203 2011-06-28 Paul Eggert <eggert@cs.ucla.edu>
1204
1205 * gnutls.c (Qgnutls_bootprop_verify_error): Remove unused var.
1206
1207 2011-06-27 Juanma Barranquero <lekktu@gmail.com>
1208
1209 * makefile.w32-in: Redesign dependencies so they reflect more
1210 clearly which files are directly included by each source file,
1211 and not through other includes.
1212
1213 2011-06-27 Martin Rudalics <rudalics@gmx.at>
1214
1215 * buffer.c (Qclone_number): Declare static and DEFSYM it.
1216 (sort_overlays, overlay_strings): When an overlay's clone number
1217 matches the window's clone number process the overlay even if
1218 the overlay's window property doesn't match the current window.
1219
1220 * window.c (Fwindow_vchild): Rename to Fwindow_top_child.
1221 (Fwindow_hchild): Rename to Fwindow_left_child.
1222 (Fwindow_next): Rename to Fwindow_next_sibling.
1223 (Fwindow_prev): Rename to Fwindow_prev_sibling.
1224 (resize_window_check): Rename to window_resize_check.
1225 (resize_window_apply): Rename to window_resize_apply.
1226 (Fresize_window_apply): Rename to Fwindow_resize_apply.
1227 (Fdelete_other_windows_internal, resize_frame_windows)
1228 (Fsplit_window_internal, Fdelete_window_internal)
1229 (grow_mini_window, shrink_mini_window)
1230 (Fresize_mini_window_internal): Fix callers accordingly.
1231
1232 2011-06-26 Jan Djärv <jan.h.d@swipnet.se>
1233
1234 * emacsgtkfixed.h: State that this is only used with Gtk+3.
1235 (emacs_fixed_set_min_size): Remove.
1236 (emacs_fixed_new): Take frame as argument.
1237
1238 * emacsgtkfixed.c: State that this is only used with Gtk+3.
1239 (_EmacsFixedPrivate): Remove minwidth/height.
1240 Add struct frame *f.
1241 (emacs_fixed_init): Initialize priv->f.
1242 (get_parent_class, emacs_fixed_set_min_size): Remove.
1243 (emacs_fixed_new): Set priv->f to argument.
1244 (emacs_fixed_get_preferred_width)
1245 (emacs_fixed_get_preferred_height): Use min_width/height from
1246 frames size_hint to set minimum and natural (Bug#8919).
1247 (XSetWMSizeHints, XSetWMNormalHints): Override these functions
1248 and use min_width/height from frames size_hint to set
1249 min_width/height (Bug#8919).
1250
1251 * gtkutil.c (xg_create_frame_widgets): Pass f to emacs_fixed_new.
1252 (x_wm_set_size_hint): Remove call to emacs_fixed_set_min_size.
1253 Fix indentation.
1254
1255 2011-06-26 Eli Zaretskii <eliz@gnu.org>
1256
1257 * bidi.c (bidi_paragraph_init): Test for ZV_BYTE before calling
1258 bidi_at_paragraph_end, since fast_looking_at doesn't like to be
1259 called at ZV.
1260
1261 2011-06-26 Chong Yidong <cyd@stupidchicken.com>
1262
1263 * process.c (wait_reading_process_output): Bypass select if
1264 waiting for a cell while ignoring keyboard input, and input is
1265 pending. Suggested by Jan Djärv (Bug#8869).
1266
1267 2011-06-25 Paul Eggert <eggert@cs.ucla.edu>
1268
1269 Use gnulib's dup2 module instead of rolling our own.
1270 * sysdep.c (dup2) [!HAVE_DUP2]: Remove; gnulib now does this.
1271
1272 2011-06-25 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
1273
1274 * dispnew.c (scrolling_window): Before scrolling, turn off a
1275 mouse-highlight in the window being scrolled.
1276
1277 2011-06-24 Juanma Barranquero <lekktu@gmail.com>
1278
1279 Move DEFSYM to lisp.h and use everywhere.
1280
1281 * character.h (DEFSYM): Move declaration...
1282 * lisp.h (DEFSYM): ...here.
1283
1284 * gnutls.c:
1285 * minibuf.c:
1286 * w32menu.c:
1287 * w32proc.c:
1288 * w32select.c: Don't include character.h.
1289
1290 * alloc.c (syms_of_alloc):
1291 * buffer.c (syms_of_buffer):
1292 * bytecode.c (syms_of_bytecode):
1293 * callint.c (syms_of_callint):
1294 * casefiddle.c (syms_of_casefiddle):
1295 * casetab.c (init_casetab_once):
1296 * category.c (init_category_once, syms_of_category):
1297 * ccl.c (syms_of_ccl):
1298 * cmds.c (syms_of_cmds):
1299 * composite.c (syms_of_composite):
1300 * dbusbind.c (syms_of_dbusbind):
1301 * dired.c (syms_of_dired):
1302 * dispnew.c (syms_of_display):
1303 * doc.c (syms_of_doc):
1304 * editfns.c (syms_of_editfns):
1305 * emacs.c (syms_of_emacs):
1306 * eval.c (syms_of_eval):
1307 * fileio.c (syms_of_fileio):
1308 * fns.c (syms_of_fns):
1309 * frame.c (syms_of_frame):
1310 * fringe.c (syms_of_fringe):
1311 * insdel.c (syms_of_insdel):
1312 * keymap.c (syms_of_keymap):
1313 * lread.c (init_obarray, syms_of_lread):
1314 * macros.c (syms_of_macros):
1315 * msdos.c (syms_of_msdos):
1316 * print.c (syms_of_print):
1317 * process.c (syms_of_process):
1318 * search.c (syms_of_search):
1319 * sound.c (syms_of_sound):
1320 * syntax.c (init_syntax_once, syms_of_syntax):
1321 * terminal.c (syms_of_terminal):
1322 * textprop.c (syms_of_textprop):
1323 * undo.c (syms_of_undo):
1324 * w32.c (globals_of_w32):
1325 * window.c (syms_of_window):
1326 * xdisp.c (syms_of_xdisp):
1327 * xfaces.c (syms_of_xfaces):
1328 * xfns.c (syms_of_xfns):
1329 * xmenu.c (syms_of_xmenu):
1330 * xsettings.c (syms_of_xsettings):
1331 * xterm.c (syms_of_xterm): Use DEFSYM.
1332
1333 2011-06-24 Teodor Zlatanov <tzz@lifelogs.com>
1334
1335 * gnutls.c (syms_of_gnutls): Use the DEFSYM macro from character.h.
1336
1337 2011-06-23 Paul Eggert <eggert@cs.ucla.edu>
1338
1339 Integer and buffer overflow fixes (Bug#8873).
1340
1341 * print.c (printchar, strout): Check for string overflow.
1342 (PRINTPREPARE, printchar, strout):
1343 Don't set size unless allocation succeeds.
1344
1345 * minibuf.c (read_minibuf_noninteractive): Use ptrdiff_t, not int,
1346 for sizes. Check for string overflow more accurately.
1347 Simplify newline removal at end; this suppresses a GCC 4.6.0 warning.
1348
1349 * macros.c: Integer and buffer overflow fixes.
1350 * keyboard.h (struct keyboard.kbd_macro_bufsize):
1351 * macros.c (Fstart_kbd_macro, store_kbd_macro_char):
1352 Use ptrdiff_t, not int, for sizes.
1353 Don't increment bufsize until after realloc succeeds.
1354 Check for size-calculation overflow.
1355 (Fstart_kbd_macro): Use EMACS_INT, not int, for XINT result.
1356
1357 * lisp.h (DEFVAR_KBOARD): Use offsetof instead of char * finagling.
1358
1359 * lread.c: Integer overflow fixes.
1360 (read_integer): Radix is now EMACS_INT, not int,
1361 to improve quality of diagnostics for out-of-range radices.
1362 Calculate buffer size correctly for out-of-range radices.
1363 (read1): Check for integer overflow in radices, and in
1364 read-circle numbers.
1365 (read_escape): Avoid int overflow.
1366 (Fload, openp, read_buffer_size, read1)
1367 (substitute_object_recurse, read_vector, read_list, map_obarray):
1368 Use ptrdiff_t, not int, for sizes.
1369 (read1): Use EMACS_INT, not int, for sizes.
1370 Check for size overflow.
1371
1372 * image.c (cache_image): Check for size arithmetic overflow.
1373
1374 * lread.c: Integer overflow issues.
1375 (saved_doc_string_size, saved_doc_string_length)
1376 (prev_saved_doc_string_size, prev_saved_doc_string_length):
1377 Now ptrdiff_t, not int.
1378 (read1): Don't assume doc string length fits in int. Check for
1379 out-of-range doc string lengths.
1380 (read_list): Don't assume file position fits in int.
1381 (read_escape): Check for hex character overflow.
1382
1383 2011-06-22 Leo Liu <sdl.web@gmail.com>
1384
1385 * minibuf.c (Fcompleting_read_default, Vcompleting_read_function):
1386 Move to minibuffer.el.
1387
1388 2011-06-22 Paul Eggert <eggert@cs.ucla.edu>
1389
1390 Fixes for GLYPH_DEBUG found by GCC 4.6.0 static checking.
1391 The following patches are for when GLYPH_DEBUG && !XASSERT.
1392 * dispextern.h (trace_redisplay_p, dump_glyph_string):
1393 * dispnew.c (flush_stdout):
1394 * xdisp.c (dump_glyph_row, dump_glyph_matrix, dump_glyph):
1395 Mark as externally visible.
1396 * dispnew.c (check_window_matrix_pointers): Now static.
1397 * dispnew.c (window_to_frame_vpos):
1398 * xfns.c (unwind_create_frame):
1399 * xterm.c (x_check_font): Remove unused local.
1400 * scroll.c (CHECK_BOUNDS):
1401 * xfaces.c (cache_fache): Rename local to avoid shadowing.
1402 * xfns.c, w32fns.c (image_cache_refcount, dpyinfo_refcount): Now static.
1403 * xdisp.c (check_window_end): Now a no-op if !XASSERTS.
1404 (debug_first_unchanged_at_end_vpos, debug_last_unchanged_at_beg_vpos)
1405 (debug_dvpos, debug_dy, debug_delta, debug_delta_bytes, debug_end_vpos):
1406 Now static.
1407 (debug_method_add): Use va_list and vsprintf rather than relying
1408 on undefined behavior with wrong number of arguments.
1409 (dump_glyph, dump_glyph_row, Fdump_glyph_matrix):
1410 Don't assume ptrdiff_t and EMACS_INT are the same width as int.
1411 In this code, it's OK to assume C99 behavior for ptrdiff_t formats
1412 since we're not interested in debugging glyphs with old libraries.
1413 * xfaces.c (cache_face): Move debugging code earlier; this pacifies
1414 GCC 4.6.0's static checking.
1415
1416 2011-06-22 Paul Eggert <eggert@cs.ucla.edu>
1417
1418 Integer overflow and signedness fixes (Bug#8873).
1419 A few related buffer overrun fixes, too.
1420
1421 * font.c (font_score): Use EMACS_INT, not int, to store XINT value.
1422
1423 * dispextern.h (struct face.stipple):
1424 * image.c (x_bitmap_height, x_bitmap_width, x_bitmap_pixmap)
1425 (x_bitmap_mask, x_allocate_bitmap_record)
1426 (x_create_bitmap_from_data, x_create_bitmap_from_file)
1427 (x_destroy_bitmap, x_destroy_all_bitmaps, x_create_bitmap_mask)
1428 (x_create_bitmap_from_xpm_data):
1429 * nsterm.h (struct ns_display_info.bitmaps_size, .bitmaps_last):
1430 * w32term.h (struct w32_display_info.icon_bitmap_id, .bitmaps_size)
1431 (.bitmaps_last):
1432 * xfaces.c (load_pixmap):
1433 * xterm.c (x_bitmap_icon, x_wm_set_icon_pixmap):
1434 * xterm.h (struct x_display_info.icon_bitmap_id, .bitmaps_size)
1435 (.bitmaps_last, struct x_output.icon_bitmap):
1436 Use ptrdiff_t, not int, for bitmap indexes.
1437 (x_allocate_bitmap_record): Check for size overflow.
1438 * dispextern.h, lisp.h: Adjust to API changes elsewhere.
1439
1440 Use ptrdiff_t, not int, for overlay counts.
1441 * buffer.h (overlays_at, sort_overlays, GET_OVERLAYS_AT):
1442 * editfns.c (overlays_around, get_pos_property):
1443 * textprop.c (get_char_property_and_overlay):
1444 * xdisp.c (next_overlay_change, note_mouse_highlight):
1445 * xfaces.c (face_at_buffer_position):
1446 * buffer.c (OVERLAY_COUNT_MAX): New macro.
1447 (overlays_at, overlays_in, sort_overlays, Foverlays_at)
1448 (Fnext_overlay_change, Fprevious_overlay_change)
1449 (mouse_face_overlay_overlaps, Foverlays_in):
1450 Use ptrdiff_t, not int, for sizes.
1451 (overlays_at, overlays_in): Check for size-calculation overflow.
1452
1453 * xterm.c (xim_initialize, same_x_server): Strlen may not fit in int.
1454
1455 * xsmfns.c (smc_save_yourself_CB, x_session_initialize): Avoid strlen.
1456 (x_session_initialize): Do not assume string length fits in int.
1457
1458 * xsettings.c (apply_xft_settings): Fix potential buffer overrun.
1459 This is unlikely, but can occur if DPI is outlandish.
1460
1461 * xsettings.c (Ffont_get_system_normal_font, Ffont_get_system_font):
1462 * xselect.c (Fx_get_atom_name): Avoid need for strlen.
1463
1464 * xrdb.c: Don't assume strlen fits in int; avoid some strlens.
1465 * xrdb.c (magic_file_p, search_magic_path):
1466 Omit last arg SUFFIX; it was always 0. All callers changed.
1467 (magic_file_p): Use ptrdiff_t, not int. Check for size overflow.
1468
1469 * xfont.c (xfont_match): Avoid need for strlen.
1470
1471 * xfns.c: Don't assume strlen fits in int.
1472 (xic_create_fontsetname, x_window): Use ptrdiff_t, not int.
1473
1474 * xdisp.c (message_log_check_duplicate): Return intmax_t,
1475 not unsigned long, as we prefer signed integers. All callers changed.
1476 Detect integer overflow in repeat count.
1477 (message_dolog): Don't assume print length fits in 39 bytes.
1478 (display_mode_element): Don't assume strlen fits in int.
1479
1480 * termcap.c: Don't assume sizes fit in int and never overflow.
1481 (struct termcap_buffer, tgetent): Use ptrdiff_t, not int, for sizes.
1482 (gobble_line): Check for size-calculation overflow.
1483
1484 * minibuf.c (Fread_buffer):
1485 * lread.c (intern, intern_c_string):
1486 * image.c (xpm_scan) [HAVE_NS && !HAVE_XPM]:
1487 Don't assume string length fits in int.
1488
1489 * keyboard.c (parse_tool_bar_item):
1490 * gtkutil.c (style_changed_cb): Avoid need for strlen.
1491
1492 * font.c: Don't assume string length fits in int.
1493 (font_parse_xlfd, font_parse_fcname, font_unparse_fcname):
1494 Use ptrdiff_t, not int.
1495 (font_intern_prop): Don't assume string length fits in int.
1496 Don't assume integer property fits in fixnum.
1497 * font.h (font_intern_prop): 2nd arg is now ptrdiff_t, not int.
1498
1499 * filelock.c: Fix some buffer overrun and integer overflow issues.
1500 (get_boot_time): Don't assume gzip command string fits in 100 bytes.
1501 Reformulate so as not to need the command string.
1502 Invoke gzip -cd rather than gunzip, as it's more portable.
1503 (lock_info_type, lock_file_1, lock_file):
1504 Don't assume pid_t and time_t fit in unsigned long.
1505 (LOCK_PID_MAX): Remove; we now use more-reliable bounds.
1506 (current_lock_owner): Prefer signed type for sizes.
1507 Use memcpy, not strncpy, where memcpy is what is really wanted.
1508 Don't assume (via atoi) that time_t and pid_t fit in int.
1509 Check for time_t and/or pid_t out of range, e.g., via a network share.
1510 Don't alloca where an auto var works fine.
1511
1512 * fileio.c: Fix some integer overflow issues.
1513 (file_name_as_directory, Fexpand_file_name, Fsubstitute_in_file_name):
1514 Don't assume string length fits in int.
1515 (directory_file_name): Don't assume string length fits in long.
1516 (make_temp_name): Don't assume pid fits in int, or that its print
1517 length is less than 20.
1518
1519 * data.c (Fsubr_name): Rewrite to avoid a strlen call.
1520
1521 * coding.c (make_subsidiaries): Don't assume string length fits in int.
1522
1523 * callproc.c (child_setup): Rewrite to avoid two strlen calls.
1524
1525 * process.c (Fformat_network_address): Use EMACS_INT, not EMACS_UINT.
1526 We prefer signed integers, even for size calculations.
1527
1528 * emacs.c: Don't assume string length fits in 'int'.
1529 (DEFINE_DUMMY_FUNCTION, sort_args): Use ptrdiff_t, not int.
1530 (main): Don't invoke strlen when not needed.
1531
1532 * dbusbind.c (XD_ERROR): Don't arbitrarily truncate string.
1533 (XD_DEBUG_MESSAGE): Don't waste a byte.
1534
1535 * callproc.c (getenv_internal_1, getenv_internal)
1536 (Fgetenv_internal):
1537 * buffer.c (init_buffer): Don't assume string length fits in 'int'.
1538
1539 * lread.c (invalid_syntax): Omit length argument.
1540 All uses changed. This doesn't fix a bug, but it simplifies the
1541 code away from its former Hollerith-constant appearance, and it's
1542 one less 'int' to worry about when looking at integer-overflow issues.
1543 (string_to_number): Simplify 2011-04-26 change by invoking xsignal1.
1544
1545 * lisp.h (DEFUN): Remove bogus use of sizeof (struct Lisp_Subr).
1546 This didn't break anything, but it didn't help either.
1547 It's confusing to put a bogus integer in a place where the actual
1548 value does not matter.
1549 (LIST_END_P): Remove unused macro and its bogus comment.
1550 (make_fixnum_or_float): Remove unnecessary cast to EMACS_INT.
1551
1552 * lisp.h (union Lisp_Object.i): EMACS_INT, not EMACS_UINT.
1553 This is for consistency with the ordinary, non-USE_LISP_UNION_TYPE,
1554 implementation.
1555 (struct Lisp_Bool_Vector.size): EMACS_INT, not EMACS_UINT.
1556 We prefer signed types, and the value cannot exceed the EMACS_INT
1557 range anyway (because otherwise the length would not be representable).
1558 (XSET) [USE_LISP_UNION_TYPE]: Use uintptr_t and intptr_t,
1559 not EMACS_UINT and EMACS_INT, when converting pointer to integer.
1560 This avoids a GCC warning when WIDE_EMACS_INT.
1561
1562 * indent.c (sane_tab_width): New function.
1563 (current_column, scan_for_column, Findent_to, position_indentation)
1564 (compute_motion): Use it. This is just for clarity.
1565 (Fcompute_motion): Don't assume hscroll and tab offset fit in int.
1566
1567 * image.c (xbm_image_p): Don't assume stated width, height fit in int.
1568
1569 * lisp.h (lint_assume): New macro.
1570 * composite.c (composition_gstring_put_cache):
1571 * ftfont.c (ftfont_shape_by_flt): Use it to pacify GCC 4.6.0.
1572
1573 * editfns.c, insdel.c:
1574 Omit unnecessary forward decls, to simplify future changes.
1575
1576 * ftfont.c (ftfont_shape_by_flt): Use signed integers for lengths.
1577
1578 * font.c (Ffont_shape_gstring): Don't assume glyph len fits in 'int'.
1579
1580 * fns.c (Ffillarray): Don't assume bool vector size fits in 'int'.
1581 Use much-faster test for byte-length change.
1582 Don't assume string byte-length fits in 'int'.
1583 Check that character arg fits in 'int'.
1584 (mapcar1): Declare byte as byte, for clarity.
1585
1586 * alloc.c (Fmake_bool_vector): Avoid unnecessary multiplication.
1587
1588 * fns.c (concat): Catch string overflow earlier.
1589 Do not rely on integer wraparound.
1590
1591 * dispextern.h (struct it.overlay_strings_charpos)
1592 (struct it.selective): Now EMACS_INT, not int.
1593 * xdisp.c (forward_to_next_line_start)
1594 (back_to_previous_visible_line_start)
1595 (reseat_at_next_visible_line_start, next_element_from_buffer):
1596 Don't arbitrarily truncate the value of 'selective' to int.
1597
1598 * xdisp.c (init_iterator): Use XINT, not XFASTINT; it might be < 0.
1599
1600 * composite.c: Don't truncate sizes to 'int'.
1601 (composition_gstring_p, composition_reseat_it)
1602 (composition_adjust_point): Use EMACS_INT, not int.
1603 (get_composition_id, composition_gstring_put_cache): Use EMACS_INT,
1604 not EMACS_UINT, for indexes.
1605
1606 * category.h (CATEGORY_SET_P): Remove unnecessary cast to EMACS_INT.
1607
1608 * buffer.c: Include <verify.h>.
1609 (struct sortvec.priority, struct sortstr.priority):
1610 Now EMACS_INT, not int.
1611 (compare_overlays, cmp_for_strings): Avoid subtraction overflow.
1612 (struct sortstr.size, record_overlay_string)
1613 (struct sortstrlist.size, struct sortlist.used):
1614 Don't truncate size to int.
1615 (record_overlay_string): Check for size-calculation overflow.
1616 (init_buffer_once): Check at compile-time, not run-time.
1617
1618 2011-06-22 Jim Meyering <meyering@redhat.com>
1619
1620 Don't leak an XBM-image-sized buffer
1621 * image.c (xbm_load): Free the image buffer after using it.
1622
1623 2011-06-21 Paul Eggert <eggert@cs.ucla.edu>
1624
1625 Port to Sun C.
1626 * composite.c (find_automatic_composition): Omit needless 'return 0;'
1627 that Sun C diagnosed.
1628 * fns.c (secure_hash): Fix pointer signedness issue.
1629 * intervals.c (static_offset_intervals): New function.
1630 (offset_intervals): Use it.
1631
1632 2011-06-21 Leo Liu <sdl.web@gmail.com>
1633
1634 * deps.mk (fns.o):
1635 * makefile.w32-in ($(BLD)/fns.$(O)): Include sha256.h and
1636 sha512.h.
1637
1638 * fns.c (secure_hash): Rename from crypto_hash_function and change
1639 the first arg to accept symbols.
1640 (Fsecure_hash): New primitive.
1641 (syms_of_fns): New symbols.
1642
1643 2011-06-20 Deniz Dogan <deniz@dogan.se>
1644
1645 * process.c (Fset_process_buffer): Clarify return value in
1646 docstring.
1647
1648 2011-06-18 Chong Yidong <cyd@stupidchicken.com>
1649
1650 * dispnew.c (add_window_display_history): Use BVAR.
1651
1652 * xdisp.c (debug_method_add): Use BVAR.
1653 (check_window_end, dump_glyph_matrix, dump_glyph)
1654 (dump_glyph_row, dump_glyph_string): Convert arglist to ANSI C.
1655
1656 * xfaces.c (check_lface_attrs, check_lface, dump_realized_face):
1657 Likewise.
1658
1659 * xfns.c (Fx_create_frame, x_create_tip_frame): Delay image cache
1660 check till after the cache is created in init_frame_faces.
1661
1662 2011-06-17 Stefan Monnier <monnier@iro.umontreal.ca>
1663
1664 * fns.c (Fsafe_length): Yet another int/Lisp_Object mixup.
1665
1666 2011-06-16 Paul Eggert <eggert@cs.ucla.edu>
1667
1668 * lisp.h: Include <limits.h>, for INT_MAX, LONG_MAX, LLONG_MAX.
1669 Without this, prin1 mishandles Lisp_Misc_Save_Value printing on
1670 hosts with pre-C99 libraries, because pD is wrongly defined to "t".
1671
1672 Improve buffer-overflow checking (Bug#8873).
1673 * fileio.c (Finsert_file_contents):
1674 * insdel.c (insert_from_buffer_1, replace_range, replace_range_2):
1675 Remove the old (too-loose) buffer overflow checks.
1676 They weren't needed, since make_gap checks for buffer overflow.
1677 * insdel.c (make_gap_larger): Catch buffer overflows that were missed.
1678 The old code merely checked for Emacs fixnum overflow, and relied
1679 on undefined (wraparound) behavior. The new code avoids undefined
1680 behavior, and also checks for ptrdiff_t and/or size_t overflow.
1681
1682 * editfns.c (Finsert_char): Don't dump core with very negative counts.
1683 Tune. Don't use wider integers than needed. Don't use alloca.
1684 Use a bigger 'string' buffer. Rewrite to avoid 'n > 0' test.
1685
1686 * insdel.c (replace_range): Fix buf overflow when insbytes < outgoing.
1687
1688 * insdel.c, lisp.h (buffer_overflow): New function.
1689 (insert_from_buffer_1, replace_range, replace_range_2):
1690 * insdel.c (make_gap_larger):
1691 * editfns.c (Finsert_char):
1692 * fileio.c (Finsert_file_contents): Use it, to normalize wording.
1693
1694 * buffer.h (BUF_BYTES_MAX): Cast to ptrdiff_t so that it's signed.
1695
1696 2011-06-15 Paul Eggert <eggert@cs.ucla.edu>
1697
1698 Integer overflow and signedness fixes (Bug#8873).
1699
1700 * ccl.c (ASCENDING_ORDER): New macro, to work around GCC bug 43772.
1701 (GET_CCL_RANGE, IN_INT_RANGE): Use it.
1702
1703 * fileio.c: Don't assume EMACS_INT fits in off_t.
1704 (emacs_lseek): New static function.
1705 (Finsert_file_contents, Fwrite_region): Use it.
1706 Use SEEK_SET, SEEK_CUR, SEEK_END as appropriate.
1707
1708 * fns.c (Fload_average): Don't assume 100 * load average fits in int.
1709
1710 * fns.c: Don't overflow int when computing a list length.
1711 * fns.c (QUIT_COUNT_HEURISTIC): New constant.
1712 (Flength, Fsafe_length): Use EMACS_INT, not int, to avoid unwanted
1713 truncation on 64-bit hosts. Check for QUIT every
1714 QUIT_COUNT_HEURISTIC entries rather than every other entry; that's
1715 faster and is responsive enough.
1716 (Flength): Report an error instead of overflowing an integer.
1717 (Fsafe_length): Return a float if the value is not representable
1718 as a fixnum. This shouldn't happen except in contrived situations.
1719 (Fnthcdr, Fsort): Don't assume list length fits in int.
1720 (Fcopy_sequence): Don't assume vector length fits in int.
1721
1722 * alloc.c: Check that resized vectors' lengths fit in fixnums.
1723 (header_size, word_size): New constants.
1724 (allocate_vectorlike): Don't check size overflow here.
1725 (allocate_vector): Check it here instead, since this is the only
1726 caller of allocate_vectorlike that could cause overflow.
1727 Check that the new vector's length is representable as a fixnum.
1728
1729 * fns.c (next_almost_prime): Don't return a multiple of 3 or 5.
1730 The previous code was bogus. For example, next_almost_prime (32)
1731 returned 39, which is undesirable as it is a multiple of 3; and
1732 next_almost_prime (24) returned 25, which is a multiple of 5 so
1733 why was the code bothering to check for multiples of 7?
1734
1735 * bytecode.c (exec_byte_code): Use ptrdiff_t, not int, for vector length.
1736
1737 * eval.c, doprnt.c (SIZE_MAX): Remove; inttypes.h defines this now.
1738
1739 Variadic C functions now count arguments with ptrdiff_t.
1740 This partly undoes my 2011-03-30 change, which replaced int with size_t.
1741 Back then I didn't know that the Emacs coding style prefers signed int.
1742 Also, in the meantime I found a few more instances where arguments
1743 were being counted with int, which may truncate counts on 64-bit
1744 machines, or EMACS_INT, which may be unnecessarily wide.
1745 * lisp.h (struct Lisp_Subr.function.aMANY)
1746 (DEFUN_ARGS_MANY, internal_condition_case_n, safe_call):
1747 Arg counts are now ptrdiff_t, not size_t.
1748 All variadic functions and their callers changed accordingly.
1749 (struct gcpro.nvars): Now size_t, not size_t. All uses changed.
1750 * bytecode.c (exec_byte_code): Check maxdepth for overflow,
1751 to avoid potential buffer overrun. Don't assume arg counts fit in 'int'.
1752 * callint.c (Fcall_interactively): Check arg count for overflow,
1753 to avoid potential buffer overrun. Use signed char, not 'int',
1754 for 'varies' array, so that we needn't bother to check its size
1755 calculation for overflow.
1756 * editfns.c (Fformat): Use ptrdiff_t, not EMACS_INT, to count args.
1757 * eval.c (apply_lambda):
1758 * fns.c (Fmapconcat): Use XFASTINT, not XINT, to get args length.
1759 (struct textprop_rec.argnum): Now ptrdiff_t, not int. All uses changed.
1760 (mapconcat): Use ptrdiff_t, not int and EMACS_INT, to count args.
1761
1762 * callint.c (Fcall_interactively): Don't use index var as event count.
1763
1764 * vm-limit.c (check_memory_limits): Fix incorrect extern function decls.
1765 * mem-limits.h (SIZE): Remove; no longer used.
1766
1767 * xterm.c (x_alloc_nearest_color_1): Prefer int to long when int works.
1768
1769 Remove unnecessary casts.
1770 * xterm.c (x_term_init):
1771 * xfns.c (x_set_border_pixel):
1772 * widget.c (create_frame_gcs): Remove casts to unsigned long etc.
1773 These aren't needed now that we assume ANSI C.
1774
1775 * sound.c (Fplay_sound_internal): Remove cast to unsigned long.
1776 It's more likely to cause problems (due to unsigned overflow)
1777 than to cure them.
1778
1779 * dired.c (Ffile_attributes): Don't use 32-bit hack on 64-bit hosts.
1780
1781 * unexelf.c (unexec): Don't assume BSS addr fits in unsigned.
1782
1783 * xterm.c (handle_one_xevent): Omit unnecessary casts to unsigned.
1784
1785 * keyboard.c (modify_event_symbol): Don't limit alist len to UINT_MAX.
1786
1787 * lisp.h (CHAR_TABLE_SET): Omit now-redundant test.
1788
1789 * lread.c (Fload): Don't compare a possibly-garbage time_t value.
1790
1791 GLYPH_CODE_FACE returns EMACS_INT, not int.
1792 * dispextern.h (merge_faces):
1793 * xfaces.c (merge_faces):
1794 * xdisp.c (get_next_display_element, next_element_from_display_vector):
1795 Don't assume EMACS_INT fits in int.
1796
1797 * character.h (CHAR_VALID_P): Remove unused parameter.
1798 * fontset.c, lisp.h, xdisp.c: All uses changed.
1799
1800 * editfns.c (Ftranslate_region_internal): Omit redundant test.
1801
1802 * fns.c (concat): Minor tuning based on overflow analysis.
1803 This doesn't fix any bugs. Use int to hold character, instead
1804 of constantly refetching from Emacs object. Use XFASTINT, not
1805 XINT, for value known to be a character. Don't bother comparing
1806 a single byte to 0400, as it's always less.
1807
1808 * floatfns.c (Fexpt):
1809 * fileio.c (make_temp_name): Omit unnecessary cast to unsigned.
1810
1811 * editfns.c (Ftranslate_region_internal): Use int, not EMACS_INT
1812 for characters.
1813
1814 * doc.c (get_doc_string): Omit (unsigned)c that mishandled negatives.
1815
1816 * data.c (Faset): If ARRAY is a string, check that NEWELT is a char.
1817 Without this fix, on a 64-bit host (aset S 0 4294967386) would
1818 incorrectly succeed when S was a string, because 4294967386 was
1819 truncated before it was used.
1820
1821 * chartab.c (Fchar_table_range): Use CHARACTERP to check range.
1822 Otherwise, an out-of-range integer could cause undefined behavior
1823 on a 64-bit host.
1824
1825 * composite.c: Use int, not EMACS_INT, for characters.
1826 (fill_gstring_body, composition_compute_stop_pos): Use int, not
1827 EMACS_INT, for values that are known to be in character range.
1828 This doesn't fix any bugs but is the usual style inside Emacs and
1829 may generate better code on 32-bit machines.
1830
1831 Make sure a 64-bit char is never passed to ENCODE_CHAR.
1832 This is for reasons similar to the recent CHAR_STRING fix.
1833 * charset.c (Fencode_char): Check that character arg is actually
1834 a character. Pass an int to ENCODE_CHAR.
1835 * charset.h (ENCODE_CHAR): Verify that the character argument is no
1836 wider than 'int', as a compile-time check to prevent future regressions
1837 in this area.
1838
1839 * character.c (char_string): Remove unnecessary casts.
1840
1841 Make sure a 64-bit char is never passed to CHAR_STRING.
1842 Otherwise, CHAR_STRING would do the wrong thing on a 64-bit platform,
1843 by silently ignoring the top 32 bits, allowing some values
1844 that were far too large to be valid characters.
1845 * character.h: Include <verify.h>.
1846 (CHAR_STRING, CHAR_STRING_ADVANCE): Verify that the character
1847 arguments are no wider than unsigned, as a compile-time check
1848 to prevent future regressions in this area.
1849 * data.c (Faset):
1850 * editfns.c (Fchar_to_string, general_insert_function, Finsert_char)
1851 (Fsubst_char_in_region):
1852 * fns.c (concat):
1853 * xdisp.c (decode_mode_spec_coding):
1854 Adjust to CHAR_STRING's new requirement.
1855 * editfns.c (Finsert_char, Fsubst_char_in_region):
1856 * fns.c (concat): Check that character args are actually
1857 characters. Without this test, these functions did the wrong
1858 thing with wildly out-of-range values on 64-bit hosts.
1859
1860 Remove incorrect casts to 'unsigned' that lose info on 64-bit hosts.
1861 These casts should not be needed on 32-bit hosts, either.
1862 * keyboard.c (read_char):
1863 * lread.c (Fload): Remove casts to unsigned.
1864
1865 * lisp.h (UNSIGNED_CMP): New macro.
1866 This fixes comparison bugs on 64-bit hosts.
1867 (ASCII_CHAR_P): Use it.
1868 * casefiddle.c (casify_object):
1869 * character.h (ASCII_BYTE_P, CHAR_VALID_P)
1870 (SINGLE_BYTE_CHAR_P, CHAR_STRING):
1871 * composite.h (COMPOSITION_ENCODE_RULE_VALID):
1872 * dispextern.h (FACE_FROM_ID):
1873 * keyboard.c (read_char): Use UNSIGNED_CMP.
1874
1875 * xmenu.c (dialog_selection_callback) [!USE_GTK]: Cast to intptr_t,
1876 not to EMACS_INT, to avoid GCC warning.
1877
1878 * xfns.c (x_set_scroll_bar_default_width): Remove unused 'int' locals.
1879
1880 * buffer.h (PTR_BYTE_POS, BUF_PTR_BYTE_POS): Remove harmful cast.
1881 The cast incorrectly truncated 64-bit byte offsets to 32 bits, and
1882 isn't needed on 32-bit machines.
1883
1884 * buffer.c (Fgenerate_new_buffer_name):
1885 Use EMACS_INT for count, not int.
1886 (advance_to_char_boundary): Return EMACS_INT, not int.
1887
1888 * data.c (Qcompiled_function): Now static.
1889
1890 * window.c (window_body_lines): Now static.
1891
1892 * image.c (gif_load): Rename local to avoid shadowing.
1893
1894 * lisp.h (SAFE_ALLOCA_LISP): Check for integer overflow.
1895 (struct Lisp_Save_Value): Use ptrdiff_t, not int, for 'integer' member.
1896 * alloc.c (make_save_value): Integer argument is now of type
1897 ptrdiff_t, not int.
1898 (mark_object): Use ptrdiff_t, not int.
1899 * lisp.h (pD): New macro.
1900 * print.c (print_object): Use it.
1901
1902 * alloc.c: Use EMACS_INT, not int, to count objects.
1903 (total_conses, total_markers, total_symbols, total_vector_size)
1904 (total_free_conses, total_free_markers, total_free_symbols)
1905 (total_free_floats, total_floats, total_free_intervals)
1906 (total_intervals, total_strings, total_free_strings):
1907 Now EMACS_INT, not int. All uses changed.
1908 (Fgarbage_collect): Compute overall total using a double, so that
1909 integer overflow is less likely to be a problem. Check for overflow
1910 when converting back to an integer.
1911 (n_interval_blocks, n_string_blocks, n_float_blocks, n_cons_blocks)
1912 (n_vectors, n_symbol_blocks, n_marker_blocks): Remove.
1913 These were 'int' variables that could overflow on 64-bit hosts;
1914 they were never used, so remove them instead of repairing them.
1915 (nzombies, ngcs, max_live, max_zombies): Now EMACS_INT, not 'int'.
1916 (inhibit_garbage_collection): Set gc_cons_threshold to max value.
1917 Previously, this ceilinged at INT_MAX, but that doesn't work on
1918 64-bit machines.
1919 (allocate_pseudovector): Don't use EMACS_INT when int would do.
1920
1921 * alloc.c (Fmake_bool_vector): Don't assume vector size fits in int.
1922 (allocate_vectorlike): Check for ptrdiff_t overflow.
1923 (mark_vectorlike, mark_char_table, mark_object): Avoid EMACS_UINT
1924 when a (possibly-narrower) signed value would do just as well.
1925 We prefer using signed arithmetic, to avoid comparison confusion.
1926
1927 * alloc.c: Catch some string size overflows that we were missing.
1928 (XMALLOC_OVERRUN_CHECK_SIZE) [!XMALLOC_OVERRUN_CHECK]: Define to 0,
1929 for convenience in STRING_BYTES_MAX.
1930 (STRING_BYTES_MAX): New macro, superseding the old one in lisp.h.
1931 The definition here is exact; the one in lisp.h was approximate.
1932 (allocate_string_data): Check for string overflow. This catches
1933 some instances we weren't catching before. Also, it catches
1934 size_t overflow on (unusual) hosts where SIZE_MAX <= min
1935 (PTRDIFF_MAX, MOST_POSITIVE_FIXNUM), e.g., when size_t is 32 bits
1936 and ptrdiff_t and EMACS_INT are both 64 bits.
1937
1938 * character.c, coding.c, doprnt.c, editfns.c, eval.c:
1939 All uses of STRING_BYTES_MAX replaced by STRING_BYTES_BOUND.
1940 * lisp.h (STRING_BYTES_BOUND): Renamed from STRING_BYTES_MAX.
1941
1942 * character.c (string_escape_byte8): Fix nbytes/nchars typo.
1943
1944 * alloc.c (Fmake_string): Check for out-of-range init.
1945
1946 2011-06-15 Stefan Monnier <monnier@iro.umontreal.ca>
1947
1948 * eval.c (Fdefvaralias): Also mark the target as variable-special-p.
1949
1950 2011-06-14 Jan Djärv <jan.h.d@swipnet.se>
1951
1952 * xfns.c (x_set_scroll_bar_default_width): Remove argument to
1953 xg_get_default_scrollbar_width.
1954
1955 * gtkutil.c: Include emacsgtkfixed.h if HAVE_GTK3.
1956 (int_gtk_range_get_value): Move to the scroll bar part of the file.
1957 (style_changed_cb): Call update_theme_scrollbar_width and call
1958 x_set_scroll_bar_default_width and xg_frame_set_char_size for
1959 all frames (Bug#8505).
1960 (xg_create_frame_widgets): Call emacs_fixed_new if HAVE_GTK3 (Bug#8505).
1961 Call gtk_window_set_resizable if HAVE_GTK3.
1962 (x_wm_set_size_hint): Call emacs_fixed_set_min_size with min width
1963 and height if HAVE_GTK3 (Bug#8505).
1964 (scroll_bar_width_for_theme): New variable.
1965 (update_theme_scrollbar_width): New function.
1966 (xg_get_default_scrollbar_width): Move code to
1967 update_theme_scrollbar_width, just return scroll_bar_width_for_theme.
1968 (xg_initialize): Call update_theme_scrollbar_width.
1969
1970 * gtkutil.h (xg_get_default_scrollbar_width): Remove argument.
1971
1972 * emacsgtkfixed.c, emacsgtkfixed.h: New files.
1973
1974 2011-06-12 Martin Rudalics <rudalics@gmx.at>
1975
1976 * frame.c (make_frame): Call other_buffer_safely instead of
1977 other_buffer.
1978
1979 * window.c (temp_output_buffer_show): Call display_buffer with
1980 second argument Vtemp_buffer_show_specifiers and reset latter
1981 immediately after the call.
1982 (Vtemp_buffer_show_specifiers): New variable.
1983 (auto_window_vscroll_p, next_screen_context_lines)
1984 (Vscroll_preserve_screen_position): Remove leading asterisks from
1985 doc-strings.
1986
1987 2011-06-12 Paul Eggert <eggert@cs.ucla.edu>
1988
1989 Fix minor problems found by GCC 4.6.0 static checking.
1990 * buffer.c (Qclone_number): Remove for now, as it's unused.
1991 (record_buffer, Funrecord_buffer): Rename local to avoid shadowing.
1992 (record_buffer): Remove unused local.
1993 * frame.c (other_visible_frames, frame_buffer_list): Now static.
1994 (set_frame_buffer_list): Remove; unused.
1995 * frame.h (other_visible_frames): Remove decl.
1996 * keyboard.h (menu_items_inuse): Declare only if USE_GTK || USE_MOTIF.
1997 * lisp.h (frame_buffer_list, set_frame_buffer_list): Remove decls.
1998 (add_gpm_wait_descriptor, delete_gpm_wait_descriptor): Declare only
1999 if HAVE_GPM.
2000 * menu.c (menu_items_inuse): Now static unless USE_GTK || USE_MOTIF.
2001 * process.c (add_gpm_wait_descriptor, delete_gpm_wait_descriptor):
2002 Define only if HAVE_GPM.
2003 * widget.c (EmacsFrameResize, emacsFrameClassRec): Now static.
2004 (update_hints_inhibit): Remove; never set. All uses removed.
2005 * widgetprv.h (emacsFrameClassRec): Remove decl.
2006 * window.c (delete_deletable_window): Now returns void, since it
2007 wasn't returning anything.
2008 (compare_window_configurations): Remove unused locals.
2009 * xfns.c (x_set_scroll_bar_default_width): Remove unused locals.
2010 * xmenu.c (x_menu_set_in_use): Define only if USE_GTK || USE_MOTIF.
2011 (dialog_selection_callback) [!USE_GTK]: Prefer intptr_t for integers
2012 the same widths as pointers. This follows up on the 2011-05-06 patch.
2013 * xterm.c (x_alloc_lighter_color_for_widget): Define only if USE_LUCID.
2014 * xterm.h: Likewise.
2015 (x_menu_set_in_use): Declare only if USE_GTK || USE_MOTIF.
2016
2017 2011-06-12 Juanma Barranquero <lekktu@gmail.com>
2018
2019 * makefile.w32-in: Update dependencies.
2020 (LISP_H): Add lib/intprops.h.
2021
2022 2011-06-11 Chong Yidong <cyd@stupidchicken.com>
2023
2024 * image.c (gif_load): Add animation frame delay to the metadata.
2025 (syms_of_image): Use DEFSYM. New symbol `delay'.
2026
2027 2011-06-11 Martin Rudalics <rudalics@gmx.at>
2028
2029 * window.c (delete_deletable_window): Re-add.
2030 (Fset_window_configuration): Rewrite to handle dead buffers and
2031 consequently deletable windows.
2032 (window_tree, Fwindow_tree): Remove. Supply functionality in
2033 window.el.
2034 (compare_window_configurations): Simplify code.
2035
2036 2011-06-11 Andreas Schwab <schwab@linux-m68k.org>
2037
2038 * image.c (imagemagick_load_image): Fix type mismatch.
2039 (Fimagemagick_types): Likewise.
2040
2041 * window.h (replace_buffer_in_windows): Declare.
2042
2043 2011-06-11 Martin Rudalics <rudalics@gmx.at>
2044
2045 * buffer.c: New Lisp objects Qbuffer_list_update_hook and
2046 Qclone_number. Remove external declaration of Qdelete_window.
2047 (Fbuffer_list): Rewrite doc-string. Minor restructuring of
2048 code.
2049 (Fget_buffer_create, Fmake_indirect_buffer, Frename_buffer): Run
2050 Qbuffer_list_update_hook if allowed.
2051 (Fother_buffer): Rewrite doc-string. Major rewrite for new
2052 buffer list implementation.
2053 (other_buffer_safely): New function.
2054 (Fkill_buffer): Replace call to replace_buffer_in_all_windows by
2055 calls to replace_buffer_in_windows and
2056 replace_buffer_in_windows_safely. Run Qbuffer_list_update_hook
2057 if allowed.
2058 (record_buffer): Inhibit quitting and rewrite using quittable
2059 functions. Run Qbuffer_list_update_hook if allowed.
2060 (Frecord_buffer, Funrecord_buffer): New functions.
2061 (switch_to_buffer_1, Fswitch_to_buffer): Remove. Move
2062 switch-to-buffer to window.el.
2063 (bury-buffer): Move to window.el.
2064 (Vbuffer_list_update_hook): New variable.
2065
2066 * lisp.h (other_buffer_safely): Add prototype in buffer.c
2067 section.
2068
2069 * window.h (resize_frame_windows): Move up in code.
2070 (Fwindow_frame): Remove EXFUN.
2071 (replace_buffer_in_all_windows): Remove prototype.
2072 (replace_buffer_in_windows_safely): Add prototype.
2073
2074 * window.c: Declare Qdelete_window static again. Move down
2075 declaration of select_count.
2076 (Fnext_window, Fprevious_window): Rewrite doc-strings.
2077 (Fother_window): Move to window.el.
2078 (window_loop): Remove DELETE_BUFFER_WINDOWS and UNSHOW_BUFFER
2079 cases. Add REPLACE_BUFFER_IN_WINDOWS_SAFELY case.
2080 (Fdelete_windows_on, Freplace_buffer_in_windows): Move to
2081 window.el.
2082 (replace_buffer_in_windows): Implement by calling
2083 Qreplace_buffer_in_windows.
2084 (replace_buffer_in_all_windows): Remove with some functionality
2085 moved into replace_buffer_in_windows_safely.
2086 (replace_buffer_in_windows_safely): New function.
2087 (select_window_norecord, select_frame_norecord): Move in front
2088 of run_window_configuration_change_hook. Remove now obsolete
2089 declarations.
2090 (Fset_window_buffer): Rewrite doc-string. Call
2091 Qrecord_window_buffer.
2092 (keys_of_window): Move binding for other-window to window.el.
2093
2094 2011-06-11 Chong Yidong <cyd@stupidchicken.com>
2095
2096 * dispextern.h (struct image): Replace data member, whose int_val
2097 and ptr_val fields were not used by anything, with a single
2098 lisp_val object.
2099
2100 * image.c (Fimage_metadata, make_image, mark_image, tiff_load)
2101 (gif_clear_image, gif_load, imagemagick_load_image)
2102 (gs_clear_image, gs_load): Callers changed.
2103
2104 2011-06-10 Paul Eggert <eggert@cs.ucla.edu>
2105
2106 * buffer.h: Include <time.h>, for time_t.
2107 Needed to build on FreeBSD 8.2. Problem reported by Herbert J. Skuhra.
2108
2109 Fix minor problems found by static checking.
2110
2111 * image.c (PixelGetMagickColor): Declare if ImageMagick headers don't.
2112
2113 Make identifiers static if they are not used in other modules.
2114 * data.c (Qcompiled_function, Qframe, Qvector):
2115 * image.c (QimageMagick, Qsvg):
2116 * minibuf.c (Qmetadata):
2117 * window.c (resize_window_check, resize_root_window): Now static.
2118 * window.h (resize_window_check, resize_root_window): Remove decls.
2119
2120 * window.c (window_deletion_count, delete_deletable_window):
2121 Remove; unused.
2122 (window_body_lines): Now static.
2123 (Fdelete_other_windows_internal): Mark vars as initialized.
2124 Make sure 'resize_failed' is initialized.
2125 (run_window_configuration_change_hook): Rename local to avoid shadowing.
2126 (resize_window_apply): Remove unused local.
2127 * window.h (delete_deletable_window): Remove decl.
2128
2129 * image.c (gif_load, svg_load_image): Rename locals to avoid shadowing.
2130 (imagemagick_load_image): Fix pointer signedness problem by changing
2131 last arg from unsigned char * to char *. All uses changed.
2132 Also, fix a local for similar reasons.
2133 Remove unused locals. Remove locals to avoid shadowing.
2134 (fn_rsvg_handle_free): Remove; unused.
2135 (svg_load, svg_load_image): Fix pointer signedness problem.
2136 (imagemagick_load_image): Don't use garbage pointer image_wand.
2137
2138 * ftfont.c (ftfont_get_metrics, ftfont_drive_otf): Remove unused locals.
2139
2140 2011-06-10 Chong Yidong <cyd@stupidchicken.com>
2141
2142 * image.c (gif_load): Fix omitted cast error introduced by
2143 2011-06-06 change.
2144
2145 2011-06-10 Martin Rudalics <rudalics@gmx.at>
2146
2147 * window.h (resize_proportionally, orig_total_lines)
2148 (orig_top_line): Remove from window structure.
2149 (set_window_height, set_window_width, change_window_heights)
2150 (Fdelete_window): Remove prototypes.
2151 (resize_frame_windows): Remove duplicate declaration.
2152
2153 2011-06-10 Eli Zaretskii <eliz@gnu.org>
2154
2155 * window.h (resize_frame_windows, resize_window_check)
2156 (delete_deletable_window, resize_root_window)
2157 (resize_frame_windows): Declare prototypes.
2158
2159 * window.c (resize_window_apply): Make definition be "static" to
2160 match the prototype.
2161
2162 2011-06-10 Martin Rudalics <rudalics@gmx.at>
2163
2164 * window.c: Remove declarations of Qwindow_size_fixed,
2165 window_min_size_1, window_min_size_2, window_min_size,
2166 size_window, window_fixed_size_p, enlarge_window, delete_window.
2167 Remove static from declaration of Qdelete_window, it's
2168 temporarily needed by Fbury_buffer.
2169 (replace_window): Don't assign orig_top_line and
2170 orig_total_lines.
2171 (Fdelete_window, delete_window): Remove. Window deletion is
2172 handled by window.el.
2173 (window_loop): Remove DELETE_OTHER_WINDOWS case. Replace
2174 Fdelete_window calls with calls to Qdelete_window.
2175 (Fdelete_other_windows): Remove. Deleting other windows is
2176 handled by window.el.
2177 (window_fixed_size_p): Remove. Fixed-sizeness of windows is
2178 handled in window.el.
2179 (window_min_size_2, window_min_size_1, window_min_size): Remove.
2180 Window minimum sizes are handled in window.el.
2181 (shrink_windows, size_window, set_window_height)
2182 (set_window_width, change_window_heights, window_height)
2183 (window_width, CURBEG, CURSIZE, enlarge_window)
2184 (adjust_window_trailing_edge, Fadjust_window_trailing_edge)
2185 (Fenlarge_window, Fshrink_window): Remove. Window resizing is
2186 handled in window.el.
2187 (make_dummy_parent): Rename to make_parent_window and give it a
2188 second argument horflag.
2189 (make_window): Don't set resize_proportionally any more.
2190 (Fsplit_window): Remove. Windows are split in window.el.
2191 (save_restore_action, save_restore_orig_size)
2192 (shrink_window_lowest_first, save_restore_orig_size): Remove.
2193 Resize mini windows in window.el.
2194 (grow_mini_window, shrink_mini_window): Implement by calling
2195 Qresize_root_window_vertically, resize_window_check and
2196 resize_window_apply.
2197 (saved_window, Fset_window_configuration, save_window_save): Do
2198 not handle orig_top_line, orig_total_lines, and
2199 resize_proportionally.
2200 (window_min_height, window_min_width): Move to window.el.
2201 (keys_of_window): Move bindings for delete-other-windows,
2202 split-window, delete-window and enlarge-window to window.el.
2203
2204 * buffer.c: Temporarily extern Qdelete_window.
2205 (Fbury_buffer): Temporarily call Qdelete_window instead of
2206 Fdelete_window (Fbury_buffer will move to window.el soon).
2207
2208 * frame.c (set_menu_bar_lines_1): Remove code handling
2209 orig_top_line and orig_total_lines.
2210
2211 * dispnew.c (adjust_frame_glyphs_initially): Don't use
2212 set_window_height but set heights directly.
2213 (change_frame_size_1): Use resize_frame_windows.
2214
2215 * xdisp.c (init_xdisp): Don't use set_window_height but set
2216 heights directly.
2217
2218 * xfns.c (x_set_menu_bar_lines, x_set_tool_bar_lines): Use
2219 resize_frame_windows instead of change_window_heights and run
2220 run_window_configuration_change_hook.
2221
2222 * w32fns.c (x_set_tool_bar_lines): Use resize_frame_windows
2223 instead of change_window_heights and run
2224 run_window_configuration_change_hook.
2225
2226 2011-06-09 Martin Rudalics <rudalics@gmx.at>
2227
2228 * window.c (replace_window): Rename second argument REPLACEMENT to
2229 NEW. New third argument SETFLAG. Rewrite.
2230 (delete_window, make_dummy_parent): Call replace_window with
2231 third argument 1.
2232 (window_list_1): Move down in code.
2233 (run_window_configuration_change_hook): Move set_buffer part
2234 before select_frame_norecord part in order to unwind correctly.
2235 Rename count1 to count.
2236 (recombine_windows, delete_deletable_window, resize_root_window)
2237 (Fdelete_other_windows_internal)
2238 (Frun_window_configuration_change_hook, make_parent_window)
2239 (resize_window_check, resize_window_apply, Fresize_window_apply)
2240 (resize_frame_windows, Fsplit_window_internal)
2241 (Fdelete_window_internal, Fresize_mini_window_internal): New
2242 functions.
2243 (syms_of_window): New variables Vwindow_splits and Vwindow_nest.
2244
2245 2011-06-08 Martin Rudalics <rudalics@gmx.at>
2246
2247 * window.h (window): Add some new members to window structure -
2248 normal_lines, normal_cols, new_total, new_normal, clone_number,
2249 splits, nest, prev_buffers, next_buffers.
2250 (WINDOW_TOTAL_SIZE): Move here from window.c.
2251 (MIN_SAFE_WINDOW_WIDTH, MIN_SAFE_WINDOW_HEIGHT): Define here.
2252
2253 * window.c (Fwindow_height, Fwindow_width, Fwindow_full_width_p):
2254 Remove.
2255 (make_dummy_parent): Set new members of windows structure.
2256 (make_window): Move down in code. Handle new members of window
2257 structure.
2258 (Fwindow_clone_number, Fwindow_splits, Fset_window_splits)
2259 (Fwindow_nest, Fset_window_nest, Fwindow_new_total)
2260 (Fwindow_normal_size, Fwindow_new_normal, Fwindow_prev_buffers)
2261 (Fset_window_prev_buffers, Fwindow_next_buffers)
2262 (Fset_window_next_buffers, Fset_window_clone_number): New
2263 functions.
2264 (Fwindow_hscroll, Fwindow_at, Fwindow_point, Fwindow_start)
2265 (Fwindow_end, Fwindow_line_height, Fset_window_dedicated_p):
2266 Doc-string fixes.
2267 (Fwindow_parameters, Fwindow_parameter, Fset_window_parameter):
2268 Argument WINDOW can be now internal window too.
2269 (Fwindow_use_time): Move up in code.
2270 (Fget_buffer_window): Rename argument FRAME to ALL-FRAMES.
2271 Rewrite doc-string.
2272 (Fset_window_configuration, saved_window)
2273 (Fcurrent_window_configuration, save_window_save): Handle new
2274 members of window structure.
2275 (WINDOW_TOTAL_SIZE, MIN_SAFE_WINDOW_WIDTH)
2276 (MIN_SAFE_WINDOW_HEIGHT): Move to window.h.
2277 (syms_of_window): New Lisp objects Qrecord_window_buffer,
2278 Qwindow_deletable_p, Qdelete_window, Qreplace_buffer_in_windows,
2279 Qget_mru_window, Qresize_root_window,
2280 Qresize_root_window_vertically, Qsafe, Qabove, Qbelow,
2281 Qauto_buffer_name; staticpro them.
2282
2283 2011-06-07 Martin Rudalics <rudalics@gmx.at>
2284
2285 * window.c (Fwindow_total_size, Fwindow_left_column)
2286 (Fwindow_top_line, window_body_lines, Fwindow_body_size)
2287 (Fwindow_list_1): New functions.
2288 (window_box_text_cols): Replace with window_body_cols.
2289 (Fwindow_width, Fscroll_left, Fscroll_right): Use
2290 window_body_cols instead of window_box_text_cols.
2291 (delete_window, Fset_window_configuration): Call
2292 delete_all_subwindows with window as argument.
2293 (delete_all_subwindows): Take a window as argument and not a
2294 structure. Rewrite.
2295 (window_loop): Remove handling of GET_LRU_WINDOW and
2296 GET_LARGEST_WINDOW.
2297 (Fget_lru_window, Fget_largest_window): Move to window.el.
2298
2299 * window.h: Extern window_body_cols instead of
2300 window_box_text_cols. delete_all_subwindows now takes a
2301 Lisp_Object as argument.
2302
2303 * indent.c (compute_motion, Fcompute_motion): Use
2304 window_body_cols instead of window_box_text_cols.
2305
2306 * frame.c (delete_frame): Call delete_all_subwindows with root
2307 window as argument.
2308
2309 2011-06-07 Daniel Colascione <dan.colascione@gmail.com>
2310
2311 * fns.c (Fputhash): Document return value.
2312
2313 2011-06-06 Chong Yidong <cyd@stupidchicken.com>
2314
2315 * image.c (gif_load): Implement gif89a spec "no disposal" method.
2316
2317 2011-06-06 Paul Eggert <eggert@cs.ucla.edu>
2318
2319 Cons<->int and similar integer overflow fixes (Bug#8794).
2320
2321 Check for overflow when converting integer to cons and back.
2322 * charset.c (Fdefine_charset_internal, Fdecode_char):
2323 Use cons_to_unsigned to catch overflow.
2324 (Fencode_char): Use INTEGER_TO_CONS.
2325 * composite.h (LGLYPH_CODE): Use cons_to_unsigned.
2326 (LGLYPH_SET_CODE): Use INTEGER_TO_CONS.
2327 * data.c (long_to_cons, cons_to_long): Remove.
2328 (cons_to_unsigned, cons_to_signed): New functions.
2329 These signal an error for invalid or out-of-range values.
2330 * dired.c (Ffile_attributes): Use INTEGER_TO_CONS.
2331 * fileio.c (Fset_visited_file_modtime): Use CONS_TO_INTEGER.
2332 * font.c (Ffont_variation_glyphs):
2333 * fontset.c (Finternal_char_font): Use INTEGER_TO_CONS.
2334 * lisp.h: Include <intprops.h>.
2335 (INTEGER_TO_CONS, CONS_TO_INTEGER): New macros.
2336 (cons_to_signed, cons_to_unsigned): New decls.
2337 (long_to_cons, cons_to_long): Remove decls.
2338 * undo.c (record_first_change): Use INTEGER_TO_CONS.
2339 (Fprimitive_undo): Use CONS_TO_INTEGER.
2340 * xfns.c (Fx_window_property): Likewise.
2341 * xselect.c: Include <limits.h>.
2342 (x_own_selection, selection_data_to_lisp_data):
2343 Use INTEGER_TO_CONS.
2344 (x_handle_selection_request, x_handle_selection_clear)
2345 (x_get_foreign_selection, Fx_disown_selection_internal)
2346 (Fx_get_atom_name, x_send_client_event): Use CONS_TO_INTEGER.
2347 (lisp_data_to_selection_data): Use cons_to_unsigned.
2348 (x_fill_property_data): Use cons_to_signed.
2349 Report values out of range.
2350
2351 Check for buffer and string overflow more precisely.
2352 * buffer.h (BUF_BYTES_MAX): New macro.
2353 * lisp.h (STRING_BYTES_MAX): New macro.
2354 * alloc.c (Fmake_string):
2355 * character.c (string_escape_byte8):
2356 * coding.c (coding_alloc_by_realloc):
2357 * doprnt.c (doprnt):
2358 * editfns.c (Fformat):
2359 * eval.c (verror):
2360 Use STRING_BYTES_MAX, not MOST_POSITIVE_FIXNUM,
2361 since they may not be the same number.
2362 * editfns.c (Finsert_char):
2363 * fileio.c (Finsert_file_contents):
2364 Likewise for BUF_BYTES_MAX.
2365
2366 * image.c: Use ptrdiff_t, not int, for sizes.
2367 (slurp_file): Switch from int to ptrdiff_t.
2368 All uses changed.
2369 (slurp_file): Check that file size fits in both size_t (for
2370 malloc) and ptrdiff_t (for sanity and safety).
2371
2372 * fileio.c (Fverify_visited_file_modtime): Avoid time overflow
2373 if b->modtime has its maximal value.
2374
2375 * dired.c (Ffile_attributes): Don't assume EMACS_INT has >32 bits.
2376
2377 Don't assume time_t can fit into int.
2378 * buffer.h (struct buffer.modtime): Now time_t, not int.
2379 * fileio.c (Fvisited_file_modtime): No need for time_t cast now.
2380 * undo.c (Fprimitive_undo): Use time_t, not int, for time_t value.
2381
2382 Minor fixes for signed vs unsigned integers.
2383 * character.h (MAYBE_UNIFY_CHAR):
2384 * charset.c (maybe_unify_char):
2385 * keyboard.c (read_char, reorder_modifiers):
2386 XINT -> XFASTINT, since the integer must be nonnegative.
2387 * ftfont.c (ftfont_spec_pattern):
2388 * keymap.c (access_keymap, silly_event_symbol_error):
2389 XUINT -> XFASTINT, since the integer must be nonnegative.
2390 (Fsingle_key_description, preferred_sequence_p): XUINT -> XINT,
2391 since it makes no difference and we prefer signed.
2392 * keyboard.c (record_char): Use XUINT when all the neighbors do.
2393 (access_keymap): NATNUMP -> INTEGERP, since the integer must be
2394 nonnegative.
2395
2396 2011-06-06 Stefan Monnier <monnier@iro.umontreal.ca>
2397
2398 * window.h (Fwindow_frame): Declare.
2399
2400 2011-06-06 Paul Eggert <eggert@cs.ucla.edu>
2401
2402 * alloc.c: Simplify handling of large-request failures (Bug#8800).
2403 (SPARE_MEMORY): Always define.
2404 (LARGE_REQUEST): Remove.
2405 (memory_full): Use SPARE_MEMORY rather than LARGE_REQUEST.
2406
2407 2011-06-06 Martin Rudalics <rudalics@gmx.at>
2408
2409 * lisp.h: Move EXFUNS for Fframe_root_window,
2410 Fframe_first_window and Fset_frame_selected_window to window.h.
2411
2412 * window.h: Move EXFUNS for Fframe_root_window,
2413 Fframe_first_window and Fset_frame_selected_window here from
2414 lisp.h.
2415
2416 * frame.c (Fwindow_frame, Fframe_first_window)
2417 (Fframe_root_window, Fframe_selected_window)
2418 (Fset_frame_selected_window): Move to window.c.
2419 (Factive_minibuffer_window): Move to minibuf.c.
2420 (Fother_visible_frames_p): New function.
2421
2422 * minibuf.c (Factive_minibuffer_window): Move here from frame.c.
2423
2424 * window.c (decode_window, decode_any_window): Move up in code.
2425 (Fwindowp, Fwindow_live_p): Rewrite doc-strings.
2426 (inhibit_frame_unsplittable): Remove unused variable.
2427 (Fwindow_buffer): Move up and rewrite doc-string.
2428 (Fwindow_parent, Fwindow_vchild, Fwindow_hchild, Fwindow_next)
2429 (Fwindow_prev): New functions.
2430 (Fwindow_frame): Move here from frame.c. Accept any window as
2431 argument.
2432 (Fframe_root_window, Fframe_first_window)
2433 (Fframe_selected_window): Move here from frame.c. Accept frame
2434 or arbitrary window as argument. Update doc-strings.
2435 (Fminibuffer_window): Move up in code.
2436 (Fwindow_minibuffer_p): Move up in code and simplify.
2437 (Fset_frame_selected_window): Move here from frame.c.
2438 Marginal rewrite.
2439 (Fselected_window, select_window, Fselect_window): Move up in
2440 code. Minor doc-string fixes.
2441
2442 2011-06-06 Paul Eggert <eggert@cs.ucla.edu>
2443
2444 * alloc.c (memory_full) [SYSTEM_MALLOC]: Port to MacOS (Bug#8800).
2445 Do not assume that spare memory exists; that assumption is valid
2446 only if SYSTEM_MALLOC.
2447 (LARGE_REQUEST): New macro, so that the issue of large requests
2448 is separated from the issue of spare memory.
2449
2450 2011-06-05 Andreas Schwab <schwab@linux-m68k.org>
2451
2452 * editfns.c (Fformat): Correctly handle zero flag with hexadecimal
2453 format. (Bug#8806)
2454
2455 * gtkutil.c (xg_get_default_scrollbar_width): Avoid warning.
2456
2457 * xfns.c (x_set_scroll_bar_default_width): Move declarations
2458 before statements.
2459
2460 2011-06-05 Jan Djärv <jan.h.d@swipnet.se>
2461
2462 * gtkutil.c (xg_get_default_scrollbar_width): New function.
2463
2464 * gtkutil.h: Declare xg_get_default_scrollbar_width.
2465
2466 * xfns.c (x_set_scroll_bar_default_width): If USE_GTK, get
2467 min width by calling x_set_scroll_bar_default_width (Bug#8505).
2468
2469 2011-06-05 Juanma Barranquero <lekktu@gmail.com>
2470
2471 * xdisp.c (single_display_spec_intangible_p): Remove declaration.
2472
2473 2011-06-04 Chong Yidong <cyd@stupidchicken.com>
2474
2475 * xselect.c (x_clipboard_manager_save): Remove redundant arg.
2476 (x_clipboard_manager_save): Add return value.
2477 (x_clipboard_manager_error_1, x_clipboard_manager_error_2):
2478 New error handlers.
2479 (x_clipboard_manager_save_frame, x_clipboard_manager_save_all):
2480 Obey Vx_select_enable_clipboard_manager. Catch errors in
2481 x_clipboard_manager_save (Bug#8779).
2482 (Vx_select_enable_clipboard_manager): New variable.
2483 (x_get_foreign_selection): Reduce scope of x_catch_errors (Bug#8790).
2484
2485 2011-06-04 Dan Nicolaescu <dann@ics.uci.edu>
2486
2487 * emacs.c (main): Warn when starting a GTK emacs in daemon mode.
2488
2489 2011-06-04 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
2490
2491 * fringe.c (update_window_fringes): Don't update overlay arrow bitmap
2492 in the current matrix if keep_current_p is non-zero.
2493
2494 2011-06-04 Eli Zaretskii <eliz@gnu.org>
2495
2496 * bidi.c (bidi_level_of_next_char): Fix last change.
2497
2498 2011-06-03 Eli Zaretskii <eliz@gnu.org>
2499
2500 Support bidi reordering of text covered by display properties.
2501
2502 * bidi.c (bidi_copy_it): Use offsetof instead of emulating it.
2503 (bidi_fetch_char, bidi_fetch_char_advance): New functions.
2504 (bidi_cache_search, bidi_cache_iterator_state)
2505 (bidi_paragraph_init, bidi_resolve_explicit, bidi_resolve_weak)
2506 (bidi_level_of_next_char, bidi_move_to_visually_next):
2507 Support character positions inside a run of characters covered by a
2508 display string.
2509 (bidi_paragraph_init, bidi_resolve_explicit_1)
2510 (bidi_level_of_next_char): Call bidi_fetch_char and
2511 bidi_fetch_char_advance instead of FETCH_CHAR and
2512 FETCH_CHAR_ADVANCE.
2513 (bidi_init_it): Initialize new members.
2514 (LRE_CHAR, RLE_CHAR, PDF_CHAR, LRO_CHAR, RLO_CHAR): Remove macro
2515 definitions.
2516 (bidi_explicit_dir_char): Lookup character type in bidi_type_table,
2517 instead of using explicit *_CHAR codes.
2518 (bidi_resolve_explicit, bidi_resolve_weak):
2519 Use FETCH_MULTIBYTE_CHAR instead of FETCH_CHAR, as reordering of
2520 bidirectional text is supported only in multibyte buffers.
2521 (bidi_init_it): Accept additional argument FRAME_WINDOW_P and use
2522 it to initialize the frame_window_p member of struct bidi_it.
2523 (bidi_cache_iterator_state, bidi_resolve_explicit_1)
2524 (bidi_resolve_explicit, bidi_resolve_weak)
2525 (bidi_level_of_next_char, bidi_move_to_visually_next): Abort if
2526 bidi_it->nchars is non-positive.
2527 (bidi_level_of_next_char): Don't try to lookup the cache for the
2528 next/previous character if nothing is cached there yet, or if we
2529 were just reseat()'ed to a new position.
2530
2531 * xdisp.c (set_cursor_from_row): Set start and stop points
2532 according to the row's direction when priming the loop that looks
2533 for the glyph on which to display cursor.
2534 (single_display_spec_intangible_p): Function deleted.
2535 (display_prop_intangible_p): Reimplement to call
2536 handle_display_spec instead of single_display_spec_intangible_p.
2537 Accept 3 additional arguments needed by handle_display_spec.
2538 This fixes incorrect cursor motion across display property with complex
2539 values: lists, `(when COND...)' forms, etc.
2540 (single_display_spec_string_p): Support property values that are
2541 lists with the argument STRING its top-level element.
2542 (display_prop_string_p): Fix the condition for processing a
2543 property that is a list to be consistent with handle_display_spec.
2544 (handle_display_spec): New function, refactored from the
2545 last portion of handle_display_prop.
2546 (compute_display_string_pos): Accept additional argument
2547 FRAME_WINDOW_P. Call handle_display_spec to determine whether the
2548 value of a `display' property is a "replacing spec".
2549 (handle_single_display_spec): Accept 2 additional arguments BUFPOS
2550 and FRAME_WINDOW_P. If IT is NULL, don't set up the iterator from
2551 the display property, but just return a value indicating whether
2552 the display property will replace the characters it covers.
2553 (Fcurrent_bidi_paragraph_direction): Initialize the nchars and
2554 frame_window_p members of struct bidi_it.
2555 (compute_display_string_pos, compute_display_string_end):
2556 New functions.
2557 (push_it): Accept second argument POSITION, where pop_it should
2558 jump to continue iteration.
2559 (reseat_1): Initialize bidi_it.disp_pos.
2560
2561 * keyboard.c (adjust_point_for_property): Adjust the call to
2562 display_prop_intangible_p to its new signature.
2563
2564 * dispextern.h (struct bidi_it): New member frame_window_p.
2565 (bidi_init_it): Update prototypes.
2566 (display_prop_intangible_p): Update prototype.
2567 (compute_display_string_pos, compute_display_string_end):
2568 Declare prototypes.
2569 (struct bidi_it): New members nchars and disp_pos. ch_len is now
2570 EMACS_INT.
2571
2572 2011-06-02 Paul Eggert <eggert@cs.ucla.edu>
2573
2574 Malloc failure behavior now depends on size of allocation.
2575 * alloc.c (buffer_memory_full, memory_full): New arg NBYTES.
2576 * lisp.h: Change signatures accordingly.
2577 * alloc.c, buffer.c, editfns.c, menu.c, minibuf.c, xterm.c:
2578 All callers changed. (Bug#8762)
2579
2580 * gnutls.c: Use Emacs's memory allocators.
2581 Without this change, the gnutls library would invoke malloc etc.
2582 directly, which causes problems on non-SYNC_INPUT hosts, and which
2583 runs afoul of improving memory_full behavior. (Bug#8761)
2584 (fn_gnutls_global_set_mem_functions): New macro or function pointer.
2585 (emacs_gnutls_global_init): Use it to specify xmalloc, xrealloc,
2586 xfree instead of the default malloc, realloc, free.
2587 (Fgnutls_boot): No need to check for memory allocation failure,
2588 since xmalloc does that for us.
2589
2590 Remove arbitrary limit of 2**31 entries in hash tables. (Bug#8771)
2591 * category.c (hash_get_category_set):
2592 * ccl.c (ccl_driver):
2593 * charset.c (Fdefine_charset_internal):
2594 * charset.h (struct charset.hash_index):
2595 * composite.c (get_composition_id, gstring_lookup_cache)
2596 (composition_gstring_put_cache):
2597 * composite.h (struct composition.hash_index):
2598 * dispextern.h (struct image.hash):
2599 * fns.c (next_almost_prime, larger_vector, cmpfn_eql)
2600 (cmpfn_equal, cmpfn_user_defined, hashfn_eq, hashfn_eql)
2601 (hashfn_equal, hashfn_user_defined, make_hash_table)
2602 (maybe_resize_hash_table, hash_lookup, hash_put)
2603 (hash_remove_from_table, hash_clear, sweep_weak_table, SXHASH_COMBINE)
2604 (sxhash_string, sxhash_list, sxhash_vector, sxhash_bool_vector)
2605 (Fsxhash, Fgethash, Fputhash, Fmaphash):
2606 * image.c (make_image, search_image_cache, lookup_image)
2607 (xpm_put_color_table_h):
2608 * lisp.h (struct Lisp_Hash_Table):
2609 * minibuf.c (Ftry_completion, Fall_completions, Ftest_completion):
2610 * print.c (print): Use 'EMACS_UINT' and 'EMACS_INT'
2611 for hashes and hash indexes, instead of 'unsigned' and 'int'.
2612 * alloc.c (allocate_vectorlike):
2613 Check for overflow in vector size calculations.
2614 * ccl.c (ccl_driver):
2615 Check for overflow when converting EMACS_INT to int.
2616 * fns.c, image.c: Remove unnecessary static decls that would otherwise
2617 need to be updated by these changes.
2618 * fns.c (make_hash_table, maybe_resize_hash_table):
2619 Check for integer overflow with large hash tables.
2620 (make_hash_table, maybe_resize_hash_table, Fmake_hash_table):
2621 Prefer the faster XFLOAT_DATA to XFLOATINT where either will do.
2622 (SXHASH_REDUCE): New macro.
2623 (sxhash_string, sxhash_list, sxhash_vector, sxhash_bool_vector):
2624 Use it instead of discarding useful hash info with large hash values.
2625 (sxhash_float): New function.
2626 (sxhash): Use it. No more need for "& INTMASK" due to above changes.
2627 * lisp.h (FIXNUM_BITS): New macro, useful for SXHASH_REDUCE etc.
2628 (MOST_NEGATIVE_FIXNUM, MOST_POSITIVE_FIXNUM, INTMASK):
2629 Rewrite to use FIXNUM_BITS, as this simplifies things.
2630 (next_almost_prime, larger_vector, sxhash, hash_lookup, hash_put):
2631 Adjust signatures to match updated version of code.
2632 (consing_since_gc): Now EMACS_INT, since a single hash table can
2633 use more than INT_MAX bytes.
2634
2635 2011-06-01 Dan Nicolaescu <dann@ics.uci.edu>
2636
2637 Make it possible to build with GCC-4.6+ -O2 -flto.
2638
2639 * emacs.c (__malloc_initialize_hook): Mark as EXTERNALLY_VISIBLE.
2640
2641 2011-06-01 Stefan Monnier <monnier@iro.umontreal.ca>
2642
2643 * minibuf.c (get_minibuffer, read_minibuf_unwind):
2644 Call minibuffer-inactive-mode.
2645
2646 2011-05-31 Juanma Barranquero <lekktu@gmail.com>
2647
2648 * makefile.w32-in ($(BLD)/data.$(O), $(BLD)/editfns.$(O)):
2649 Update dependencies.
2650
2651 2011-05-31 Dan Nicolaescu <dann@ics.uci.edu>
2652
2653 * data.c (init_data): Remove code for UTS, this system is not
2654 supported anymore.
2655
2656 2011-05-31 Dan Nicolaescu <dann@ics.uci.edu>
2657
2658 Don't force ./temacs to start in terminal mode.
2659
2660 * frame.c (make_initial_frame): Initialize faces in all cases, not
2661 only when CANNOT_DUMP is defined.
2662 * dispnew.c (init_display): Remove CANNOT_DUMP condition.
2663
2664 2011-05-31 Dan Nicolaescu <dann@ics.uci.edu>
2665
2666 * dispnew.c (add_window_display_history): Use const for the string
2667 pointer. Remove declaration, not needed.
2668
2669 2011-05-31 Paul Eggert <eggert@cs.ucla.edu>
2670
2671 Use 'inline', not 'INLINE'.
2672 <http://lists.gnu.org/archive/html/emacs-devel/2011-05/msg00914.html>
2673 * alloc.c, fontset.c (INLINE): Remove.
2674 * alloc.c, bidi.c, charset.c, coding.c, dispnew.c, fns.c, image.c:
2675 * intervals.c, keyboard.c, process.c, syntax.c, textprop.c, w32term.c:
2676 * xdisp.c, xfaces.c, xterm.c: Replace all uses of INLINE with inline.
2677 * gmalloc.c (register_heapinfo): Use inline unconditionally.
2678 * lisp.h (LISP_MAKE_RVALUE): Use inline, not __inline__.
2679
2680 2011-05-31 Dan Nicolaescu <dann@ics.uci.edu>
2681
2682 Make it possible to run ./temacs.
2683
2684 * callproc.c (set_initial_environment): Remove CANNOT_DUMP code,
2685 syms_of_callproc does the same thing. Remove test for
2686 "initialized", do it in the caller.
2687 * emacs.c (main): Avoid calling set_initial_environment when dumping.
2688
2689 2011-05-31 Stefan Monnier <monnier@iro.umontreal.ca>
2690
2691 * minibuf.c (Finternal_complete_buffer): Return `category' metadata.
2692 (read_minibuf): Use get_minibuffer.
2693 (syms_of_minibuf): Use DEFSYM.
2694 (Qmetadata): New var.
2695 * data.c (Qbuffer): Don't make it static.
2696 (syms_of_data): Use DEFSYM.
2697
2698 2011-05-31 Paul Eggert <eggert@cs.ucla.edu>
2699
2700 * ccl.c (CCL_CODE_RANGE): Allow negative numbers. (Bug#8751)
2701 (CCL_CODE_MIN): New macro.
2702
2703 2011-05-30 Paul Eggert <eggert@cs.ucla.edu>
2704
2705 * alloc.c (lisp_align_malloc): Omit unnecessary val==NULL tests.
2706
2707 * eval.c (Qdebug): Now static.
2708 * lisp.h (Qdebug): Remove decl. This reverts a part of the
2709 2011-04-26T11:26:05Z!dan.colascione@gmail.com that inadvertently undid part of
2710 2011-04-14T06:48:41Z!eggert@cs.ucla.edu.
2711
2712 2011-05-29 Chong Yidong <cyd@stupidchicken.com>
2713
2714 * image.c: Various fixes to ImageMagick code comments.
2715 (Fimagemagick_types): Doc fix.
2716
2717 2011-05-29 Paul Eggert <eggert@cs.ucla.edu>
2718
2719 Minor fixes prompted by GCC 4.6.0 warnings.
2720
2721 * xselect.c (converted_selections, conversion_fail_tag): Now static.
2722
2723 * emacs.c [HAVE_X_WINDOWS]: Include "xterm.h".
2724 (x_clipboard_manager_save_all): Move extern decl to ...
2725 * xterm.h: ... here, so that it can be checked for consistency.
2726
2727 2011-05-29 Chong Yidong <cyd@stupidchicken.com>
2728
2729 * xselect.c (x_clipboard_manager_save_frame)
2730 (x_clipboard_manager_save_all): New functions.
2731 (Fx_clipboard_manager_save): Lisp function deleted.
2732
2733 * emacs.c (Fkill_emacs): Call x_clipboard_manager_save_all.
2734 * frame.c (delete_frame): Call x_clipboard_manager_save_frame.
2735
2736 * xterm.h: Update prototype.
2737
2738 2011-05-28 William Xu <william.xwl@gmail.com>
2739
2740 * nsterm.m (ns_term_shutdown): Synchronize user defaults before
2741 exiting (Bug#8239).
2742
2743 2011-05-28 Jim Meyering <meyering@redhat.com>
2744
2745 Avoid a sign-extension bug in crypto_hash_function.
2746 * fns.c (to_uchar): Define.
2747 (crypto_hash_function): Use it to convert some newly-signed
2748 variables to unsigned, to avoid sign-extension bugs. For example,
2749 without this change, (md5 "truc") would evaluate to
2750 45723a2aff78ff4fff7fff1114760e62 rather than the expected
2751 45723a2af3788c4ff17f8d1114760e62. Reported by Antoine Levitt in
2752 https://lists.gnu.org/archive/html/emacs-devel/2011-05/msg00883.html.
2753
2754 2011-05-27 Paul Eggert <eggert@cs.ucla.edu>
2755
2756 Integer overflow fixes.
2757
2758 * dbusbind.c: Serial number integer overflow fixes.
2759 (CHECK_DBUS_SERIAL_GET_SERIAL): New macro.
2760 (Fdbus_call_method_asynchronously, xd_read_message_1): Use a float
2761 to hold a serial number that is too large for a fixnum.
2762 (Fdbus_method_return_internal, Fdbus_method_error_internal):
2763 Check for serial numbers out of range. Decode any serial number
2764 that was so large that it became a float. (Bug#8722)
2765
2766 * dbusbind.c: Use XFASTINT rather than XUINT, and check for nonneg.
2767 (Fdbus_call_method, Fdbus_call_method_asynchronously):
2768 Use XFASTINT rather than XUINT when numbers are nonnegative.
2769 (xd_append_arg, Fdbus_method_return_internal):
2770 (Fdbus_method_error_internal): Likewise. Also, for unsigned
2771 arguments, check that Lisp number is nonnegative, rather than
2772 silently wrapping negative numbers around. (Bug#8722)
2773 (xd_read_message_1): Don't assume dbus_uint32_t can fit in int.
2774 (Bug#8722)
2775
2776 * data.c (arith_driver, Flsh): Avoid unnecessary casts to EMACS_UINT.
2777
2778 * ccl.c (ccl_driver): Redo slightly to avoid the need for 'unsigned'.
2779
2780 ccl: add integer overflow checks
2781 * ccl.c (CCL_CODE_MAX, GET_CCL_RANGE, GET_CCL_CODE, GET_CCL_INT):
2782 (IN_INT_RANGE): New macros.
2783 (ccl_driver): Use them to check for integer overflow when
2784 decoding a CCL program. Many of the new checks are whether XINT (x)
2785 fits in int; it doesn't always, on 64-bit hosts. The new version
2786 doesn't catch all possible integer overflows, but it's an
2787 improvement. (Bug#8719)
2788
2789 * alloc.c (make_event_array): Use XINT, not XUINT.
2790 There's no need for unsigned here.
2791
2792 * mem-limits.h (EXCEEDS_LISP_PTR) [!USE_LSB_TAG]: EMACS_UINT -> uintptr_t
2793 This follows up to the 2011-05-06 change that substituted uintptr_t
2794 for EMACS_INT. This case wasn't caught back then.
2795
2796 Rework Fformat to avoid integer overflow issues.
2797 * editfns.c: Include <float.h> unconditionally, as it's everywhere
2798 now (part of C89). Include <verify.h>.
2799 (MAX_10_EXP, CONVERTED_BYTE_SIZE): Remove; no longer needed.
2800 (pWIDE, pWIDElen, signed_wide, unsigned_wide): New defns.
2801 (Fformat): Avoid the prepass trying to compute sizes; it was only
2802 approximate and thus did not catch overflow reliably. Instead, walk
2803 through the format just once, formatting and computing sizes as we go,
2804 checking for integer overflow at every step, and allocating a larger
2805 buffer as needed. Keep track separately whether the format is
2806 multibyte. Keep only the most-recently calculated precision, rather
2807 than them all. Record whether each argument has been converted to
2808 string. Use EMACS_INT, not int, for byte and char and arg counts.
2809 Support field widths and precisions larger than INT_MAX. Avoid
2810 sprintf's undefined behavior with conversion specifications such as %#d
2811 and %.0c. Fix bug with strchr succeeding on '\0' when looking for
2812 flags. Fix bug with (format "%c" 256.0). Avoid integer overflow when
2813 formatting out-of-range floating point numbers with int
2814 formats. (Bug#8668)
2815
2816 * lisp.h (FIXNUM_OVERFLOW_P): Work even if arg is a NaN.
2817
2818 * data.c: Avoid integer truncation in expressions involving floats.
2819 * data.c: Include <intprops.h>.
2820 (arith_driver): When there's an integer overflow in an expression
2821 involving floating point, convert the integers to floating point
2822 so that the resulting value does not suffer from catastrophic
2823 integer truncation. For example, on a 64-bit host (* 4
2824 most-negative-fixnum 0.5) should yield about -4.6e+18, not zero.
2825 Do not rely on undefined behavior after integer overflow.
2826
2827 merge count_size_as_multibyte, parse_str_to_multibyte
2828 * character.c, character.h (count_size_as_multibyte):
2829 Rename from parse_str_to_multibyte; all uses changed.
2830 Check for integer overflow.
2831 * insdel.c, lisp.h (count_size_as_multibyte): Remove,
2832 since it's now a duplicate of the other. This is more of
2833 a character than a buffer op, so better that it's in character.c.
2834 * fns.c, print.c: Adjust to above changes.
2835
2836 2011-05-27 Stefan Monnier <monnier@iro.umontreal.ca>
2837
2838 * xselect.c (x_convert_selection): Yet another int/Lisp_Object mixup.
2839
2840 2011-05-27 Paul Eggert <eggert@cs.ucla.edu>
2841
2842 * xselect.c: Fix minor problems prompted by GCC 4.6.0 warnings.
2843 (x_handle_selection_request, frame_for_x_selection): Remove unused vars.
2844 (x_clipboard_manager_save): Now static.
2845 (Fx_clipboard_manager_save): Rename local to avoid shadowing.
2846
2847 * fns.c: Fix minor problems prompted by GCC 4.6.0 warnings.
2848 (crypto_hash_function): Now static.
2849 Fix pointer signedness problems. Avoid unnecessary initializations.
2850
2851 2011-05-27 Chong Yidong <cyd@stupidchicken.com>
2852
2853 * termhooks.h (Vselection_alist): Make it terminal-local.
2854
2855 * terminal.c (create_terminal): Initialize it.
2856
2857 * xselect.c: Support for clipboard managers.
2858 (Vselection_alist): Move to termhooks.h as terminal-local var.
2859 (LOCAL_SELECTION): New macro.
2860 (x_atom_to_symbol): Handle x_display_info_for_display fail case.
2861 (symbol_to_x_atom): Remove gratuitous arg.
2862 (x_handle_selection_request, lisp_data_to_selection_data)
2863 (x_get_foreign_selection, Fx_register_dnd_atom): Callers changed.
2864 (x_own_selection, x_get_local_selection, x_convert_selection):
2865 New arg, specifying work frame. Use terminal-local Vselection_alist.
2866 (some_frame_on_display): Delete unused function.
2867 (Fx_own_selection_internal, Fx_get_selection_internal)
2868 (Fx_disown_selection_internal, Fx_selection_owner_p)
2869 (Fx_selection_exists_p): New optional frame arg.
2870 (frame_for_x_selection, Fx_clipboard_manager_save): New functions.
2871 (x_handle_selection_clear): Don't treat other terminals with the
2872 same keyboard specially. Use the terminal-local Vselection_alist.
2873 (x_clear_frame_selections): Use Frun_hook_with_args.
2874
2875 * xterm.c (x_term_init): Intern ATOM and CLIPBOARD_MANAGER atoms.
2876
2877 * xterm.h: Add support for those atoms.
2878
2879 2011-05-26 Chong Yidong <cyd@stupidchicken.com>
2880
2881 * xselect.c: ICCCM-compliant handling of MULTIPLE targets.
2882 (converted_selections, conversion_fail_tag): New global variables.
2883 (x_selection_request_lisp_error): Free the above.
2884 (x_get_local_selection): Remove unnecessary code.
2885 (x_reply_selection_request): Args changed; handle arbitrary array
2886 of converted selections stored in converted_selections.
2887 Separate the XChangeProperty and SelectionNotify steps.
2888 (x_handle_selection_request): Rewrite to handle MULTIPLE target.
2889 (x_convert_selection): New function.
2890 (x_handle_selection_event): Simplify.
2891 (x_get_foreign_selection): Don't ignore incoming requests while
2892 waiting for an answer; this will fail when we implement
2893 SAVE_TARGETS, and seems unnecessary anyway.
2894 (selection_data_to_lisp_data): Recognize ATOM_PAIR type.
2895 (Vx_sent_selection_functions): Doc fix.
2896
2897 2011-05-26 Leo Liu <sdl.web@gmail.com>
2898
2899 * editfns.c (Ftranspose_regions): Allow empty regions. (Bug#8699)
2900
2901 2011-05-25 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
2902
2903 * dispextern.h (struct glyph_row): New member fringe_bitmap_periodic_p.
2904
2905 * dispnew.c (shift_glyph_matrix, scrolling_window): Mark scrolled row
2906 for fringe update if it has periodic bitmap.
2907 (row_equal_p): Also compare left_fringe_offset, right_fringe_offset,
2908 and fringe_bitmap_periodic_p.
2909
2910 * fringe.c (get_fringe_bitmap_data): New function.
2911 (draw_fringe_bitmap_1, update_window_fringes): Use it.
2912 (update_window_fringes): Record periodicity of fringe bitmap in glyph
2913 row. Mark glyph row for fringe update if periodicity changed.
2914
2915 * xdisp.c (try_window_reusing_current_matrix): Don't mark scrolled row
2916 for fringe update unless it has periodic bitmap.
2917
2918 2011-05-25 Kenichi Handa <handa@m17n.org>
2919
2920 * xdisp.c (get_next_display_element): Set correct it->face_id for
2921 a static composition.
2922
2923 2011-05-24 Leo Liu <sdl.web@gmail.com>
2924
2925 * deps.mk (fns.o):
2926 * makefile.w32-in ($(BLD)/fns.$(O)): Include sha1.h.
2927
2928 * fns.c (crypto_hash_function, Fsha1): New function.
2929 (Fmd5): Use crypto_hash_function.
2930 (syms_of_fns): Add Ssha1.
2931
2932 2011-05-22 Paul Eggert <eggert@cs.ucla.edu>
2933
2934 * gnutls.c: Remove unused macros.
2935 (fn_gnutls_transport_set_lowat, fn_gnutls_transport_set_pull_function):
2936 (fn_gnutls_transport_set_push_function) [!WINDOWSNT]:
2937 Remove macros that are defined and never used.
2938 Caught by gcc -Wunused-macros (GCC 4.6.0, Fedora 14).
2939
2940 2011-05-22 Chong Yidong <cyd@stupidchicken.com>
2941
2942 * xselect.c (syms_of_xselect): Remove unused symbol SAVE_TARGETS.
2943 (Fx_get_selection_internal): Minor cleanup.
2944 (Fx_own_selection_internal): Rename arguments for consistency with
2945 select.el.
2946
2947 2011-05-22 Paul Eggert <eggert@cs.ucla.edu>
2948
2949 * xselect.c (QSAVE_TARGETS): New static var, to fix build failure.
2950
2951 2011-05-22 Chong Yidong <cyd@stupidchicken.com>
2952
2953 * xselect.c (syms_of_xselect): Include character.h; use DEFSYM.
2954
2955 2011-05-21 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
2956
2957 * dispnew.c (scrolling_window): Don't exclude the case that the
2958 last enabled row in the desired matrix touches the bottom boundary.
2959
2960 2011-05-21 Glenn Morris <rgm@gnu.org>
2961
2962 * Makefile.in ($(etc)/DOC): Make second command line even shorter.
2963 (SOME_MACHINE_OBJECTS): Replace FONT_OBJ by its maximal expansion,
2964 and add some more files.
2965
2966 2011-05-20 Eli Zaretskii <eliz@gnu.org>
2967
2968 * callproc.c (Fcall_process) [MSDOS]: Fix arguments to
2969 report_file_error introduced by the change from 2011-05-07.
2970
2971 2011-05-20 Paul Eggert <eggert@cs.ucla.edu>
2972
2973 * systime.h (Time): Define only if emacs is defined.
2974 This is to allow ../lib-src/profile.c to be compiled on FreeBSD,
2975 where the include path doesn't have X11/X.h by default. See
2976 <http://lists.gnu.org/archive/html/emacs-devel/2011-05/msg00561.html>.
2977
2978 2011-05-20 Kenichi Handa <handa@m17n.org>
2979
2980 * composite.c (find_automatic_composition): Fix previous change.
2981
2982 2011-05-20 Glenn Morris <rgm@gnu.org>
2983
2984 * lisp.mk: New file, split from Makefile.in.
2985 * Makefile.in (lisp): Move to separate file, inserted by @lisp_frag@.
2986 (shortlisp): Remove.
2987 ($(etc)/DOC): Edit lisp.mk rather than using $shortlisp.
2988
2989 2011-05-19 Glenn Morris <rgm@gnu.org>
2990
2991 * Makefile.in (MSDOS_SUPPORT_REAL, MSDOS_SUPPORT, NS_SUPPORT)
2992 (REAL_MOUSE_SUPPORT, GPM_MOUSE_SUPPORT, MOUSE_SUPPORT, TOOLTIP_SUPPORT)
2993 (BASE_WINDOW_SUPPORT, X_WINDOW_SUPPORT, WINDOW_SUPPORT): Remove.
2994 (lisp): Set the order to that of loadup.el.
2995 (shortlisp): Make it a copy of $lisp.
2996 (SOME_MACHINE_LISP): Remove.
2997 ($(etc)/DOC): Depend just on $lisp, not $SOME_MACHINE_LISP too.
2998 Use just $shortlisp, not $SOME_MACHINE_LISP too.
2999
3000 2011-05-18 Kenichi Handa <handa@m17n.org>
3001
3002 * composite.c (CHAR_COMPOSABLE_P): Add more check for efficiency.
3003 (BACKWARD_CHAR): Wrap the arg STOP by parenthesis.
3004 (find_automatic_composition): Mostly rewrite for efficiency.
3005
3006 2011-05-18 Juanma Barranquero <lekktu@gmail.com>
3007
3008 * makefile.w32-in: Update dependencies.
3009
3010 2011-05-18 Christoph Scholtes <cschol2112@googlemail.com>
3011
3012 * menu.c: Include limits.h (fixes the MS-Windows build broken by
3013 2011-06-18T18:49:19Z!cyd@stupidchicken.com).
3014
3015 2011-05-18 Paul Eggert <eggert@cs.ucla.edu>
3016
3017 Fix some integer overflow issues, such as string length overflow.
3018
3019 * insdel.c (count_size_as_multibyte): Check for string overflow.
3020
3021 * character.c (lisp_string_width): Check for string overflow.
3022 Use EMACS_INT, not int, for string indexes and lengths; in
3023 particular, 2nd arg is now EMACS_INT, not int. Do not crash if
3024 the resulting string length overflows an EMACS_INT; instead,
3025 report a string overflow if no precision given. When checking for
3026 precision exhaustion, use a check that cannot possibly have
3027 integer overflow. (Bug#8675)
3028 * character.h (lisp_string_width): Adjust to new signature.
3029
3030 * alloc.c (string_overflow): New function.
3031 (Fmake_string): Use it. This doesn't change behavior, but saves
3032 a few bytes and will simplify future changes.
3033 * character.c (string_escape_byte8): Likewise.
3034 * lisp.h (string_overflow): New decl.
3035
3036 Fixups, following up to the user-interface timestamp change.
3037 * nsterm.m (last_mouse_movement_time, ns_mouse_position): Use Time
3038 for UI timestamps, instead of unsigned long.
3039 * msdos.c (mouse_get_pos): Likewise.
3040 * w32inevt.c (movement_time, w32_console_mouse_position): Likewise.
3041 * w32gui.h (Time): Define by including "systime.h" rather than by
3042 declaring it ourselves. (Bug#8664)
3043
3044 * dispextern.h (struct image): Don't assume time_t <= unsigned long.
3045 * image.c (clear_image_cache): Likewise.
3046
3047 * term.c (term_mouse_position): Don't assume time_t wraparound.
3048
3049 Be more systematic about user-interface timestamps.
3050 Before, the code sometimes used 'Time', sometimes 'unsigned long',
3051 and sometimes 'EMACS_UINT', to represent these timestamps.
3052 This change causes it to use 'Time' uniformly, as that's what X uses.
3053 This makes the code easier to follow, and makes it easier to catch
3054 integer overflow bugs such as Bug#8664.
3055 * frame.c (Fmouse_position, Fmouse_pixel_position):
3056 Use Time, not unsigned long, for user-interface timestamps.
3057 * keyboard.c (last_event_timestamp, kbd_buffer_get_event): Likewise.
3058 (button_down_time, make_lispy_position, make_lispy_movement): Likewise.
3059 * keyboard.h (last_event_timestamp): Likewise.
3060 * menu.c (Fx_popup_menu) [!HAVE_X_WINDOWS]: Likewise.
3061 * menu.h (xmenu_show): Likewise.
3062 * term.c (term_mouse_position): Likewise.
3063 * termhooks.h (struct input_event.timestamp): Likewise.
3064 (struct terminal.mouse_position_hook): Likewise.
3065 * xmenu.c (create_and_show_popup_menu, xmenu_show): Likewise.
3066 * xterm.c (XTmouse_position, x_scroll_bar_report_motion): Likewise.
3067 * systime.h (Time): New decl. Pull it in from <X11/X.h> if
3068 HAVE_X_WINDOWS, otherwise define it as unsigned long, which is
3069 what it was before.
3070 * menu.h, termhooks.h: Include "systime.h", for Time.
3071
3072 * keyboard.c (make_lispy_event): Fix problem in integer overflow.
3073 Don't assume that the difference between two unsigned long values
3074 can fit into an integer. At this point, we know button_down_time
3075 <= event->timestamp, so the difference must be nonnegative, so
3076 there's no need to cast the result if double-click-time is
3077 nonnegative, as it should be; check that it's nonnegative, just in
3078 case. This bug is triggered when events are more than 2**31 ms
3079 apart (about 25 days). (Bug#8664)
3080
3081 * xselect.c (last_event_timestamp): Remove duplicate decl.
3082 (x_own_selection): Remove needless cast to unsigned long.
3083
3084 * xmenu.c (set_frame_menubar): Use int, not EMACS_UINT, for indexes
3085 that always fit in int. Use a sentinel instead of a counter, to
3086 avoid a temp and to allay GCC's concerns about possible int overflow.
3087 * frame.h (struct frame): Use int for menu_bar_items_used
3088 instead of EMACS_INT, since it always fits in int.
3089
3090 * menu.c (grow_menu_items): Check for int overflow.
3091
3092 * xmenu.c (set_frame_menubar): Don't mishandle vectors with no nils.
3093
3094 * xterm.c: Use EMACS_INT for Emacs modifiers, and int for X modifiers.
3095 Before, the code was not consistent. These values cannot exceed
3096 2**31 - 1 so there's no need to make them unsigned.
3097 (x_x_to_emacs_modifiers): Accept int and return EMACS_INT.
3098 (x_emacs_to_x_modifiers): Accept EMACS_INT and return int.
3099 (x_x_to_emacs_modifiers, x_emacs_to_x_modifiers): Reject non-integers
3100 as modifiers.
3101 * xterm.h (x_x_to_emacs_modifiers): Adjust to signature change.
3102
3103 * lisp.h (XINT) [USE_LISP_UNION_TYPE]: Cast to EMACS_INT.
3104 (XUINT) [USE_LISP_UNION_TYPE]: Cast to EMACS_UINT.
3105 Otherwise, GCC 4.6.0 warns about printf (pI, XINT (...)),
3106 presumably because the widths might not match.
3107
3108 * window.c (size_window): Avoid needless test at loop start.
3109
3110 2011-05-18 Courtney Bane <emacs-bugs-7626@cbane.org> (tiny change)
3111
3112 * term.c (Fresume_tty): Restore hooks before reinitializing (bug#8687).
3113
3114 2011-05-12 Drew Adams <drew.adams@oracle.com>
3115
3116 * textprop.c (Fprevious_single_char_property_change): Doc fix (bug#8655).
3117
3118 2011-05-12 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
3119
3120 * w32term.c (w32_draw_fringe_bitmap): Rename local vars `left' and
3121 `width' to `bar_area_x' and `bar_area_width', respectively.
3122 (x_scroll_run): Take account of fringe background extension.
3123
3124 * xterm.c (x_draw_fringe_bitmap) [USE_TOOLKIT_SCROLL_BARS]:
3125 Rename local vars `left' and `width' to `bar_area_x' and
3126 `bar_area_width', respectively.
3127 (x_scroll_run) [USE_TOOLKIT_SCROLL_BARS]: Take account of fringe
3128 background extension.
3129
3130 2011-05-10 Jim Meyering <meyering@redhat.com>
3131
3132 * xdisp.c (x_intersect_rectangles): Fix typo "the the -> the".
3133
3134 2011-05-10 Juanma Barranquero <lekktu@gmail.com>
3135
3136 * image.c (Finit_image_library): Return t for built-in image types,
3137 like pbm and xbm. (Bug#8640)
3138
3139 2011-05-09 Andreas Schwab <schwab@linux-m68k.org>
3140
3141 * w32menu.c (set_frame_menubar): Fix submenu allocation.
3142
3143 2011-05-07 Eli Zaretskii <eliz@gnu.org>
3144
3145 * w32console.c (Fset_screen_color): Doc fix.
3146 (Fget_screen_color): New function.
3147 (syms_of_ntterm): Defsubr it.
3148
3149 * callproc.c (call_process_cleanup) [MSDOS]: Don't close and
3150 unlink the temporary file if Fcall_process didn't create it in the
3151 first place.
3152 (Fcall_process) [MSDOS]: Don't create tempfile if stdout of the
3153 child process will be redirected to a file specified with `:file'.
3154 Don't try to re-open tempfile in that case, and set fd[0] to -1 as
3155 cue to call_process_cleanup not to close that handle.
3156
3157 2011-05-07 Ben Key <bkey76@gmail.com>
3158
3159 * makefile.w32-in: The bootstrap-temacs rule now makes use of
3160 one of two shell specific rules, either bootstrap-temacs-CMD or
3161 bootstrap-temacs-SH. The bootstrap-temacs-SH rule is identical
3162 to the previous implementation of the bootstrap-temacs rule.
3163 The bootstrap-temacs-CMD rule is similar to the previous
3164 implementation of the bootstrap-temacs rule except that it
3165 makes use of the ESC_CFLAGS variable instead of the CFLAGS
3166 variable.
3167
3168 These changes, along with some changes to nt/configure.bat,
3169 nt/gmake.defs, and nt/nmake.defs, are required to extend my
3170 earlier fix to add support for --cflags and --ldflags options
3171 that include quotes so that it works whether make uses cmd or
3172 sh as the shell.
3173
3174 2011-05-06 Michael Albinus <michael.albinus@gmx.de>
3175
3176 * dbusbind.c (QCdbus_type_unix_fd): Declare static.
3177 (xd_remove_watch): Don't check QCdbus_type_unix_fd for SYMBOLP, it
3178 is a constant.
3179 (Fdbus_init_bus, xd_read_queued_messages): Bus can be a symbol or
3180 a string. Handle both cases.
3181 (Fdbus_call_method_asynchronously, Fdbus_register_signal)
3182 (Fdbus_register_method): Use Qinvalid_function.
3183
3184 2011-05-06 Juanma Barranquero <lekktu@gmail.com>
3185
3186 * makefile.w32-in: Update dependencies.
3187 (LISP_H): Add inttypes.h and stdin.h.
3188 (PROCESS_H): Add unistd.h.
3189
3190 2011-05-06 Eli Zaretskii <eliz@gnu.org>
3191
3192 * lread.c: Include limits.h (fixes the MS-Windows build broken by
3193 2011-05-06T07:13:19Z!eggert@cs.ucla.edu).
3194
3195 2011-05-06 Paul Eggert <eggert@cs.ucla.edu>
3196
3197 * image.c (Finit_image_library) [!HAVE_NTGUI]: Omit unused local.
3198
3199 * term.c (vfatal): Remove stray call to va_end.
3200 It's not needed and the C Standard doesn't allow it here anyway.
3201
3202 Use C99's va_copy to avoid undefined behavior on x86-64 GNU/Linux.
3203 * eval.c (verror): doprnt a copy of ap, not the original. (Bug#8545)
3204
3205 * eval.c (verror): OK to create a string of up to MOST_POSITIVE_FIXNUM
3206 bytes.
3207
3208 * term.c: Don't include <stdarg.h>, as <lisp.h> does that.
3209
3210 * callproc.c (Fcall_process): Use 'volatile' to avoid vfork clobbering.
3211
3212 * process.c (Fformat_network_address): Fix typo: args2 -> *args2.
3213
3214 * xmenu.c (set_frame_menubar): Fix typo: int * -> int (3 times).
3215
3216 * coding.c (detect_coding_charset): Fix typo: * 2 -> *4 (Bug#8601).
3217
3218 * charset.h (struct charset.code_space): Now has 15 elements, not 16.
3219 * charset.c (Fdefine_charset_internal): Don't initialize
3220 charset.code_space[15]. The value was garbage, on hosts with
3221 32-bit int (Bug#8600).
3222
3223 * lread.c (read_integer): Be more consistent with string-to-number.
3224 Use string_to_number to do the actual conversion; this avoids
3225 rounding errors and fixes some other screwups. Without this fix,
3226 for example, #x1fffffffffffffff was misread as -2305843009213693952.
3227 (digit_to_number): Move earlier, for benefit of read_integer.
3228 Return -1 if the digit is out of range for the base, -2 if it is
3229 not a digit in any supported base. (Bug#8602)
3230
3231 * doprnt.c (doprnt): Support arbitrary pI values, such as "I64".
3232
3233 * dispnew.c (scrolling_window): Return 1 if we scrolled,
3234 to match comment at start of function. This also removes a
3235 GCC warning about overflow in a 32+64-bit port.
3236
3237 * lisp.h (EMACS_INT, EMACS_UINT, BITS_PER_EMACS_INT, pI): Simplify.
3238
3239 * dbusbind.c: Do not use XPNTR on a value that may be an integer.
3240 Reported by Stefan Monnier in
3241 <http://lists.gnu.org/archive/html/emacs-devel/2011-04/msg00919.html>.
3242 (xd_remove_watch, Fdbus_init_bus, xd_read_queued_messages):
3243 Use SYMBOLP-guarded XSYMBOL, not XPNTR.
3244
3245 * lisp.h (EMACS_INTPTR): Remove. All uses changed to intptr_t.
3246 (EMACS_UINTPTR): Likewise, with uintptr_t.
3247
3248 * lisp.h: Prefer 64-bit EMACS_INT if available.
3249 (EMACS_INT, EMACS_UINT, BITS_PER_EMACS_INT, pI): Define to 64-bit
3250 on 32-bit hosts that have 64-bit int, so that they can access
3251 large files.
3252 However, temporarily disable this change unless the temporary
3253 symbol WIDE_EMACS_INT is defined.
3254
3255 * lread.c, process.c: Do not include <inttypes.h>; lisp.h does it now.
3256
3257 Prefer intptr_t/uintptr_t for integers the same widths as pointers.
3258 This removes an assumption that EMACS_INT and long are the same
3259 width as pointers. The assumption is true for Emacs porting targets
3260 now, but we want to make other targets possible.
3261 * lisp.h: Include <inttypes.h>, for INTPTR_MAX, UINTPTR_MAX.
3262 (EMACS_INTPTR, EMACS_UINTPTR): New macros.
3263 In the rest of the code, change types of integers that hold casted
3264 pointers to EMACS_INTPTR and EMACS_UINTPTR, systematically
3265 replacing EMACS_INT, long, EMACS_UINT, and unsigned long.
3266 (XTYPE): Don't cast arg to EMACS_UINT; normally is not needed.
3267 (XSET): Cast type of XTYPE arg to EMACS_INTPTR; it is needed here.
3268 No need to cast type when ORing.
3269 (XPNTR): Return a value of type EMACS_INTPTR or EMACS_UINTPTR.
3270 * alloc.c (lisp_align_malloc): Remove a no-longer-needed cast.
3271 * doc.c (store_function_docstring): Use EMACS_INTPTR, so as not to
3272 assume EMACS_INT is the same width as char *.
3273 * gtkutil.c (xg_gtk_scroll_destroy, xg_tool_bar_button_cb):
3274 (xg_tool_bar_callback, xg_tool_bar_help_callback, xg_make_tool_item):
3275 Remove no-longer-needed casts.
3276 (xg_create_scroll_bar, xg_tool_bar_button_cb, xg_tool_bar_callback):
3277 (xg_tool_bar_help_callback, xg_make_tool_item):
3278 Use EMACS_INTPTR to hold an integer
3279 that will be cast to void *; this can avoid a GCC warning
3280 if EMACS_INT is not the same width as void *.
3281 * menu.c (find_and_call_menu_selection): Remove no-longer-needed cast.
3282 * xdisp.c (display_echo_area_1, resize_mini_window_1):
3283 (current_message_1, set_message_1):
3284 Use a local to convert to proper width without a cast.
3285 * xmenu.c (dialog_selection_callback): Likewise.
3286
3287 * sysdep.c (get_random): Don't assume EMACS_INT is no wider than long.
3288 Also, don't assume VALBITS / RAND_BITS is less than 5,
3289 and don't rely on undefined behavior when shifting a 1 left into
3290 the sign bit.
3291 * lisp.h (get_random): Change signature to match.
3292
3293 * lread.c (hash_string): Use size_t, not int, for hash computation.
3294 Normally we prefer signed values; but hashing is special, because
3295 it's better to use unsigned division on hash table sizes so that
3296 the remainder is nonnegative. Also, size_t is the natural width
3297 for hashing into memory. The previous code used 'int', which doesn't
3298 retain enough info to hash well into very large tables.
3299 (oblookup, oblookup_last_bucket_number, Funintern): Likewise.
3300
3301 * dbusbind.c: Don't possibly lose pointer info when converting.
3302 (xd_remove_watch, Fdbus_init_bus, xd_read_queued_messages):
3303 Use XPNTR rather than XHASH, so that the high-order bits of
3304 the pointer aren't lost when converting through void *.
3305
3306 * eval.c (Fautoload): Don't double-shift a pointer.
3307
3308 * fns.c (Frandom): Let EMACS_UINT be wider than unsigned long.
3309
3310 2011-05-06 Juanma Barranquero <lekktu@gmail.com>
3311
3312 * gnutls.c (DEF_GNUTLS_FN):
3313 * image.c (DEF_IMGLIB_FN): Make function pointers static.
3314
3315 2011-05-05 Andreas Schwab <schwab@linux-m68k.org>
3316
3317 * lread.c (lisp_file_lexically_bound_p): Stop scanning at end
3318 marker. (Bug#8610)
3319
3320 2011-05-05 Eli Zaretskii <eliz@gnu.org>
3321
3322 * w32heap.c (allocate_heap) [USE_LISP_UNION_TYPE || USE_LSB_TAG]:
3323 New version that can reserve upto 2GB of heap space.
3324
3325 2011-05-05 Chong Yidong <cyd@stupidchicken.com>
3326
3327 * nsfns.m (Fns_read_file_name): Doc fix (Bug#8534).
3328
3329 2011-05-05 Teodor Zlatanov <tzz@lifelogs.com>
3330
3331 * gnutls.c (fn_gnutls_certificate_set_x509_key_file): Add alias to
3332 `gnutls_certificate_set_x509_key_file'.
3333
3334 2011-05-05 Juanma Barranquero <lekktu@gmail.com>
3335
3336 * makefile.w32-in ($(BLD)/image.$(O), $(BLD)/process.$(O)):
3337 Update dependencies.
3338
3339 2011-05-04 Juanma Barranquero <lekktu@gmail.com>
3340
3341 * gnutls.h (emacs_gnutls_write, emacs_gnutls_read):
3342 * gnutls.c (emacs_gnutls_write, emacs_gnutls_read):
3343 Remove unused parameter `fildes'.
3344 * process.c (read_process_output, send_process): Don't pass it.
3345
3346 2011-05-04 Juanma Barranquero <lekktu@gmail.com>
3347
3348 Fix previous change: the library cache is defined in w32.c.
3349 * image.c (CACHE_IMAGE_TYPE) [!HAVE_NTGUI]: Define to noop.
3350 (Finit_image_library): Wrap Vlibrary_cache on "#ifdef HAVE_NTGUI".
3351
3352 2011-05-04 Juanma Barranquero <lekktu@gmail.com>
3353
3354 Implement dynamic loading of GnuTLS on Windows.
3355
3356 * gnutls.h (GNUTLS_EMACS_ERROR_NOT_LOADED): New macro.
3357 (emacs_gnutls_write, emacs_gnutls_read): Mark as extern.
3358 (emacs_gnutls_record_check_pending, emacs_gnutls_transport_set_errno):
3359 Declare.
3360
3361 * gnutls.c (Qgnutls_dll): Define.
3362 (DEF_GNUTLS_FN, LOAD_GNUTLS_FN): New macros.
3363 (gnutls_*): Declare function pointers.
3364 (init_gnutls_functions): New function to initialize function pointers.
3365 (emacs_gnutls_handshake, Fgnutls_error_string, Fgnutls_deinit)
3366 (emacs_gnutls_global_init, Fgnutls_bye): Use function pointers.
3367 (emacs_gnutls_record_check_pending, emacs_gnutls_transport_set_errno):
3368 Wrappers for gnutls_record_check_pending and gnutls_transport_set_errno.
3369 (emacs_gnutls_write, emacs_gnutls_read)
3370 (emacs_gnutls_handle_error, Fgnutls_error_fatalp)
3371 (Fgnutls_available_p): New function.
3372 (Fgnutls_boot): Call Fgnutls_available_p. Use function pointers.
3373 (syms_of_gnutls) <Qgnutls_dll>: Initialize and staticpro it.
3374 (syms_of_gnutls) <Sgnutls_available_p>: defsubr it.
3375
3376 * image.c: Include w32.h.
3377 (Vimage_type_cache): Delete.
3378 (syms_of_image) <Vimage_type_cache>: Don't initialize and staticpro it.
3379 (CACHE_IMAGE_TYPE, Finit_image_library): Use Vlibrary_cache instead.
3380 (w32_delayed_load): Move to w32.c.
3381
3382 * w32.h (VlibraryCache, QCloaded_from, w32_delayed_load): Declare.
3383
3384 * w32.c (QCloaded_from, Vlibrary_cache): Define.
3385 (w32_delayed_load): Move from image.c. When loading a library, record
3386 its filename in the :loaded-from property of the library id.
3387 (globals_of_w32) <QCloaded_from, Vlibrary_cache>:
3388 Initialize and staticpro them.
3389 (emacs_gnutls_pull, emacs_gnutls_push): Call emacs_gnutls_* functions.
3390
3391 * process.c: Include lisp.h before w32.h, not after.
3392 (wait_reading_process_output): Call emacs_gnutls_record_check_pending
3393 instead of gnutls_record_check_pending.
3394
3395 * callproc.c, emacs.c: Include lisp.h before w32.h, not after.
3396
3397 2011-05-04 Teodor Zlatanov <tzz@lifelogs.com>
3398
3399 * gnutls.c (Fgnutls_boot): Support :keylist and :crlfiles options
3400 instead of :keyfiles. Give GnuTLS the keylist and the CRL lists
3401 as passed in.
3402
3403 2011-05-03 Jan Djärv <jan.h.d@swipnet.se>
3404
3405 * xterm.c (x_set_frame_alpha): Do not set property on anything
3406 else than FRAME_X_OUTER_WINDOW (Bug#8608).
3407
3408 2011-05-02 Juanma Barranquero <lekktu@gmail.com>
3409
3410 * sysdep.c (get_tty_size) [WINDOWSNT]: Implement. (Bug#8596)
3411
3412 2011-05-02 Juanma Barranquero <lekktu@gmail.com>
3413
3414 * gnutls.c (Qgnutls_log_level, Qgnutls_code, Qgnutls_anon)
3415 (Qgnutls_x509pki, Qgnutls_e_interrupted, Qgnutls_e_again)
3416 (Qgnutls_e_invalid_session, Qgnutls_e_not_ready_for_handshake)
3417 (gnutls_global_initialized, Qgnutls_bootprop_priority)
3418 (Qgnutls_bootprop_trustfiles, Qgnutls_bootprop_keyfiles)
3419 (Qgnutls_bootprop_callbacks, Qgnutls_bootprop_loglevel)
3420 (Qgnutls_bootprop_hostname, Qgnutls_bootprop_verify_flags)
3421 (Qgnutls_bootprop_verify_error, Qgnutls_bootprop_verify_hostname_error)
3422 (Qgnutls_bootprop_callbacks_verify): Make static.
3423
3424 2011-05-01 Andreas Schwab <schwab@linux-m68k.org>
3425
3426 * callproc.c: Indentation fixup.
3427
3428 * sysdep.c (wait_for_termination_1): Make static.
3429 (wait_for_termination, interruptible_wait_for_termination):
3430 Move after wait_for_termination_1.
3431
3432 2011-05-01 Lars Magne Ingebrigtsen <larsi@gnus.org>
3433
3434 * sysdep.c (interruptible_wait_for_termination): New function
3435 which is like wait_for_termination, but allows keyboard
3436 interruptions.
3437
3438 * callproc.c (Fcall_process): Add (:file "file") as an option for
3439 the STDOUT buffer.
3440 (Fcall_process_region): Ditto.
3441
3442 2011-04-30 Eli Zaretskii <eliz@gnu.org>
3443
3444 * dosfns.c (Fint86, Fdos_memget, Fdos_memput): Use `ASIZE (FOO)'
3445 rather than `XVECTOR (FOO)->size'.
3446
3447 * process.c: Remove HAVE_INTTYPES_H condition from inclusion of
3448 inttypes.h, as a gnulib replacement is used if it not available in
3449 system headers.
3450
3451 2011-04-21 Eli Zaretskii <eliz@gnu.org>
3452
3453 Lift the MOST_POSITIVE_FIXNUM/4 limitation on visited files.
3454 * fileio.c (Finsert_file_contents): Don't limit file size to 1/4
3455 of MOST_POSITIVE_FIXNUM. (Bug#8528)
3456
3457 * coding.c (coding_alloc_by_realloc): Error out if destination
3458 will grow beyond MOST_POSITIVE_FIXNUM.
3459 (decode_coding_emacs_mule): Abort if there isn't enough place in
3460 charbuf for the composition carryover bytes. Reserve an extra
3461 space for up to 2 characters produced in a loop.
3462 (decode_coding_iso_2022): Abort if there isn't enough place in
3463 charbuf for the composition carryover bytes.
3464
3465 2011-04-21 Eli Zaretskii <eliz@gnu.org>
3466
3467 * doprnt.c (doprnt) [!HAVE_LONG_LONG_INT]: Error out instead of
3468 aborting when %lld or %lll format is passed.
3469 [!HAVE_UNSIGNED_LONG_LONG_INT]: Error out instead of aborting when
3470 %llo or %llx format is passed. (Bug#8545)
3471
3472 * window.c (window_scroll_line_based): Use a marker instead of
3473 simple variables to record original value of point. (Bug#7952)
3474
3475 * doprnt.c (doprnt): Fix the case where a multibyte sequence
3476 produced by %s or %c overflows available buffer space. (Bug#8545)
3477
3478 2011-04-28 Paul Eggert <eggert@cs.ucla.edu>
3479
3480 * doprnt.c (doprnt): Omit useless test; int overflow check (Bug#8545).
3481 (SIZE_MAX): Move defn after all includes, as they might #define it.
3482
3483 2011-04-28 Juanma Barranquero <lekktu@gmail.com>
3484
3485 * w32.c (init_environment): Warn about defaulting HOME to C:\.
3486
3487 2011-04-28 Juanma Barranquero <lekktu@gmail.com>
3488
3489 * keyboard.c (Qdelayed_warnings_hook): Define.
3490 (command_loop_1): Run `delayed-warnings-hook'
3491 if Vdelayed_warnings_list is non-nil.
3492 (syms_of_keyboard) <delayed-warnings-hook>: DEFSYM it.
3493 (syms_of_keyboard) <delayed-warnings-list>: DEFVAR_LISP it.
3494
3495 2011-04-28 Eli Zaretskii <eliz@gnu.org>
3496
3497 * doprnt.c (doprnt): Don't return value smaller than the buffer
3498 size if the message was truncated. (Bug#8545).
3499
3500 2011-04-28 Juanma Barranquero <lekktu@gmail.com>
3501
3502 * w32fns.c (Fx_change_window_property, Fx_delete_window_property)
3503 (Fx_window_property): #if-0 the whole functions, not just the bodies.
3504
3505 2011-04-27 Paul Eggert <eggert@cs.ucla.edu>
3506
3507 * doprnt.c (doprnt): Support "ll" length modifier, for long long.
3508
3509 2011-04-27 Juanma Barranquero <lekktu@gmail.com>
3510
3511 * makefile.w32-in: Update dependencies.
3512
3513 2011-04-27 Eli Zaretskii <eliz@gnu.org>
3514
3515 Improve `doprnt' and its usage. (Bug#8545)
3516 * doprnt.c (doprnt): Make sure `format' is never accessed beyond
3517 `format_end'. Remove support for %l as a conversion specifier.
3518 Don't use xrealloc. Improve diagnostics when the %l size modifier
3519 is used. Update the commentary.
3520
3521 * eval.c (verror): Simplify calculation of size_t.
3522
3523 * coding.c (Ffind_operation_coding_system): Fix diagnostic error
3524 messages.
3525
3526 2011-04-27 Yoshiaki Kasahara <kasahara@nc.kyushu-u.ac.jp> (tiny change)
3527
3528 * buffer.c (init_buffer) [USE_MMAP_FOR_BUFFERS]: Adjust to aliasing
3529 change.
3530
3531 2011-04-27 Paul Eggert <eggert@cs.ucla.edu>
3532
3533 * nsmenu.m: Replace all uses of XVECTOR with ASIZE and AREF.
3534 This makes this file independent of the recent pseudovector change.
3535
3536 2011-04-26 Paul Eggert <eggert@cs.ucla.edu>
3537
3538 * keyboard.c (handle_user_signal): Fix pointer signedness problem.
3539
3540 * gnutls.c (emacs_gnutls_handle_error): Remove unused local.
3541 (Fgnutls_boot): gnutls_certificate_verify_peers2 wants unsigned *.
3542 Remove unused local.
3543 (emacs_gnutls_write): Don't use uninitialized rtnval if nbyte <= 0.
3544
3545 * lisp.h: Fix a problem with aliasing and vector headers. (Bug#8546)
3546 GCC 4.6.0 optimizes based on type-based alias analysis.
3547 For example, if b is of type struct buffer * and v of type struct
3548 Lisp_Vector *, then gcc -O2 was incorrectly assuming that &b->size
3549 != &v->size, and therefore "v->size = 1; b->size = 2; return
3550 v->size;" must therefore return 1. This assumption is incorrect
3551 for Emacs, since it type-puns struct Lisp_Vector * with many other
3552 types. To fix this problem, this patch adds a new type struct
3553 vectorlike_header that documents the constraints on layout of vectors
3554 and pseudovectors, and helps optimizing compilers not get fooled
3555 by Emacs's type punning. It also adds the macros XSETTYPED_PVECTYPE
3556 XSETTYPED_PSEUDOVECTOR, TYPED_PSEUDOVECTORP, for similar reasons.
3557 * lisp.h (XSETTYPED_PVECTYPE): New macro, specifying the name of
3558 the size member.
3559 (XSETPVECTYPE): Rewrite in terms of new macro.
3560 (XSETPVECTYPESIZE): New macro, specifying both type and size.
3561 This is a bit clearer, and further avoids the possibility of
3562 undesirable aliasing.
3563 (XSETTYPED_PSEUDOVECTOR): New macro, specifying the size.
3564 (XSETPSEUDOVECTOR): Rewrite in terms of XSETTYPED_PSEUDOVECTOR.
3565 (XSETSUBR): Rewrite in terms of XSETTYPED_PSEUDOVECTOR and XSIZE,
3566 since Lisp_Subr is a special case (no "next" field).
3567 (ASIZE): Now uses header.size rather than size.
3568 All previous uses of XVECTOR (foo)->size replaced to use this macro,
3569 to avoid the hassle of writing XVECTOR (foo)->header.size.
3570 (struct vectorlike_header): New type.
3571 (TYPED_PSEUDOVECTORP): New macro, also specifying the C type of the
3572 object, to help avoid aliasing.
3573 (PSEUDOVECTORP): Rewrite in terms of TYPED_PSEUDOVECTORP.
3574 (SUBRP): Likewise, since Lisp_Subr is a special case.
3575 * lisp.h (struct Lisp_Vector, struct Lisp_Char_Table):
3576 (struct Lisp_Sub_Char_Table, struct Lisp_Bool_Vector):
3577 (struct Lisp_Hash_Table): Combine first two members into a single
3578 struct vectorlike_header member. All uses of "size" and "next" members
3579 changed to be "header.size" and "header.next".
3580 * buffer.h (struct buffer): Likewise.
3581 * font.h (struct font_spec, struct font_entity, struct font): Likewise.
3582 * frame.h (struct frame): Likewise.
3583 * process.h (struct Lisp_Process): Likewise.
3584 * termhooks.h (struct terminal): Likewise.
3585 * window.c (struct save_window_data, struct saved_window): Likewise.
3586 * window.h (struct window): Likewise.
3587 * alloc.c (allocate_buffer, Fmake_bool_vector, allocate_pseudovector):
3588 Use XSETPVECTYPESIZE, not XSETPVECTYPE, to avoid aliasing problems.
3589 * buffer.c (init_buffer_once): Likewise.
3590 * lread.c (defsubr): Use XSETTYPED_PVECTYPE, since Lisp_Subr is a
3591 special case.
3592 * process.c (Fformat_network_address): Use local var for size,
3593 for brevity.
3594
3595 * bytecode.c (exec_byte_code): Don't use XVECTOR before CHECK_VECTOR.
3596
3597 Make the Lisp reader and string-to-float more consistent (Bug#8525)
3598 * data.c (atof): Remove decl; no longer used or needed.
3599 (digit_to_number): Move to lread.c.
3600 (Fstring_to_number): Use new string_to_number function, to be
3601 consistent with how the Lisp reader treats infinities and NaNs.
3602 Do not assume that floating-point numbers represent EMACS_INT
3603 without losing information; this is not true on most 64-bit hosts.
3604 Avoid double-rounding errors, by insisting on integers when
3605 parsing non-base-10 numbers, as the documentation specifies.
3606 * lisp.h (string_to_number): New decl, replacing ...
3607 (isfloat_string): Remove.
3608 * lread.c: Include <inttypes.h>, for uintmax_t and strtoumax.
3609 (read1): Do not accept +. and -. as integers; this
3610 appears to have been a coding error. Similarly, do not accept
3611 strings like +-1e0 as floating point numbers. Do not report
3612 overflow for integer overflows unless the base is not 10 which
3613 means we have no simple and reliable way to continue.
3614 Break out the floating-point parsing into a new
3615 function string_to_number, so that Fstring_to_number parses
3616 floating point numbers consistently with the Lisp reader.
3617 (digit_to_number): Move here from data.c. Make it static inline.
3618 (E_CHAR, EXP_INT): Remove, replacing with ...
3619 (E_EXP): New macro, to solve the "1.0e+" problem mentioned below.
3620 (string_to_number): New function, replacing isfloat_string.
3621 This function checks for valid syntax and produces the resulting
3622 Lisp float number too. Rework it so that string-to-number
3623 no longer mishandles examples like "1.0e+". Use strtoumax,
3624 so that overflow for non-base-10 numbers is reported only when
3625 there's no portable and simple way to convert to floating point.
3626
3627 * textprop.c (set_text_properties_1): Rewrite for clarity,
3628 and to avoid GCC warning about integer overflow.
3629
3630 * intervals.h (struct interval): Use EMACS_INT for members
3631 where EMACS_UINT might cause problems. See
3632 <http://lists.gnu.org/archive/html/emacs-devel/2011-04/msg00514.html>.
3633 (CHECK_TOTAL_LENGTH): Remove cast to EMACS_INT; no longer needed.
3634 * intervals.c (interval_deletion_adjustment): Now returns EMACS_INT.
3635 All uses changed.
3636 (offset_intervals): Tell GCC not to worry about length overflow
3637 when negating a negative length.
3638
3639 * alloc.c (overrun_check_malloc, overrun_check_realloc): Now static.
3640 (overrun_check_free): Likewise.
3641
3642 * alloc.c (SDATA_SIZE) [!GC_CHECK_STRING_BYTES]: Avoid runtime check
3643 in the common case where SDATA_DATA_OFFSET is a multiple of Emacs
3644 word size.
3645
3646 * gnutls.c: Fix problems found by GCC 4.6.0 on Ubuntu 10.10.
3647 (gnutls_make_error): Rename local to avoid shadowing.
3648 (gnutls_emacs_global_deinit): ifdef out; not used.
3649 (Fgnutls_boot): Use const for pointer to readonly storage.
3650 Comment out unused local. Fix pointer signedness problems.
3651
3652 * lread.c (openp): Don't stuff size_t into an 'int'.
3653 Use <= on length, not < on length + 1, to avoid GCC 4.6.0 warning
3654 about possible signed overflow.
3655
3656 * gtkutil.c: Fix problems found by GCC 4.6.0 on Ubuntu 10.10.
3657 (GDK_KEY_g): Don't define if already defined.
3658 (xg_prepare_tooltip): Avoid pointer signedness problem.
3659 (xg_set_toolkit_scroll_bar_thumb): Redo to avoid two casts.
3660
3661 * process.c (Fnetwork_interface_info): Avoid left-shift undefined
3662 behavior with 1 << 31. GCC 4.6.0 warns about this on 32-bit hosts.
3663
3664 * xfns.c (Fx_window_property): Simplify a bit,
3665 to make a bit faster and to avoid GCC 4.6.0 warning.
3666 * xselect.c (x_get_window_property, x_handle_dnd_message): Likewise.
3667
3668 * fns.c (internal_equal): Don't assume size_t fits in int.
3669
3670 * alloc.c (compact_small_strings): Tighten assertion a little.
3671
3672 Replace pEd with more-general pI, and fix some printf arg casts.
3673 * lisp.h (pI): New macro, generalizing old pEd macro to other
3674 conversion specifiers. For example, use "...%"pI"d..." rather
3675 than "...%"pEd"...".
3676 (pEd): Remove. All uses replaced with similar uses of pI.
3677 * src/m/amdx86-64.h, src/m/ia64.h, src/m/ibms390x.h: Likewise.
3678 * alloc.c (check_pure_size): Don't overflow by converting size to int.
3679 * bidi.c (bidi_dump_cached_states): Use pI to avoid cast.
3680 * data.c (Fnumber_to_string): Use pI instead of if-then-else-abort.
3681 * dbusbind.c (xd_append_arg): Use pI to avoid cast.
3682 (Fdbus_method_return_internal, Fdbus_method_error_internal): Likewise.
3683 * font.c (font_unparse_xlfd): Avoid potential buffer overrun on
3684 64-bit hosts.
3685 (font_unparse_xlfd, font_unparse_fcname): Use pI to avoid casts.
3686 * keyboard.c (record_char, modify_event_symbol): Use pI to avoid casts.
3687 * print.c (safe_debug_print, print_object): Likewise.
3688 (print_object): Don't overflow by converting EMACS_INT or EMACS_UINT
3689 to int.
3690 Use pI instead of if-then-else-abort. Use %p to avoid casts,
3691 avoiding the 0 flag, which is not portable.
3692 * process.c (Fmake_network_process): Use pI to avoid cast.
3693 * region-cache.c (pp_cache): Likewise.
3694 * xdisp.c (decode_mode_spec): Likewise.
3695 * xrdb.c (x_load_resources) [USE_MOTIF]: Use pI to avoid undefined
3696 behavior on 64-bit hosts with printf arg.
3697 * xselect.c (x_queue_event): Use %p to avoid casts, avoiding 0 flag.
3698 (x_stop_queuing_selection_requests): Likewise.
3699 (x_get_window_property): Don't truncate byte count to an 'int'
3700 when tracing.
3701
3702 * frame.c (frame_name_fnn_p): Get rid of strtol, which isn't right
3703 here, since it parses constructs like leading '-' and spaces,
3704 which are not wanted; and it overflows with large numbers.
3705 Instead, simply match F[0-9]+, which is what is wanted anyway.
3706
3707 * alloc.c: Remove unportable assumptions about struct layout.
3708 (SDATA_SELECTOR, SDATA_DATA_OFFSET): New macros.
3709 (SDATA_OF_STRING, SDATA_SIZE, allocate_string_data):
3710 (allocate_vectorlike, make_pure_vector): Use the new macros,
3711 plus offsetof, to remove unportable assumptions about struct layout.
3712 These assumptions hold on all porting targets that I know of, but
3713 they are not guaranteed, they're easy to remove, and removing them
3714 makes further changes easier.
3715
3716 * alloc.c (BLOCK BYTES): Fix typo by changing "ablock" to "ablocks".
3717 This doesn't fix a bug but makes the code clearer.
3718 (string_overrun_cookie): Now const. Use initializers that
3719 don't formally overflow signed char, to avoid warnings.
3720 (allocate_string_data) [GC_CHECK_STRING_OVERRUN]: Fix typo that
3721 can cause Emacs to crash when string overrun checking is enabled.
3722 (allocate_buffer): Don't assume sizeof (struct buffer) is a
3723 multiple of sizeof (EMACS_INT); it need not be, if
3724 alignof(EMACS_INT) < sizeof (EMACS_INT).
3725 (check_sblock, check_string_bytes, check_string_free_list): Protoize.
3726
3727 2011-04-26 Juanma Barranquero <lekktu@gmail.com>
3728
3729 * keyboard.c (QCrtl): Rename from Qrtl. All uses changed.
3730
3731 2011-04-26 Teodor Zlatanov <tzz@lifelogs.com>
3732
3733 * gnutls.c (emacs_gnutls_handshake): Return an error if we're not
3734 supposed to be handshaking. (Bug#8556)
3735 Reported by Paul Eggert <eggert@cs.ucla.edu>.
3736
3737 2011-04-26 Daniel Colascione <dan.colascione@gmail.com>
3738
3739 * lisp.h (Qdebug): List symbol.
3740 * eval.c (Qdebug): Restore global linkage.
3741 * keyboard.c (debug-on-event): New variable.
3742 (handle_user_signal): Break into debugger when debug-on-event
3743 matches the current signal symbol.
3744
3745 2011-04-25 Dan Nicolaescu <dann@ics.uci.edu>
3746
3747 * alloc.c (check_sblock, check_string_bytes)
3748 (check_string_free_list): Convert to standard C.
3749
3750 2011-04-25 Teodor Zlatanov <tzz@lifelogs.com>
3751
3752 * w32.c (emacs_gnutls_push): Fix typo.
3753
3754 2011-04-25 Eli Zaretskii <eliz@gnu.org>
3755
3756 * gnutls.c (emacs_gnutls_handshake): Avoid compiler warnings about
3757 "cast to pointer from integer of different size".
3758
3759 Improve doprnt and its use in verror. (Bug#8545)
3760 * doprnt.c (doprnt): Document the set of format control sequences
3761 supported by the function. Use SAFE_ALLOCA instead of always
3762 using `alloca'.
3763
3764 * eval.c (verror): Don't limit the buffer size at size_max-1, that
3765 is one byte too soon. Don't use xrealloc; instead xfree and
3766 xmalloc anew.
3767
3768 2011-04-24 Teodor Zlatanov <tzz@lifelogs.com>
3769
3770 * gnutls.h: Add GNUTLS_STAGE_CALLBACKS enum to denote we're in the
3771 callbacks stage.
3772
3773 * gnutls.c: Renamed global_initialized to
3774 gnutls_global_initialized. Added internals for the
3775 :verify-hostname-error, :verify-error, and :verify-flags
3776 parameters of `gnutls-boot' and documented those parameters in the
3777 docstring. Start callback support.
3778 (emacs_gnutls_handshake): Add Woe32 support. Retry handshake
3779 unless a fatal error occurred. Call gnutls_alert_send_appropriate
3780 on error. Return error code.
3781 (emacs_gnutls_write): Call emacs_gnutls_handle_error.
3782 (emacs_gnutls_read): Likewise.
3783 (Fgnutls_boot): Return handshake error code.
3784 (emacs_gnutls_handle_error): New function.
3785 (wsaerror_to_errno): Likewise.
3786
3787 * w32.h (emacs_gnutls_pull): Add prototype.
3788 (emacs_gnutls_push): Likewise.
3789
3790 * w32.c (emacs_gnutls_pull): New function for GnuTLS on Woe32.
3791 (emacs_gnutls_push): Likewise.
3792
3793 2011-04-24 Claudio Bley <claudio.bley@gmail.com> (tiny change)
3794
3795 * process.c (wait_reading_process_output): Check if GnuTLS
3796 buffered some data internally if no FDs are set for TLS
3797 connections.
3798
3799 * makefile.w32-in (OBJ2): Add gnutls.$(O).
3800 (LIBS): Link to USER_LIBS.
3801 ($(BLD)/gnutls.$(0)): New target.
3802
3803 2011-04-24 Eli Zaretskii <eliz@gnu.org>
3804
3805 * xdisp.c (handle_single_display_spec): Rename the
3806 display_replaced_before_p argument into display_replaced_p, to
3807 make it consistent with the commentary. Fix typos in the
3808 commentary.
3809
3810 * textprop.c (syms_of_textprop): Remove dead code.
3811 (copy_text_properties): Delete obsolete commentary about an
3812 interface that was deleted long ago. Fix typos in the description
3813 of arguments.
3814
3815 * msdos.c (XMenuActivate, XMenuAddSelection): Adjust argument list
3816 to changes in oldXMenu/XMenu.h from 2011-04-16.
3817 <menu_help_message, prev_menu_help_message>: Constify.
3818 (IT_menu_make_room): menu->help_text is now `const char **';
3819 adjust.
3820
3821 * msdos.h (XMenuActivate, XMenuAddSelection): Adjust prototypes
3822 to changes in oldXMenu/XMenu.h from 2011-04-16.
3823 (struct XMenu): Declare `help_text' `const char **'.
3824
3825 * xfaces.c <Qunspecified>: Make extern again.
3826
3827 * syntax.c: Include sys/types.h before including regex.h, as
3828 required by Posix.
3829
3830 * doc.c (get_doc_string): Improve the format passed to `error'.
3831
3832 * doprnt.c (doprnt): Improve commentary.
3833
3834 * term.c (init_tty) [MSDOS]: Fix 1st argument to maybe_fatal.
3835
3836 * Makefile.in (TAGS): Depend on $(M_FILE) and $(S_FILE), and scan
3837 them with etags.
3838
3839 * makefile.w32-in (globals.h): Add a dummy recipe, to make any
3840 changes in globals.h immediately force recompilation.
3841 (TAGS): Depend on $(CURDIR)/m/intel386.h and
3842 $(CURDIR)/s/ms-w32.h.
3843 (TAGS-gmake): Scan $(CURDIR)/m/intel386.h and $(CURDIR)/s/ms-w32.h.
3844
3845 * character.c (Fchar_direction): Function deleted.
3846 (syms_of_character): Don't defsubr it.
3847 <char-direction-table>: Deleted.
3848
3849 2011-04-23 Eli Zaretskii <eliz@gnu.org>
3850
3851 Fix doprnt so it could be used again safely in `verror'. (Bug#8435)
3852 * doprnt.c: Include limits.h.
3853 (SIZE_MAX): New macro.
3854 (doprnt): Return a size_t value. 2nd arg is now size_t.
3855 Many local variables are now size_t instead of int or unsigned.
3856 Improve overflow protection. Support `l' modifier for integer
3857 conversions. Support %l conversion. Don't assume an EMACS_INT
3858 argument for integer conversions and for %c.
3859
3860 * lisp.h (doprnt): Restore prototype.
3861
3862 * makefile.w32-in ($(BLD)/callint.$(O)): Depend on
3863 $(SRC)/character.h.
3864
3865 * Makefile.in (base_obj): Add back doprnt.o.
3866
3867 * deps.mk (doprnt.o): Add back prerequisites.
3868 (callint.o): Depend on character.h.
3869
3870 * eval.c (internal_lisp_condition_case): Include the handler
3871 representation in the error message.
3872 (verror): Call doprnt instead of vsnprintf. Fix an off-by-one bug
3873 when breaking from the loop.
3874
3875 * xdisp.c (vmessage): Call doprnt instead of vsnprintf.
3876
3877 * callint.c (Fcall_interactively): When displaying error message
3878 about invalid control letter, pass the character's codepoint, not
3879 a pointer to its multibyte form. Improve display of the character
3880 in octal and display also its hex code.
3881
3882 * character.c (char_string): Use %x to display the (unsigned)
3883 codepoint of an invalid character, to avoid displaying a bogus
3884 negative value.
3885
3886 * font.c (check_otf_features): Pass SDATA of SYMBOL_NAME to
3887 `error', not SYMBOL_NAME itself.
3888
3889 * coding.c (Fencode_sjis_char, Fencode_big5_char): Use %c for
3890 character arguments to `error'.
3891
3892 * charset.c (check_iso_charset_parameter): Fix incorrect argument
3893 to `error' in error message about FINAL_CHAR argument. Make sure
3894 FINAL_CHAR is a character, and use %c when it is passed as
3895 argument to `error'.
3896
3897 2011-04-23 Eli Zaretskii <eliz@gnu.org>
3898
3899 * s/ms-w32.h (localtime): Redirect to sys_localtime.
3900
3901 * w32.c: Include <time.h>.
3902 (sys_localtime): New function.
3903
3904 2011-04-23 Chong Yidong <cyd@stupidchicken.com>
3905
3906 * xdisp.c (init_xdisp): Initialize echo_area_window (Bug#6451).
3907
3908 * buffer.c (syms_of_buffer): Doc fix (Bug#6902).
3909
3910 2011-04-23 Samuel Thibault <sthibault@debian.org> (tiny change)
3911
3912 * sysdep.c (wait_for_termination): On GNU Hurd, kill returns -1 on
3913 zombies (Bug#8467).
3914
3915 2011-04-19 Eli Zaretskii <eliz@gnu.org>
3916
3917 * syntax.h (SETUP_SYNTAX_TABLE_FOR_OBJECT): Fix setting of
3918 gl_state.e_property when gl_state.object is Qt.
3919
3920 * insdel.c (make_gap_larger): Remove limitation of buffer size
3921 to <= INT_MAX.
3922
3923 2011-04-18 Chong Yidong <cyd@stupidchicken.com>
3924
3925 * xdisp.c (lookup_glyphless_char_display)
3926 (produce_glyphless_glyph): Handle cons cell entry in
3927 glyphless-char-display.
3928 (Vglyphless_char_display): Document it.
3929
3930 * term.c (produce_glyphless_glyph): Handle cons cell entry in
3931 glyphless-char-display.
3932
3933 2011-04-17 Chong Yidong <cyd@stupidchicken.com>
3934
3935 * xdisp.c (get_next_display_element): Remove unnecessary ifdefs.
3936
3937 * termhooks.h (FRAME_WINDOW_P): Remove duplicated definitions.
3938
3939 * dispextern.h (FACE_SUITABLE_FOR_ASCII_CHAR_P): Add missing
3940 definition for no-X builds.
3941
3942 2011-04-16 Paul Eggert <eggert@cs.ucla.edu>
3943
3944 Static checks with GCC 4.6.0 and non-default toolkits.
3945
3946 * s/sol2-6.h, s/unixware.h (PTY_TTY_NAME_SPRINTF): Protoize decl.
3947
3948 * process.c (keyboard_bit_set): Define only if SIGIO.
3949 (send_process_trap): Mark it with NO_RETURN if it doesn't return.
3950 (send_process): Repair possible setjmp clobbering.
3951
3952 * s/usg5-4-common.h (SETUP_SLAVE_PTY): Don't pass extra arg to 'fatal'.
3953
3954 * eval.c: Include <stdio.h>, for vsnprintf on non-GNU/Linux hosts.
3955
3956 * data.c (arith_error): Mark with NO_RETURN if it doesn't return.
3957
3958 * alloc.c (bytes_used_when_full, SPARE_MEMORY, BYTES_USED):
3959 Define only if needed.
3960
3961 * sysdep.c (_FILE_OFFSET_BITS): Make this hack even uglier
3962 by pacifying GCC about it. Maybe it's time to retire it?
3963 * xfaces.c (USG, __TIMEVAL__): Likewise.
3964
3965 * dispextern.h (struct redisplay_interface): Rename param
3966 to avoid shadowing.
3967 * termhooks.h (struct terminal): Likewise.
3968 * xterm.c (xembed_send_message): Likewise.
3969
3970 * insdel.c (make_gap_smaller): Define only if
3971 USE_MMAP_FOR_BUFFERS || REL_ALLOC || DOUG_LEA_MALLOC.
3972
3973 * keyboard.c (read_char): Make a var volatile so longjmp won't clobber
3974 it.
3975
3976 * emacs.c (MAX_HEAP_BSS_DIFF, my_edata): Move to where they're used,
3977 so that we aren't warned about unused symbols.
3978
3979 * xfns.c (Fx_file_dialog): Rename local to avoid shadowing.
3980
3981 * xdisp.c (x_produce_glyphs): Mark var as initialized (Bug#8512).
3982
3983 * xfns.c (x_real_positions): Mark locals as initialized.
3984
3985 * xmenu.c (xmenu_show): Don't use uninitialized vars.
3986
3987 * xterm.c: Fix problems found by static analysis with other toolkits.
3988 (toolkit_scroll_bar_interaction): Define and use only if USE_X_TOOLKIT.
3989 (x_dispatch_event): Declare static if USE_GTK, and
3990 define if USE_GTK || USE_X_TOOLKIT.
3991 (SET_SAVED_BUTTON_EVENT): Define only if USE_X_TOOLKIT || USE_GTK.
3992 * xterm.h (x_dispatch_event): Extern only if USE_X_TOOLKIT.
3993 * xterm.c, xterm.h (x_mouse_leave): Bring this function back, but only
3994 if defined HAVE_MENUS && !defined USE_X_TOOLKIT && !defined USE_GTK.
3995
3996 * xmenu.c (menu_help_callback): Pointer type fixes.
3997 Use const pointers when pointing at readonly data. Avoid pointer
3998 signedness clashes.
3999 (FALSE): Remove unused macro.
4000 (update_frame_menubar): Remove unused decl.
4001
4002 * xfns.c (Fx_hide_tip): Move locals to avoid shadowing.
4003
4004 * menu.c (push_submenu_start, push_submenu_end): Do not define unless
4005 USE_X_TOOLKIT || USE_GTK || HAVE_NS || defined HAVE_NTGUI.
4006 (single_menu_item): Rename local to avoid shadowing.
4007
4008 * keyboard.c (make_lispy_event): Remove unused local var.
4009
4010 * frame.c, frame.h (x_get_resource_string): Bring this back, but
4011 only if HAVE_X_WINDOWS && !USE_X_TOOLKIT.
4012
4013 * bitmaps: Change bitmaps from unsigned char back to the X11
4014 compatible char. Avoid the old compiler warnings about
4015 out-of-range initializers by using, for example, '\xab' rather
4016 than 0xab.
4017
4018 * xgselect.c (xgselect_initialize): Check vs interface
4019 even if ! (defined (USE_GTK) || defined (HAVE_GCONF)).
4020
4021 * xmenu.c (xmenu_show): Rename parm to avoid shadowing.
4022
4023 * xterm.c (x_create_toolkit_scroll_bar): Use const * for pointers
4024 to read-only memory.
4025
4026 * fns.c (vector): Remove; this old hack is no longer needed.
4027
4028 * xsmfns.c (create_client_leader_window): Rename shadowing arg.
4029 Remove unused var.
4030 (gdk_x11_set_sm_client_id) [!USE_GTK]: Don't define.
4031
4032 * xrdb.c (x_load_resources): Omit unused local.
4033
4034 * xfns.c (free_frame_menubar, atof): Remove duplicate decls.
4035 (x_window): Rename locals to avoid shadowing.
4036 (USG): Use the kludged USG macro, to pacify gcc.
4037
4038 * xterm.c (x_alloc_nearest_color_for_widget): Remove; unused.
4039 (x_term_init): Remove local to avoid shadowing.
4040
4041 * xfns.c, xterm.c (_XEditResCheckMessages): Protoize decl.
4042
4043 * xdisp.c, dispextern.h (set_vertical_scroll_bar): Now extern if
4044 USE_TOOLKIT_SCROLL_BARS && !USE_GTK, as xterm.c needs it then.
4045
4046 2011-04-16 Eli Zaretskii <eliz@gnu.org>
4047
4048 * gnutls.c (Fgnutls_boot): Don't pass Lisp_Object to `error'.
4049
4050 Fix regex.c, syntax.c and friends for buffers > 2GB.
4051 * syntax.h (struct gl_state_s): Declare character position members
4052 EMACS_INT.
4053
4054 * syntax.c (update_syntax_table): Declare 2nd argument EMACS_INT.
4055
4056 * textprop.c (verify_interval_modification, interval_of):
4057 Declare arguments EMACS_INT.
4058
4059 * intervals.c (adjust_intervals_for_insertion): Declare arguments
4060 EMACS_INT.
4061
4062 * intervals.h (CHECK_TOTAL_LENGTH): Cast to EMACS_INT, not `int'.
4063
4064 * indent.c (Fvertical_motion): Local variable it_start is now
4065 EMACS_INT.
4066
4067 * regex.c (re_match, re_match_2, re_match_2_internal)
4068 (bcmp_translate, regcomp, regexec, print_double_string)
4069 (group_in_compile_stack, re_search, re_search_2, regex_compile)
4070 (re_compile_pattern, re_exec): Declare arguments and local
4071 variables `size_t' and `ssize_t' and return values `regoff_t', as
4072 appropriate.
4073 (POP_FAILURE_REG_OR_COUNT) <pfreg>: Declare `long'.
4074 (CHECK_INFINITE_LOOP) <failure>: Declare `ssize_t'.
4075 <compile_stack_type>: `size' and `avail' are now `size_t'.
4076
4077 * regex.h <regoff_t>: Use ssize_t, not int.
4078 (re_search, re_search_2, re_match, re_match_2): Arguments that
4079 specify buffer/string position and length are now ssize_t and
4080 size_t. Return type is regoff_t.
4081
4082 2011-04-16 Ben Key <bkey76@gmail.com>
4083
4084 * nsfont.m: Fixed bugs in ns_get_family and
4085 ns_descriptor_to_entity that were caused by using free to
4086 deallocate memory blocks that were allocated by xmalloc (via
4087 xstrdup). This caused Emacs to crash when compiled with
4088 XMALLOC_OVERRUN_CHECK defined (when Emacs was configured with
4089 --enable-checking=xmallocoverrun). xfree is now used to
4090 deallocate these memory blocks.
4091
4092 2011-04-15 Paul Eggert <eggert@cs.ucla.edu>
4093
4094 * sysdep.c (emacs_read): Remove unnecessary check vs MAX_RW_COUNT.
4095
4096 emacs_write: Accept and return EMACS_INT for sizes.
4097 See http://lists.gnu.org/archive/html/emacs-devel/2011-04/msg00514.html
4098 et seq.
4099 * gnutls.c, gnutls.h (emacs_gnutls_read, emacs_gnutls_write):
4100 Accept and return EMACS_INT.
4101 (emacs_gnutls_write): Return the number of bytes written on
4102 partial writes.
4103 * sysdep.c, lisp.h (emacs_read, emacs_write): Likewise.
4104 (emacs_read, emacs_write): Remove check for negative size, as the
4105 Emacs source code has been audited now.
4106 * sysdep.c (MAX_RW_COUNT): New macro, to work around kernel bugs.
4107 (emacs_read, emacs_write): Use it.
4108 * process.c (send_process): Adjust to the new signatures of
4109 emacs_write and emacs_gnutls_write. Do not attempt to store
4110 a byte offset into an 'int'; it might overflow.
4111 See http://lists.gnu.org/archive/html/emacs-devel/2011-04/msg00483.html
4112
4113 * sound.c: Don't assume sizes fit in 'int'.
4114 (struct sound_device.period_size, alsa_period_size):
4115 Return EMACS_INT, not int.
4116 (struct sound_device.write, vox_write, alsa_write):
4117 Accept EMACS_INT, not int.
4118 (wav_play, au_play): Use EMACS_INT to store sizes and to
4119 record read return values.
4120
4121 2011-04-15 Ben Key <bkey76@gmail.com>
4122
4123 * keyboard.c (Qundefined): Don't declare static since it is used
4124 in nsfns.m.
4125 * xfaces.c (Qbold, Qexpanded, Qitalic, Qcondensed): Don't declare
4126 static since they are used in nsfont.m.
4127
4128 2011-04-15 Stefan Monnier <monnier@iro.umontreal.ca>
4129
4130 * process.c (Qprocessp): Don't declare static.
4131 * lisp.h (Qprocessp): Declare again.
4132
4133 2011-04-15 Juanma Barranquero <lekktu@gmail.com>
4134
4135 * font.c (Qopentype): Don't make static (used from w32uniscribe.c).
4136
4137 2011-04-14 Paul Eggert <eggert@cs.ucla.edu>
4138
4139 Improve C-level modularity by making more things 'static'.
4140
4141 Don't publish debugger-only interfaces to other modules.
4142 * lisp.h (safe_debug_print, debug_output_compilation_hack):
4143 (verify_bytepos, count_markers): Move decls to the only modules
4144 that need them.
4145 * region-cache.h (pp_cache): Likewise.
4146 * window.h (check_all_windows): Likewise.
4147 * marker.c, print.c, region-cache.c, window.c: Decls moved here.
4148
4149 * sysdep.c (croak): Now static, if
4150 defined TIOCNOTTY || defined USG5 || defined CYGWIN.
4151 * syssignal.h (croak): Declare only if not static.
4152
4153 * alloc.c (refill_memory_reserve): Now static if
4154 !defined REL_ALLOC || defined SYSTEM_MALLOC.
4155 * lisp.h (refill_memory_reserve): Declare only if not static.
4156
4157 * xsettings.c, xsettings.h (xsettings_get_system_normal_font):
4158 Define only if USE_LUCID.
4159
4160 * xrdb.c (x_customization_string, x_rm_string): Now static.
4161
4162 * xmenu.c (x_menu_wait_for_event): Export only if USE_MOTIF.
4163 * xterm.h (x_menu_wait_for_event): Declare only if USE_MOTIF.
4164
4165 * xdisp.c (draw_row_with_mouse_face): Now static.
4166 * dispextern.h (draw_row_with_mouse_fave): Remove decl.
4167
4168 * window.h (check_all_windows): Mark externally visible.
4169
4170 * window.c (window_deletion_count): Now static.
4171
4172 * undo.c: Make symbols static if they're not exported.
4173 (last_undo_buffer, last_boundary_position, pending_boundary):
4174 Now static.
4175
4176 * textprop.c (interval_insert_behind_hooks): Now static.
4177 (interval_insert_in_front_hooks): Likewise.
4178
4179 * term.c: Make symbols static if they're not exported.
4180 (tty_turn_off_highlight, get_tty_terminal, max_frame_cols):
4181 (max_frame_lines, tty_set_terminal_modes):
4182 (tty_reset_terminal_modes, tty_turn_off_highlight):
4183 (get_tty_terminal): Now static.
4184 (term_mouse_moveto): Do not define if HAVE_WINDOW_SYSTEM.
4185 * termhooks.h (term_mouse_moveto): Do not declare if
4186 HAVE_WINDOW_SYSTEM.
4187 * dispextern.h (tty_set_terminal_modes, tty_reset_terminal_modes):
4188 (tty_turn_off_highlight, get_tty_terminal): Remove decls.
4189
4190 * sysdep.c: Make symbols static if they're not exported.
4191 (emacs_get_tty, emacs_set_tty, old_fcntl_flags, old_fcntl_owner):
4192 Now static.
4193 (sigprocmask_set, full_mask): Remove; unused.
4194 (wait_debugging): Mark as visible.
4195 * syssignal.h (SIGFULLMASK, full_mask): Remove decls.
4196 * systty.h (emacs_get_tty, emacs_set_tty): Remove decls.
4197
4198 * syntax.c (syntax_temp): Define only if !__GNUC__.
4199
4200 * sound.c (current_sound_device, current_sound): Now static.
4201
4202 * search.c (searchbufs, searchbuf_head): Now static.
4203
4204 * scroll.c (scroll_cost): Remove; unused.
4205 * dispextern.h (scroll_cost): Remove decl.
4206
4207 * region-cache.h (pp_cache): Mark as externally visible.
4208
4209 * process.c: Make symbols static if they're not exported.
4210 (process_tick, update_tick, create_process, chan_process):
4211 (Vprocess_alist, proc_buffered_char, datagram_access):
4212 (fd_callback_data, send_process_frame, process_sent_to): Now static.
4213 (deactivate_process): Mark defn as static, as well as decl.
4214 * lisp.h (create_process): Remove decl.
4215 * process.h (chan_process, Vprocess_alist): Remove decls.
4216
4217 * print.c: Make symbols static if they're not exported.
4218 (print_depth, new_backquote_output, being_printed, print_buffer):
4219 (print_buffer_size, print_buffer_pos, print_buffer_pos_byte):
4220 (print_interval, print_number_index, initial_stderr_stream):
4221 Now static.
4222 * lisp.h (Fprinc): Remove decl.
4223 (debug_output_compilation_hack): Mark as externally visible.
4224
4225 * sysdep.c (croak): Move decl from here to syssignal.h.
4226 * syssignal.h (croak): Put it here, so the API can be checked when
4227 'croak' is called from dissociate_if_controlling_tty.
4228
4229 * minibuf.c: Make symbols static if they're not exported.
4230 (minibuf_save_list, choose_minibuf_frame): Now static.
4231 * lisp.h (choose_minibuf_frame): Remove decl.
4232
4233 * lisp.h (verify_bytepos, count_markers): Mark as externally visible.
4234
4235 * lread.c: Make symbols static if they're not exported.
4236 (read_objects, initial_obarray, oblookup_last_bucket_number):
4237 Now static.
4238 (make_symbol): Remove; unused.
4239 * lisp.h (initial_obarray, make_symbol): Remove decls.
4240
4241 * keyboard.c: Make symbols static if they're not exported.
4242 (single_kboard, recent_keys_index, total_keys, recent_keys):
4243 (this_command_key_count_reset, raw_keybuf, raw_keybuf_count):
4244 (this_single_command_key_start, echoing, last_auto_save):
4245 (read_key_sequence_cmd, dribble, recursive_edit_unwind):
4246 (command_loop, echo_now, keyboard_init_hook, help_char_p):
4247 (quit_throw_to_read_char, command_loop_2, top_level_1, poll_timer):
4248 (Vlispy_mouse_stem, double_click_count):
4249 Now static.
4250 (force_auto_save_soon): Define only if SIGDANGER.
4251 (ignore_mouse_drag_p): Now static if
4252 !defined HAVE_WINDOW_SYSTEM || defined USE_GTK || defined HAVE_NS.
4253 (print_help): Remove; unused.
4254 (stop_character, last_timer_event): Mark as externally visible.
4255 * keyboard.h (ignore_mouse_drag_p): Declare only if
4256 defined HAVE_WINDOW_SYSTEM && !defined USE_GTK && !defined HAVE_NS.
4257 (echo_now, help_char_p, quit_throw_to_read_char): Remove decls.
4258 * lisp.h (echoing): Remove decl.
4259 (force_auto_save_soon): Declare only if SIGDANGER.
4260 * xdisp.c (redisplay_window): Simplify code, to make it more
4261 obvious that ignore_mouse_drag_p is not accessed if !defined
4262 USE_GTK && !defined HAVE_NS.
4263
4264 * intervals.c: Make symbols static if they're not exported.
4265 (merge_properties_sticky, merge_interval_right, delete_interval):
4266 Now static.
4267 * intervals.h (merge_interval_right, delete_interval): Remove decls.
4268
4269 * insdel.c: Make symbols static if they're not exported.
4270 However, leave prepare_to_modify_buffer alone. It's never
4271 called from outside this function, but that appears to be a bug.
4272 (combine_after_change_list, combine_after_change_buffer):
4273 (adjust_after_replace, signal_before_change): Now static.
4274 (adjust_after_replace_noundo): Remove; unused.
4275 * lisp.h (adjust_after_replace, adjust_after_replace_noundo):
4276 (signal_before_change): Remove decls.
4277
4278 * indent.c (val_compute_motion, val_vmotion): Now static.
4279
4280 * image.c: Make symbols static if they're not exported.
4281 * dispextern.h (x_create_bitmap_from_xpm_data): Do not declare
4282 if USE_GTK.
4283 * image.c (x_create_bitmap_from_xpm_data): Do not define if USE_GTK.
4284 (xpm_color_cache, ct_table, ct_colors_allocated): Now static.
4285
4286 * fringe.c (standard_bitmaps): Now static.
4287 (max_used_fringe_bitmap): Now static, unless HAVE_NS.
4288
4289 * frame.c: Make symbols static if they're not exported.
4290 (x_report_frame_params, make_terminal_frame): Now static.
4291 (get_frame_param): Now static, unless HAVE_NS.
4292 (x_fullscreen_adjust): Define if WINDOWSNT, not if HAVE_WINDOW_SYSTEM.
4293 (x_get_resource_string): Remove; not used.
4294 * frame.h (make_terminal_frame, x_report_frame_params):
4295 (x_get_resource_string); Remove decls.
4296 (x_fullscreen_adjust): Declare only if WINDOWSNT.
4297 * lisp.h (get_frame_param): Declare only if HAVE_NS.
4298
4299 * font.c, fontset.c: Make symbols static if they're not exported.
4300 * dispextern.h (FACE_SUITABLE_FOR_ASCII_CHAR_P): New macro.
4301 (FACE_SUITABLE_FOR_CHAR_P): Use it.
4302 * font.c (font_close_object): Now static.
4303 * font.h (font_close_object): Remove.
4304 * fontset.c (FONTSET_OBJLIST): Remove.
4305 (free_realized_fontset) #if-0 the body, which does nothing.
4306 (face_suitable_for_char_p): #if-0, as it's never called.
4307 * fontset.h (face_suitable_for_char_p): Remove decl.
4308 * xfaces.c (face_at_string_position):
4309 Use FACE_SUITABLE_FOR_ASCII_CHAR_P, not FACE_SUITABLE_FOR_CHAR_P,
4310 since 0 is always ASCII.
4311
4312 * fns.c (weak_hash_tables): Now static.
4313
4314 * fileio.c: Make symbols static if they're not exported.
4315 (auto_saving, auto_save_mode_bits, auto_save_error_occurred):
4316 (Vwrite_region_annotation_buffers): Now static.
4317
4318 * eval.c: Make symbols static if they're not exported.
4319 (backtrace_list, lisp_eval_depth, when_entered_debugger): Now static.
4320 * lisp.h (backtrace_list): Remove decl.
4321
4322 * emacs.c: Make symbols static if they're not exported.
4323 (malloc_state_ptr, malloc_using_checking, syms_of_emacs):
4324 (fatal_error_code, fatal_error_signal_hook, standard_args):
4325 Now static.
4326 (fatal_error_signal): Now static, unless FLOAT_CATCH_SIGKILL.
4327 (DEFINE_DUMMY_FUNCTION): Mark function as externally visible.
4328 (__CTOR_LIST__, __DTOR_LIST__): Now externally visible.
4329 * lisp.h (fatal_error_signal_hook): Remove decl.
4330 (fatal_error_signal): Declare only if FLOAT_CATCH_SIGKILL.
4331
4332 * editfns.c: Move a (normally-unused) function to its only use.
4333 * editfns.c, lisp.h (get_operating_system_release): Remove.
4334 * process.c (init_process) [DARWIN_OS]: Do it inline, as it is not
4335 worth the hassle of breaking this out.
4336
4337 * xterm.c: Make symbols static if they're not exported.
4338 (x_raise_frame, x_lower_frame, x_wm_set_window_state):
4339 (x_wm_set_icon_pixmap, x_initialize, XTread_socket_fake_io_error):
4340 (x_destroy_window, x_delete_display):
4341 Now static.
4342 (x_dispatch_event): Now static if ! (USE_MOTIF || USE_X_TOOLKIT).
4343 (x_mouse_leave): Remove; unused.
4344 * xterm.h (x_display_info_for_name, x_raise_frame, x_lower_frame):
4345 (x_destroy_window, x_wm_set_window_state, x_wm_set_icon_pixmap):
4346 (x_delete_display, x_initialize, x_set_border_pixel, x_screen_planes):
4347 Remove decls.
4348 (x_mouse_leave): Declare only if WINDOWSNT.
4349 (x_dispatch_event): Declare only if USE_MOTIF or USE_X_TOOLKIT.
4350 (xic_create_fontsetname): Declare only if HAVE_X_WINDOWS &&
4351 USE_X_TOOLKIT.
4352
4353 * ftxfont.c: Make symbols static if they're not exported.
4354 (ftxfont_driver): Export only if !defined HAVE_XFT && def8ined
4355 HAVE_FREETYPE.
4356 * font.h (ftxfont_driver): Likewise.
4357
4358 * xfns.c: Make symbols static if they're not exported.
4359 (x_last_font_name, x_display_info_for_name):
4360 (x_set_foreground_color, x_set_background_color, x_set_mouse_color):
4361 (x_set_cursor_color, x_set_border_pixel, x_set_border_color):
4362 (x_set_cursor_type, x_set_icon_type, x_set_icon_name):
4363 (x_set_scroll_bar_foreground, x_set_scroll_bar_background):
4364 (x_explicitly_set_name, x_set_title, xic_defaut_fontset, tip_timer):
4365 (last_show_tip_args): Now static.
4366 (xic_defaut_fontset, xic_create_fontsetname): Define only if
4367 defined HAVE_X_WINDOWS && defined USE_X_TOOLKIT
4368 (x_screen_planes): Remove; unused.
4369 * dispextern.h (x_screen_planes): Remove decl.
4370
4371 * dispnew.c: Make symbols static if they're not exported.
4372 * dispextern.h (redraw_garbaged_frames, scrolling):
4373 (increment_row_positions): Remove.
4374 * dispnew.c (new_glyph_matrix, increment_row_positions, scrolling):
4375 (delayed_size_change, glyph_matrix_count, glyph_pool_count):
4376 Now static.
4377 (redraw_garbaged_frames): Remove; unused.
4378
4379 * xfaces.c: Make symbols static if they're not exported.
4380 * dispextern.h (ascii_face_of_lisp_face, free_realized_face):
4381 Remove decls.
4382 * xterm.h (defined_color): Remove decls.
4383 (x_free_dpy_colors): Declare only if USE_X_TOOLKIT.
4384 * xfaces.c (tty_suppress_bold_inverse_default_colors_p):
4385 (menu_face_changed_default, defined_color, free_realized_face):
4386 (x_free_dpy_colors): Define only if USE_X_TOOLKIT.
4387 (ascii_face_of_lisp_face): Remove; unused.
4388
4389 * xdisp.c: Make symbols static if they're not exported.
4390 * dispextern.h (scratch_glyph_row, window_box_edges):
4391 (glyph_to_pixel_coords, set_cursor_from_row):
4392 (get_next_display_element, set_iterator_to_next):
4393 (highlight_trailing_whitespace, frame_to_window_pixel_xy):
4394 (show_mouse_face): Remove decls
4395 * frame.h (message_buf_print): Likewise.
4396 * lisp.h (pop_message, set_message, check_point_in_composition):
4397 Likewise.
4398 * xterm.h (set_vertical_scroll_bar): Likewise.
4399 * xdisp.c (list_of_error, Vmessage_stack, line_number_displayed):
4400 (message_buf_print, scratch_glyph_row, displayed_buffer):
4401 (set_iterator_to_next, pop_message, set_message, set_cursor_from_row):
4402 (get_next_display_element, show_mouse_face, window_box_edges):
4403 (frame_to_window_pixel_xy, check_point_in_composition):
4404 (set_vertical_scroll_bar, highlight_trailing_whitespace): Now static.
4405 (glyph_to_pixel_coords): Remove; unused.
4406
4407 * dired.c (file_name_completion): Now static.
4408
4409 * dbusbind.c (xd_in_read_queued_messages): Now static.
4410
4411 * lisp.h (circular_list_error, FOREACH): Remove; unused.
4412 * data.c (circular_list_error): Remove.
4413
4414 * commands.h (last_point_position, last_point_position_buffer):
4415 (last_point_position_window): Remove decls.
4416 * keyboard.c: Make these variables static.
4417
4418 * coding.h (coding, code_convert_region, encode_coding_gap):
4419 Remove decls.
4420 * coding.c (Vsjis_coding_system, Vbig5_coding_system):
4421 (iso_code_class, detect_coding, code_convert_region): Now static.
4422 (encode_coding_gap): Remove; unused.
4423
4424 * chartab.c (chartab_chars, chartab_bits): Now static.
4425
4426 * charset.h (charset_iso_8859_1): Remove decl.
4427 * charset.c (charset_iso_8859_1, charset_emacs, map_charset_for_dump):
4428 Now static.
4429
4430 * ccl.h (check_ccl_update, Vccl_program_table): Remove decls.
4431 * ccl.c (Vccl_program_table): Now static.
4432 (check_ccl_update): Remove; unused.
4433
4434 * category.c (SET_CATEGORY_SET, set_category_set): Move here.
4435 * category.h: ... from here.
4436 * category.c (check_category_table, set_category_set): Now static.
4437
4438 * casetab.c (Vascii_upcase_table, Vascii_eqv_table): Now static.
4439 * lisp.h: Remove these decls.
4440
4441 * buffer.c (buffer_count): Remove unused var.
4442
4443 * bidi.c (bidi_dump_cached_states): Mark as externally visible,
4444 so that it's not optimized away.
4445 (bidi_ignore_explicit_marks_for_paragraph_level): Likewise.
4446 * dispextern.h (bidi_dump_cached_states): Remove, since it's
4447 exported only to the debugger.
4448
4449 * atimer.c (alarm_signal_handler, run_all_atimers): Now static.
4450 * atimer.h (run_all_atimers): Remove; not exported.
4451
4452 font.c: Make copy_font_spec and merge_font_spec ordinary C functions.
4453 * font.c (copy_font_spec): Rename from Fcopy_font_spec, since it
4454 was inaccessible from Lisp.
4455 (merge_font_spec): Likewise, renaming from Fmerge_font_spec.
4456 * font.c, font.h, fontset.c, xfaces.c, xfont.c: Change all uses.
4457
4458 alloc.c: Import and export fewer symbols, and remove unused items.
4459 * lisp.h (suppress_checking, die): Declare only if ENABLE_CHECKING
4460 is defined.
4461 (suppress_checking): Add EXTERNALLY_VISIBLE attribute, so that
4462 it's not optimized away by whole-program optimization.
4463 (message_enable_multibyte, free_misc): Remove.
4464 (catchlist, handlerlist, mark_backtrace):
4465 Declare only if BYTE_MARK_STACK.
4466 (mark_byte_stack): Likewise, fixing a ifdef-vs-if typo.
4467 * alloc.c (pure): Export only if VIRT_ADDR_VARIES is defined.
4468 (message_enable_multibyte): Remove decl.
4469 (free_misc, interval_free_list, float_block, float_block_index):
4470 (n_float_blocks, float_free_list, cons_block, cons_block_index):
4471 (cons_free_list, last_marked_index):
4472 Now static.
4473 (suppress_checking, die): Define only if ENABLE_CHECKING is defined.
4474 * eval.c (catchlist, handlerlist): Export only if BYTE_MARK_STACK.
4475 (mark_backtrace): Define only if BYTE_MARK_STACK.
4476 * xdisp.c (message_enable_multibyte): Now static.
4477
4478 Declare Lisp_Object Q* variables to be 'static' if not exported.
4479 This makes it easier for human readers (and static analyzers)
4480 to see whether these variables are used from other modules.
4481 * alloc.c, buffer.c, bytecode.c, callint.c, casetab.c, category.c:
4482 * ccl.c, character.c, charset.c, cmds.c, coding.c, composite.c:
4483 * data.c, dbusbind.c, dired.c, editfns.c, eval.c, fileio.c, fns.c:
4484 * font.c, frame.c, fringe.c, ftfont.c, image.c, keyboard.c, keymap.c:
4485 * lread.c, macros.c, minibuf.c, print.c, process.c, search.c:
4486 * sound.c, syntax.c, textprop.c, window.c, xdisp.c, xfaces.c, xfns.c:
4487 * xmenu.c, xselect.c:
4488 Declare Q* vars static if they are not used in other modules.
4489 * ccl.h, character.h, charset.h, coding.h, composite.h, font.h:
4490 * frame.h, intervals.h, keyboard.h, lisp.h, process.h, syntax.h:
4491 Remove decls of unexported vars.
4492 * keyboard.h (EVENT_HEAD_UNMODIFIED): Remove now-unused macro.
4493
4494 * lisp.h (DEFINE_FUNC): Make sname 'static'.
4495
4496 Make Emacs functions such as Fatom 'static' by default.
4497 This makes it easier for human readers (and static analyzers)
4498 to see whether these functions can be called from other modules.
4499 DEFUN now defines a static function. To make the function external
4500 so that it can be used in other C modules, use the new macro DEFUE.
4501 * lisp.h (Funibyte_char_to_multibyte, Fsyntax_table_p):
4502 (Finit_image_library):
4503 (Feval_region, Fbacktrace, Ffetch_bytecode, Fswitch_to_buffer):
4504 (Ffile_executable_p, Fmake_symbolic_link, Fcommand_execute):
4505 (Fget_process, Fdocumentation_property, Fbyte_code, Ffile_attributes):
4506 Remove decls, since these functions are now static.
4507 (Funintern, Fget_internal_run_time): New decls, since these functions
4508 were already external.
4509
4510 * alloc.c, buffer.c, callint.c, callproc.c, casefiddle.c, casetab.c:
4511 * ccl.c, character.c, chartab.c, cmds.c, coding.c, data.c, dispnew.c:
4512 * doc.c, editfns.c, emacs.c, eval.c, fileio.c, filelock.c, floatfns.c:
4513 * fns.c, font.c, fontset.c, frame.c, image.c, indent.c:
4514 * keyboard.c, keymap.c, lread.c:
4515 * macros.c, marker.c, menu.c, minibuf.c, print.c, process.c, search.c:
4516 * syntax.c, term.c, terminal.c, textprop.c, undo.c:
4517 * window.c, xdisp.c, xfaces.c, xfns.c, xmenu.c, xsettings.c:
4518 Mark functions with DEFUE instead of DEFUN,
4519 if they are used in other modules.
4520 * buffer.c (Fset_buffer_major_mode, Fdelete_overlay): New forward
4521 decls for now-static functions.
4522 * buffer.h (Fdelete_overlay): Remove decl.
4523 * callproc.c (Fgetenv_internal): Mark as internal.
4524 * composite.c (Fremove_list_of_text_properties): Remove decl.
4525 (Fcomposition_get_gstring): New forward static decl.
4526 * composite.h (Fcomposite_get_gstring): Remove decl.
4527 * dired.c (Ffile_attributes): New forward static decl.
4528 * doc.c (Fdocumntation_property): New forward static decl.
4529 * eval.c (Ffetch_bytecode): New forward static decl.
4530 (Funintern): Remove extern decl; now in .h file where it belongs.
4531 * fileio.c (Fmake_symbolic_link): New forward static decl.
4532 * image.c (Finit_image_library): New forward static decl.
4533 * insdel.c (Fcombine_after_change_execute): Make forward decl static.
4534 * intervals.h (Fprevious_property_change):
4535 (Fremove_list_of_text_properties): Remove decls.
4536 * keyboard.c (Fthis_command_keys): Remove decl.
4537 (Fcommand_execute): New forward static decl.
4538 * keymap.c (Flookup_key): New forward static decl.
4539 (Fcopy_keymap): Now static.
4540 * keymap.h (Flookup_key): Remove decl.
4541 * process.c (Fget_process): New forward static decl.
4542 (Fprocess_datagram_address): Mark as internal.
4543 * syntax.c (Fsyntax_table_p): New forward static decl.
4544 (skip_chars): Remove duplicate decl.
4545 * textprop.c (Fprevious_property_change): New forward static decl.
4546 * window.c (Fset_window_fringes, Fset_window_scroll_bars):
4547 Now internal.
4548 (Fset_window_margins, Fset_window_vscroll): New forward static decls.
4549 * window.h (Fset_window_vscroll, Fset_window_margins): Remove decls.
4550
4551 * editfns.c (Fformat): Remove unreachable code.
4552
4553 2011-04-14 Andreas Schwab <schwab@linux-m68k.org>
4554
4555 * fileio.c (Finsert_file_contents): Fix typo in 2005-05-13
4556 change. (Bug#8496)
4557
4558 2011-04-13 Eli Zaretskii <eliz@gnu.org>
4559
4560 * xdisp.c (handle_invisible_prop): Don't call bidi_paragraph_init
4561 when at ZV. (Bug#8487)
4562
4563 2011-04-12 Andreas Schwab <schwab@linux-m68k.org>
4564
4565 * charset.c (Fclear_charset_maps): Use xfree instead of free.
4566 (Bug#8437)
4567 * keyboard.c (parse_tool_bar_item): Likewise.
4568 * sound.c (sound_cleanup, alsa_close): Likewise.
4569 * termcap.c (tgetent): Likewise.
4570 * xfns.c (x_default_font_parameter): Likewise.
4571 * xsettings.c (read_and_apply_settings): Likewise.
4572
4573 * alloc.c (overrun_check_malloc, overrun_check_realloc)
4574 (overrun_check_free): Protoize.
4575
4576 2011-04-12 Paul Eggert <eggert@cs.ucla.edu>
4577
4578 * sysdep.c (emacs_read, emacs_write): Check for negative sizes
4579 since callers should never pass a negative size.
4580 Change the signature to match that of plain 'read' and 'write'; see
4581 <http://lists.gnu.org/archive/html/emacs-devel/2011-04/msg00397.html>.
4582 * lisp.h: Update prototypes of emacs_write and emacs_read.
4583
4584 2011-04-11 Eli Zaretskii <eliz@gnu.org>
4585
4586 * xdisp.c (redisplay_window): Don't try to determine the character
4587 position of the scroll margin if the window start point w->startp
4588 is outside the buffer's accessible region. (Bug#8468)
4589
4590 2011-04-10 Eli Zaretskii <eliz@gnu.org>
4591
4592 Fix write-region and its subroutines for buffers > 2GB.
4593 * fileio.c (a_write, e_write): Modify declaration of arguments and
4594 local variables to support buffers larger than 2GB.
4595 (Fcopy_file): Use EMACS_INT for return value of emacs_read.
4596
4597 * sysdep.c (emacs_write, emacs_read): Use ssize_t for last
4598 argument, local variables, and return value.
4599
4600 * lisp.h: Update prototypes of emacs_write and emacs_read.
4601
4602 * sound.c (vox_write): Use ssize_t for return value of emacs_write.
4603
4604 2011-04-10 Paul Eggert <eggert@cs.ucla.edu>
4605
4606 * xdisp.c (vmessage): Use memchr, not strnlen, which some hosts lack.
4607
4608 Fix more problems found by GCC 4.6.0's static checks.
4609
4610 * xdisp.c (vmessage): Use a better test for character truncation.
4611
4612 * charset.c (load_charset_map): <, not <=, for optimization,
4613 and to avoid potential problems with integer overflow.
4614 * chartab.c (sub_char_table_set_range, char_table_set_range): Likewise.
4615 * casetab.c (set_identity, shuffle): Likewise.
4616 * editfns.c (Fformat): Likewise.
4617 * syntax.c (skip_chars): Likewise.
4618
4619 * xmenu.c (set_frame_menubar): Allocate smaller local vectors.
4620 This also lets GCC 4.6.0 generate slightly better loop code.
4621
4622 * callint.c (Fcall_interactively): <, not <=, for optimization.
4623 (Fcall_interactively): Count the number of arguments produced,
4624 not the number of arguments given. This is simpler and lets GCC
4625 4.6.0 generate slightly better code.
4626
4627 * ftfont.c: Distingish more carefully between FcChar8 and char.
4628 The previous code passed unsigned char * to a functions like
4629 strlen and xstrcasecmp that expect char *, which does not
4630 conform to the C standard.
4631 (get_adstyle_property, ftfont_pattern_entity): Use FcChar8 for
4632 arguments to FcPatternGetString, and explicitly cast FcChar8 * to
4633 char * when the C standard requires it.
4634
4635 * keyboard.c (read_char): Remove unused var.
4636
4637 * eval.c: Port to Windows vsnprintf (Bug#8435).
4638 Include <limits.h>.
4639 (SIZE_MAX): Define if the headers do not.
4640 (verror): Do not give up if vsnprintf returns a negative count.
4641 Instead, grow the buffer. This ports to Windows vsnprintf, which
4642 does not conform to C99. Problem reported by Eli Zaretskii.
4643 Also, simplify the allocation scheme, by avoiding the need for
4644 calling realloc, and removing the ALLOCATED variable.
4645
4646 * eval.c (verror): Initial buffer size is 4000 (not 200) bytes.
4647
4648 Remove invocations of doprnt, as Emacs now uses vsnprintf.
4649 But keep the doprint source code for now, as we might revamp it
4650 and use it again (Bug#8435).
4651 * lisp.h (doprnt): Remove.
4652 * Makefile.in (base_obj): Remove doprnt.o.
4653 * deps.mk (doprnt.o): Remove.
4654
4655 error: Print 32- and 64-bit integers portably (Bug#8435).
4656 Without this change, on typical 64-bit hosts error ("...%d...", N)
4657 was used to print both 32- and 64-bit integers N, which relied on
4658 undefined behavior.
4659 * lisp.h, src/m/amdx86-64.h, src/m/ia64.h, src/m/ibms390x.h (pEd):
4660 New macro.
4661 * lisp.h (error, verror): Mark as printf-like functions.
4662 * eval.c (verror): Use vsnprintf, not doprnt, to do the real work.
4663 Report overflow in size calculations when allocating printf buffer.
4664 Do not truncate output string at its first null byte.
4665 * xdisp.c (vmessage): Use vsnprintf, not doprnt, to do the real work.
4666 Truncate the output at a character boundary, since vsnprintf does not
4667 do that.
4668 * charset.c (check_iso_charset_parameter): Convert internal
4669 character to string before calling 'error', since %c now has the
4670 printf meaning.
4671 * coding.c (Fdecode_sjis_char, Fdecode_big5_char): Avoid int
4672 overflow when computing char to be passed to 'error'. Do not
4673 pass Lisp_Object to 'error'; pass the integer instead.
4674 * nsfns.m (Fns_do_applescript): Use int, not long, since it's
4675 formatted with plain %d.
4676
4677 * eval.c (internal_lisp_condition_case): Don't pass spurious arg.
4678
4679 * keyboard.c (access_keymap_keyremap): Print func name, not garbage.
4680
4681 * coding.c (Fdecode_sjis_char): Don't assume CODE fits in int.
4682
4683 * xterm.c (x_catch_errors): Remove duplicate declaration.
4684
4685 * term.c (maybe_fatal): Mark its 3rd arg as a printf format, too.
4686
4687 * xdisp.c, lisp.h (message_nolog): Remove; unused.
4688
4689 2011-04-10 Jim Meyering <meyering@redhat.com>
4690
4691 use ssize_t and size_t for read- and write-like emacs_gnutls_* functions
4692 * gnutls.c (emacs_gnutls_read): Adjust signature to be more read-like:
4693 return ssize_t not "int", and use size_t as the buffer length.
4694 (emacs_gnutls_write): Likewise, and make the buffer pointer "const".
4695 * gnutls.h: Update declarations.
4696 * process.c (read_process_output): Use ssize_t, to match.
4697 (send_process): Likewise.
4698
4699 2011-04-09 Chong Yidong <cyd@stupidchicken.com>
4700
4701 * image.c (Fimagemagick_types): Doc fix, and comment cleanup.
4702
4703 2011-04-09 Chong Yidong <cyd@stupidchicken.com>
4704
4705 * ftfont.c (get_adstyle_property, ftfont_pattern_entity):
4706 Use unsigned char, to match FcChar8 type definition.
4707
4708 * xterm.c (handle_one_xevent):
4709 * xmenu.c (create_and_show_popup_menu):
4710 * xselect.c (x_decline_selection_request)
4711 (x_reply_selection_request): Avoid type-punned deref of X events.
4712
4713 2011-04-09 Eli Zaretskii <eliz@gnu.org>
4714
4715 Fix some uses of `int' instead of EMACS_INT.
4716 * search.c (string_match_1, fast_string_match)
4717 (fast_c_string_match_ignore_case, fast_string_match_ignore_case)
4718 (scan_buffer, find_next_newline_no_quit)
4719 (find_before_next_newline, search_command, Freplace_match)
4720 (Fmatch_data): Make some `int' variables be EMACS_INT.
4721
4722 * xdisp.c (display_count_lines): 3rd argument and return value now
4723 EMACS_INT. All callers changed.
4724 (pint2hrstr): Last argument is now EMACS_INT.
4725
4726 * coding.c (detect_coding_utf_8, detect_coding_emacs_mule)
4727 (detect_coding_iso_2022, detect_coding_sjis, detect_coding_big5)
4728 (detect_coding_ccl, detect_coding_charset, decode_coding_utf_8)
4729 (decode_coding_utf_16, decode_coding_emacs_mule)
4730 (decode_coding_iso_2022, decode_coding_sjis, decode_coding_big5)
4731 (decode_coding_ccl, decode_coding_charset)
4732 <consumed_chars, consumed_chars_base>: Declare EMACS_INT.
4733 (decode_coding_iso_2022, decode_coding_emacs_mule)
4734 (decode_coding_sjis, decode_coding_big5, decode_coding_charset)
4735 <char_offset, last_offset>: Declare EMACS_INT.
4736 (encode_coding_utf_8, encode_coding_utf_16)
4737 (encode_coding_emacs_mule, encode_invocation_designation)
4738 (encode_designation_at_bol, encode_coding_iso_2022)
4739 (encode_coding_sjis, encode_coding_big5, encode_coding_ccl)
4740 (encode_coding_raw_text, encode_coding_charset) <produced_chars>:
4741 Declare EMACS_INT.
4742 (ASSURE_DESTINATION): Declare more_bytes EMACS_INT.
4743 (encode_invocation_designation): Last argument P_NCHARS is now
4744 EMACS_INT.
4745 (decode_eol): Declare pos_byte, pos, and pos_end EMACS_INT.
4746 (produce_chars): from_nchars and to_nchars are now EMACS_INT.
4747
4748 * coding.h (struct coding_system) <head_ascii>: Declare EMACS_INT.
4749 All users changed.
4750
4751 * ccl.c (Fccl_execute_on_string): Declare some variables
4752 EMACS_INT.
4753
4754 2011-04-08 Samuel Thibault <sthibault@debian.org> (tiny change)
4755
4756 * term.c (init_tty): Fix incorrect ifdef placement (Bug#8450).
4757
4758 2011-03-19 Christoph Scholtes <cschol2112@googlemail.com>
4759
4760 * process.c (Fformat_network_address): Doc fix.
4761
4762 2011-04-08 T.V. Raman <tv.raman.tv@gmail.com> (tiny change)
4763
4764 * xml.c (parse_region): Avoid creating spurious whiespace nodes.
4765
4766 2011-04-08 Chong Yidong <cyd@stupidchicken.com>
4767
4768 * keyboard.c (read_char): Call Lisp function help-form-show,
4769 instead of using internal_with_output_to_temp_buffer.
4770 (Qhelp_form_show): New var.
4771 (syms_of_keyboard): Use DEFSYM macro.
4772
4773 * print.c (internal_with_output_to_temp_buffer): Function deleted.
4774
4775 * lisp.h (internal_with_output_to_temp_buffer): Remove prototype.
4776
4777 2011-04-06 Chong Yidong <cyd@stupidchicken.com>
4778
4779 * process.c (Flist_processes): Remove to Lisp.
4780 (list_processes_1): Delete.
4781
4782 2011-04-06 Eli Zaretskii <eliz@gnu.org>
4783
4784 * msdos.c (careadlinkat, careadlinkatcwd): MS-DOS replacements.
4785
4786 * w32.c (careadlinkat, careadlinkatcwd): New always-fail stubs.
4787
4788 2011-04-06 Paul Eggert <eggert@cs.ucla.edu>
4789
4790 Fix more problems found by GCC 4.6.0's static checks.
4791
4792 * xmenu.c (Fx_popup_dialog): Don't assume string is free of formats.
4793
4794 * menu.c (Fx_popup_menu): Don't assume error_name lacks printf formats.
4795
4796 * lisp.h (message, message_nolog, fatal): Mark as printf-like.
4797
4798 * xdisp.c (vmessage): Mark as a printf-like function.
4799
4800 * term.c (vfatal, maybe_fatal): Mark as printf-like functions.
4801
4802 * sound.c (sound_warning): Don't crash if arg contains a printf format.
4803
4804 * image.c (tiff_error_handler, tiff_warning_handler): Mark as
4805 printf-like functions.
4806 (tiff_load): Add casts to remove these marks before passing them
4807 to system-supplied API.
4808
4809 * eval.c (Fsignal): Remove excess argument to 'fatal'.
4810
4811 * coding.c (EMIT_ONE_BYTE, EMIT_TWO_BYTES): Use unsigned, not int.
4812 This avoids several warnings with gcc -Wstrict-overflow.
4813 (DECODE_COMPOSITION_RULE): If the rule is invalid, goto invalid_code
4814 directly, rather than having caller test rule sign. This avoids
4815 some unnecessary tests.
4816 * composite.h (COMPOSITION_ENCODE_RULE_VALID): New macro.
4817 (COMPOSITION_ENCODE_RULE): Arguments now must be valid. This
4818 affects only one use, in DECODE_COMPOSITION_RULE, which is changed.
4819
4820 * xfont.c (xfont_text_extents): Remove var that was set but not used.
4821 (xfont_open): Avoid unnecessary tests.
4822
4823 * composite.c (composition_gstring_put_cache): Use unsigned integer.
4824
4825 * composite.h, composite.c (composition_gstring_put_cache):
4826 Use EMACS_INT, not int, for length.
4827
4828 * composite.h (COMPOSITION_DECODE_REFS): New macro,
4829 breaking out part of COMPOSITION_DECODE_RULE.
4830 (COMPOSITION_DECODE_RULE): Use it.
4831 * composite.c (get_composition_id): Remove unused local vars,
4832 by using the new macro.
4833
4834 * textprop.c (set_text_properties_1): Change while to do-while,
4835 since the condition is always true at first.
4836
4837 * intervals.c (graft_intervals_into_buffer): Mark var as used.
4838 (interval_deletion_adjustment): Return unsigned value.
4839 All uses changed.
4840
4841 * process.c (list_processes_1, create_pty, read_process_output):
4842 (exec_sentinel): Remove vars that were set but not used.
4843 (create_pty): Remove unnecessary "volatile"s.
4844 (Fnetwork_interface_info): Avoid possibility of int overflow.
4845 (read_process_output): Do adaptive read buffering even if carryover.
4846 (read_process_output): Simplify nbytes computation if buffered.
4847
4848 * bytecode.c (exec_byte_code): Rename local to avoid shadowing.
4849
4850 * syntax.c (scan_words): Remove var that was set but not used.
4851 (update_syntax_table): Use unsigned instead of int.
4852
4853 * lread.c (lisp_file_lexically_bound_p): Use ints rather than endptrs.
4854 (lisp_file_lexically_bound_p, read1): Use unsigned instead of int.
4855 (safe_to_load_p): Make the end-of-loop test the inverse of the in-loop.
4856
4857 * print.c (print_error_message): Avoid int overflow.
4858
4859 * font.c (font_list_entities): Redo for clarity,
4860 so that reader need not know FONT_DPI_INDEX + 1 == FONT_SPACING_INDEX.
4861
4862 * font.c (font_find_for_lface, Ffont_get_glyphs): Remove unused vars.
4863 (font_score): Avoid potential overflow in diff calculation.
4864
4865 * fns.c (substring_both): Remove var that is set but not used.
4866 (sxhash): Redo loop for clarity and to avoid wraparound warning.
4867
4868 * eval.c (funcall_lambda): Rename local to avoid shadowing.
4869
4870 * alloc.c (mark_object_loop_halt, mark_object): Use size_t, not int.
4871 Otherwise, GCC 4.6.0 optimizes the loop check away since the check
4872 can always succeed if overflow has undefined behavior.
4873
4874 * search.c (boyer_moore, wordify): Remove vars set but not used.
4875 (wordify): Omit three unnecessary tests.
4876
4877 * indent.c (MULTIBYTE_BYTES_WIDTH): Don't compute wide_column.
4878 All callers changed. This avoids the need for an unused var.
4879
4880 * casefiddle.c (casify_region): Remove var that is set but not used.
4881
4882 * dired.c (file_name_completion): Remove var that is set but not used.
4883
4884 * fileio.c (Finsert_file_contents): Make EOF condition clearer.
4885
4886 * fileio.c (Finsert_file_contents): Avoid signed integer overflow.
4887 (Finsert_file_contents): Remove unnecessary code checking fd.
4888
4889 * minibuf.c (read_minibuf_noninteractive): Use size_t for sizes.
4890 Check for integer overflow on size calculations.
4891
4892 * buffer.c (Fprevious_overlay_change): Remove var that is set
4893 but not used.
4894
4895 * keyboard.c (menu_bar_items, read_char_minibuf_menu_prompt):
4896 Remove vars that are set but not used.
4897 (timer_check_2): Don't assume timer-list and idle-timer-list are lists.
4898 (timer_check_2): Mark vars as initialized.
4899
4900 * gtkutil.c (xg_get_file_with_chooser): Mark var as initialized.
4901
4902 * image.c (lookup_image): Remove var that is set but not used.
4903 (xbm_load): Use parse_p, for gcc -Werror=unused-but-set-variable.
4904
4905 * fontset.c (Finternal_char_font, Ffontset_info): Remove vars
4906 that are set but not used.
4907
4908 * xfns.c (make_invisible_cursor): Don't return garbage
4909 if XCreateBitmapFromData fails (Bug#8410).
4910
4911 * xselect.c (x_get_local_selection, x_handle_property_notify):
4912 Remove vars that are set but not used.
4913
4914 * xfns.c (x_create_tip_frame): Remove var that is set but not used.
4915 (make_invisible_cursor): Initialize a possibly-uninitialized variable.
4916
4917 * xterm.c (x_scroll_bar_to_input_event) [!USE_GTK]:
4918 Remove var that is set but not used.
4919 (scroll_bar_windows_size): Now size_t, not int.
4920 (x_send_scroll_bar_event): Use size_t, not int, for sizes.
4921 Check for overflow.
4922
4923 * xfaces.c (realize_named_face): Remove vars that are set but not used.
4924 (map_tty_color) [!defined MSDOS]: Likewise.
4925
4926 * term.c (tty_write_glyphs): Use size_t; this avoids overflow warning.
4927
4928 * coding.c: Remove vars that are set but not used.
4929 (DECODE_COMPOSITION_RULE): Remove 2nd arg, which is unused.
4930 All callers changed.
4931 (decode_coding_utf_8, decode_coding_utf_16 decode_coding_emacs_mule):
4932 (decode_coding_iso_2022, encode_coding_sjis, encode_coding_big5):
4933 (decode_coding_charset): Remove vars that are set but not used.
4934
4935 * bytecode.c (Fbyte_code) [!defined BYTE_CODE_SAFE]: Remove var
4936 that is set but not used.
4937
4938 * print.c (print_object): Remove var that is set but not used.
4939
4940 Replace 2 copies of readlink code with 1 gnulib version (Bug#8401).
4941 The gnulib version avoids calling malloc in the usual case,
4942 and on 64-bit hosts doesn't have some arbitrary 32-bit limits.
4943 * fileio.c (Ffile_symlink_p): Use emacs_readlink.
4944 * filelock.c (current_lock_owner): Likewise.
4945 * lisp.h (READLINK_BUFSIZE, emacs_readlink): New function.
4946 * sysdep.c: Include allocator.h, careadlinkat.h.
4947 (emacs_no_realloc_allocator): New static constant.
4948 (emacs_readlink): New function.
4949 * deps.mk (sysdep.o): Depend on ../lib/allocator.h and on
4950 ../lib/careadlinkat.h.
4951
4952 2011-04-04 Stefan Monnier <monnier@iro.umontreal.ca>
4953
4954 * keyboard.c (safe_run_hook_funcall): Fix last change (don't stop at the
4955 first non-nil return value).
4956
4957 2011-04-03 Jan Djärv <jan.h.d@swipnet.se>
4958
4959 * nsterm.m (ns_update_auto_hide_menu_bar): Define MAC_OS_X_VERSION_10_6
4960 if not defined (Bug#8403).
4961
4962 2011-04-02 Juanma Barranquero <lekktu@gmail.com>
4963
4964 * xdisp.c (display_count_lines): Remove parameter `start',
4965 unused since 1998-01-01T02:27:27Z!rms@gnu.org. All callers changed.
4966 (get_char_face_and_encoding): Remove parameter `multibyte_p',
4967 unused since 2008-05-14T01:40:23Z!handa@m17n.org. All callers changed.
4968 (fill_stretch_glyph_string): Remove parameters `row' and `area',
4969 unused at least since Kim's GUI unification at 2003-03-16T20:45:46Z!storm@cua.dk
4970 and thereabouts. All callers changed.
4971 (get_per_char_metric): Remove parameter `f', unused since
4972 2008-05-14T01:40:23Z!handa@m17n.org. All callers changed.
4973
4974 2011-04-02 Jim Meyering <meyering@redhat.com>
4975
4976 do not dereference NULL upon failed strdup
4977 * nsfont.m (ns_descriptor_to_entity): Use xstrdup, not strdup.
4978 (ns_get_family): Likewise.
4979
4980 2011-04-02 Juanma Barranquero <lekktu@gmail.com>
4981
4982 * eval.c (unwind_to_catch) [DEBUG_GCPRO]: Remove redundant assignment.
4983
4984 2011-04-02 Jan Djärv <jan.h.d@swipnet.se>
4985
4986 * nsterm.m (ns_update_auto_hide_menu_bar): Only for OSX 10.6 or
4987 later (Bug#8403).
4988
4989 2011-04-01 Stefan Monnier <monnier@iro.umontreal.ca>
4990
4991 Add lexical binding.
4992
4993 * window.c (Ftemp_output_buffer_show): New fun.
4994 (Fsave_window_excursion):
4995 * print.c (Fwith_output_to_temp_buffer): Move to subr.el.
4996
4997 * lread.c (lisp_file_lexically_bound_p): New function.
4998 (Fload): Bind Qlexical_binding.
4999 (readevalloop): Remove `evalfun' arg.
5000 Bind Qinternal_interpreter_environment.
5001 (Feval_buffer): Bind Qlexical_binding.
5002 (defvar_int, defvar_bool, defvar_lisp_nopro, defvar_kboard):
5003 Mark as dynamic.
5004 (syms_of_lread): Declare `lexical-binding'.
5005
5006 * lisp.h (struct Lisp_Symbol): New field `declared_special'.
5007
5008 * keyboard.c (eval_dyn): New fun.
5009 (menu_item_eval_property): Use it.
5010
5011 * image.c (parse_image_spec): Use Ffunctionp.
5012
5013 * fns.c (concat, mapcar1): Accept byte-code-functions.
5014
5015 * eval.c (Fsetq): Handle lexical vars.
5016 (Fdefun, Fdefmacro, Ffunction): Make closures when needed.
5017 (Fdefconst, Fdefvaralias, Fdefvar): Mark as dynamic.
5018 (FletX, Flet): Obey lexical binding.
5019 (Fcommandp): Handle closures.
5020 (Feval): New `lexical' arg.
5021 (eval_sub): New function extracted from Feval. Use it almost
5022 everywhere where Feval was used. Look up vars in lexical env.
5023 Handle closures.
5024 (Ffunctionp): Move from subr.el.
5025 (Ffuncall): Handle closures.
5026 (apply_lambda): Remove `eval_flags'.
5027 (funcall_lambda): Handle closures and new byte-code-functions.
5028 (Fspecial_variable_p): New function.
5029 (syms_of_eval): Initialize the Vinternal_interpreter_environment var,
5030 but without exporting it to Lisp.
5031
5032 * doc.c (Fdocumentation, store_function_docstring):
5033 * data.c (Finteractive_form): Handle closures.
5034
5035 * callint.c (Fcall_interactively): Preserve lexical-binding mode for
5036 interactive spec.
5037
5038 * bytecode.c (Bstack_ref, Bstack_set, Bstack_set2, BdiscardN):
5039 New byte-codes.
5040 (exec_byte_code): New function extracted from Fbyte_code to handle new
5041 calling convention for byte-code-functions. Add new byte-codes.
5042
5043 * buffer.c (defvar_per_buffer): Set new `declared_special' field.
5044
5045 * alloc.c (Fmake_symbol): Init new `declared_special' field.
5046
5047 2011-03-31 Juanma Barranquero <lekktu@gmail.com>
5048
5049 * xdisp.c (redisplay_internal): Fix prototype.
5050
5051 2011-03-31 Eli Zaretskii <eliz@gnu.org>
5052
5053 * xdisp.c (SCROLL_LIMIT): New macro.
5054 (try_scrolling): Use it when setting scroll_limit.
5055 Limit scrolling to 100 screen lines.
5056 (redisplay_window): Even when falling back on "recentering",
5057 position point in the window according to scroll-conservatively,
5058 scroll-margin, and scroll-*-aggressively variables. (Bug#6671)
5059
5060 (try_scrolling): When point is above the window, allow searching
5061 as far as scroll_max, or one screenful, to compute vertical
5062 distance from PT to the scroll margin position. This prevents
5063 try_scrolling from unnecessarily failing when
5064 scroll-conservatively is set to a value slightly larger than the
5065 window height. Clean up the case of PT below the margin at bottom
5066 of window: scroll_max can no longer be INT_MAX. When aggressive
5067 scrolling is in use, don't let point enter the opposite scroll
5068 margin as result of the scroll.
5069 (syms_of_xdisp) <scroll-conservatively>: Document the
5070 threshold of 100 lines for never-recentering scrolling.
5071
5072 2011-03-31 Juanma Barranquero <lekktu@gmail.com>
5073
5074 * dispextern.h (move_it_by_lines):
5075 * xdisp.c (move_it_by_lines): Remove parameter `need_y_p', unused
5076 since 2000-12-29T14:24:09Z!gerd@gnu.org. All callers changed.
5077 (message_log_check_duplicate): Remove parameters `prev_bol' and
5078 `this_bol', unused since 1998-01-01T02:27:27Z!rms@gnu.org. All callers changed.
5079 (redisplay_internal): Remove parameter `preserve_echo_area',
5080 unused since 1999-07-21T21:43:52Z!gerd@gnu.org. All callers changed.
5081
5082 * indent.c (Fvertical_motion):
5083 * window.c (window_scroll_pixel_based, Frecenter):
5084 Don't pass `need_y_p' to `move_it_by_lines'.
5085
5086 2011-03-30 Stefan Monnier <monnier@iro.umontreal.ca>
5087
5088 * eval.c (struct backtrace): Don't cheat with negative numbers, but do
5089 steal a few bits to be more compact.
5090 (interactive_p, Fbacktrace, Fbacktrace_frame, mark_backtrace):
5091 Remove unneeded casts.
5092
5093 * bytecode.c (Fbyte_code): CAR and CDR can GC.
5094
5095 2011-03-30 Zachary Kanfer <zkanfer@gmail.com> (tiny change)
5096
5097 * keyboard.c (Fexecute_extended_command): Do log the "suggest key
5098 binding" message (bug#7967).
5099
5100 2011-03-30 Paul Eggert <eggert@cs.ucla.edu>
5101
5102 Fix more problems found by GCC 4.6.0's static checks.
5103
5104 * unexelf.c (unexec) [! (defined _SYSTYPE_SYSV || defined __sgi)]:
5105 Remove unused local var.
5106
5107 * editfns.c (Fmessage_box): Remove unused local var.
5108
5109 * xdisp.c (try_window_reusing_current_matrix, x_produce_glyphs):
5110 (note_mode_line_or_margin_highlight, note_mouse_highlight):
5111 Omit unused local vars.
5112 * window.c (shrink_windows): Omit unused local var.
5113 * menu.c (digest_single_submenu): Omit unused local var.
5114 * dispnew.c (update_window) [PERIODIC_PREEMPTION_CHECKING]:
5115 Omit unused local var.
5116
5117 * keyboard.c (parse_modifiers_uncached, parse_modifiers):
5118 Don't assume string length fits in int.
5119 (keyremap_step, read_key_sequence): Use size_t for sizes.
5120 (read_key_sequence): Don't check last_real_key_start redundantly.
5121
5122 * callproc.c (Fcall_process, Fcall_process_region): Use SAFE_ALLOCA
5123 instead of alloca (Bug#8344).
5124
5125 * eval.c (Fbacktrace): Don't assume nargs fits in int.
5126 (Fbacktrace_frame): Don't assume nframes fits in int.
5127
5128 * syntax.c (scan_sexps_forward): Avoid pointer wraparound.
5129
5130 * xterm.c (x_make_frame_visible, same_x_server): Redo to avoid overflow
5131 concerns.
5132
5133 * term.c (produce_glyphless_glyph): Remove unnecessary test.
5134
5135 * cm.c (calccost): Turn while-do into do-while, for clarity.
5136
5137 * keyboard.c (syms_of_keyboard): Use the same style as later
5138 in this function when indexing through an array. This also
5139 works around GCC bug 48267.
5140
5141 * image.c (tiff_load): Fix off-by-one image count (Bug#8336).
5142
5143 * xselect.c (x_check_property_data): Return correct size (Bug#8335).
5144
5145 * chartab.c (sub_char_table_ref_and_range): Redo for slight
5146 efficiency gain, and to bypass a gcc -Wstrict-overflow warning.
5147
5148 * keyboard.c, keyboard.h (num_input_events): Now size_t.
5149 This avoids undefined behavior on integer overflow, and is a bit
5150 more convenient anyway since it is compared to a size_t variable.
5151
5152 Variadic C functions now count arguments with size_t, not int.
5153 This avoids an unnecessary limitation on 64-bit machines, which
5154 caused (substring ...) to crash on large vectors (Bug#8344).
5155 * lisp.h (struct Lisp_Subr.function.aMANY): Now takes size_t, not int.
5156 (DEFUN_ARGS_MANY, internal_condition_case_n, safe_call): Likewise.
5157 All variadic functions and their callers changed accordingly.
5158 (struct gcpro.nvars): Now size_t, not int. All uses changed.
5159 * data.c (arith_driver, float_arith_driver): Likewise.
5160 * editfns.c (general_insert_function): Likewise.
5161 * eval.c (struct backtrace.nargs, interactive_p)
5162 (internal_condition_case_n, run_hook_with_args, apply_lambda)
5163 (funcall_lambda, mark_backtrace): Likewise.
5164 * fns.c (concat): Likewise.
5165 * frame.c (x_set_frame_parameters): Likewise.
5166 * fns.c (get_key_arg): Now accepts and returns size_t, and returns
5167 0 if not found, not -1. All callers changed.
5168
5169 * alloc.c (garbage_collect): Don't assume stack size fits in int.
5170 (stack_copy_size): Now size_t, not int.
5171 (stack_copy, stack_copy_size): Define only if MAX_SAVE_STACK > 0.
5172
5173 2011-03-28 Juanma Barranquero <lekktu@gmail.com>
5174
5175 * coding.c (encode_designation_at_bol): Remove parameter `charbuf_end',
5176 unused since 2002-03-01T01:17:24Z!handa@m17n.org and 2008-02-01T16:01:31Z!miles@gnu.org.
5177 All callers changed.
5178
5179 * lisp.h (multibyte_char_to_unibyte):
5180 * character.c (multibyte_char_to_unibyte): Remove parameter `rev_tbl',
5181 unused since 2002-03-01T01:16:34Z!handa@m17n.org and 2008-02-01T16:01:31Z!miles@gnu.org.
5182 * character.h (CHAR_TO_BYTE8):
5183 * cmds.c (internal_self_insert):
5184 * editfns.c (general_insert_function):
5185 * keymap.c (push_key_description):
5186 * search.c (Freplace_match):
5187 * xdisp.c (message_dolog, set_message_1): All callers changed.
5188
5189 2011-03-28 Stefan Monnier <monnier@iro.umontreal.ca>
5190
5191 * keyboard.c (safe_run_hook_funcall): New function.
5192 (safe_run_hooks_1, safe_run_hooks_error, safe_run_hooks): On error,
5193 don't set the hook to nil, but remove the offending function instead.
5194 (Qcommand_hook_internal): Remove, unused.
5195 (syms_of_keyboard): Don't initialize Qcommand_hook_internal nor define
5196 Vcommand_hook_internal.
5197
5198 * eval.c (enum run_hooks_condition): Remove.
5199 (funcall_nil, funcall_not): New functions.
5200 (run_hook_with_args): Call each function through a `funcall' argument.
5201 Remove `cond' argument, now redundant.
5202 (Frun_hooks, Frun_hook_with_args, Frun_hook_with_args_until_success)
5203 (Frun_hook_with_args_until_failure): Adjust accordingly.
5204 (run_hook_wrapped_funcall, Frun_hook_wrapped): New functions.
5205
5206 2011-03-28 Juanma Barranquero <lekktu@gmail.com>
5207
5208 * dispextern.h (string_buffer_position): Remove declaration.
5209
5210 * print.c (strout): Remove parameter `multibyte', unused since
5211 1999-08-21T19:30:21Z!gerd@gnu.org. All callers changed.
5212
5213 * search.c (boyer_moore): Remove parameters `len', `pos' and `lim',
5214 never used since function introduction in 1998-02-08T21:33:56Z!rms@gnu.org.
5215 All callers changed.
5216
5217 * w32.c (_wsa_errlist): Use braces for struct initializers.
5218
5219 * xdisp.c (string_buffer_position_lim): Remove parameter `w',
5220 never used since function introduction in 2001-03-09T18:41:50Z!gerd@gnu.org.
5221 All callers changed.
5222 (string_buffer_position): Likewise. Also, make static (it's never
5223 used outside xdisp.c).
5224 (cursor_row_p): Remove parameter `w', unused since
5225 2000-10-17T16:08:57Z!gerd@gnu.org. All callers changed.
5226 (decode_mode_spec): Remove parameter `precision', introduced during
5227 Gerd Moellmann's rewrite at 1999-07-21T21:43:52Z!gerd@gnu.org, but never used.
5228 All callers changed.
5229
5230 2011-03-27 Jan Djärv <jan.h.d@swipnet.se>
5231
5232 * nsterm.m (syms_of_nsterm): Use doc: for ns-auto-hide-menu-bar.
5233
5234 2011-03-27 Anders Lindgren <andlind@gmail.com>
5235
5236 * nsterm.m (ns_menu_bar_is_hidden): New variable.
5237 (ns_constrain_all_frames, ns_menu_bar_should_be_hidden)
5238 (ns_update_auto_hide_menu_bar): New functions.
5239 (ns_update_begin): Call ns_update_auto_hide_menu_bar.
5240 (applicationDidBecomeActive): Call ns_update_auto_hide_menu_bar and
5241 ns_constrain_all_frames.
5242 (constrainFrameRect): Return at once if ns_menu_bar_should_be_hidden.
5243 (syms_of_nsterm): DEFVAR ns-auto-hide-menu-bar, init to Qnil.
5244
5245 2011-03-27 Jan Djärv <jan.h.d@swipnet.se>
5246
5247 * nsmenu.m (runDialogAt): Remove argument to timer_check.
5248
5249 2011-03-27 Glenn Morris <rgm@gnu.org>
5250
5251 * syssignal.h: Replace RETSIGTYPE with void.
5252 * atimer.c, data.c, dispnew.c, emacs.c, floatfns.c, keyboard.c:
5253 * keyboard.h, lisp.h, process.c, sysdep.c, xterm.c:
5254 Replace SIGTYPE with void everywhere.
5255 * s/usg5-4-common.h (SIGTYPE): Remove definition.
5256 * s/template.h (SIGTYPE): Remove commented out definition.
5257
5258 2011-03-26 Eli Zaretskii <eliz@gnu.org>
5259
5260 * xdisp.c (redisplay_window): Don't check buffer's clip_changed
5261 flag as a prerequisite for invoking try_scrolling. (Bug#6671)
5262
5263 2011-03-26 Juanma Barranquero <lekktu@gmail.com>
5264
5265 * w32.c (read_unc_volume): Use parameter `henum', instead of
5266 global variable `wget_enum_handle'.
5267
5268 * keymap.c (describe_vector): Remove parameters `indices' and
5269 `char_table_depth', unused since 2002-03-01T01:43:26Z!handa@m17n.org.
5270 (describe_map, Fdescribe_vector): Adjust calls to `describe_vector'.
5271
5272 * keyboard.h (timer_check, show_help_echo): Remove unused parameters.
5273
5274 * keyboard.c (timer_check): Remove parameter `do_it_now',
5275 unused since 1996-04-12T06:01:29Z!rms@gnu.org.
5276 (show_help_echo): Remove parameter `ok_to_overwrite_keystroke_echo',
5277 unused since 2008-04-19T19:30:53Z!monnier@iro.umontreal.ca.
5278
5279 * keyboard.c (read_char):
5280 * w32menu.c (w32_menu_display_help):
5281 * xmenu.c (show_help_event, menu_help_callback):
5282 Adjust calls to `show_help_echo'.
5283
5284 * gtkutil.c (xg_maybe_add_timer):
5285 * keyboard.c (readable_events):
5286 * process.c (wait_reading_process_output):
5287 * xmenu.c (x_menu_wait_for_event): Adjust calls to `timer_check'.
5288
5289 * insdel.c (adjust_markers_gap_motion):
5290 Remove; no-op since 1998-01-02T21:29:48Z!rms@gnu.org.
5291 (gap_left, gap_right): Don't call it.
5292
5293 2011-03-25 Chong Yidong <cyd@stupidchicken.com>
5294
5295 * xdisp.c (handle_fontified_prop): Discard changes to clip_changed
5296 incurred during fontification.
5297
5298 2011-03-25 Juanma Barranquero <lekktu@gmail.com>
5299
5300 * buffer.c (defvar_per_buffer): Remove unused parameter `doc'.
5301 (DEFVAR_PER_BUFFER): Don't pass it.
5302
5303 * dispnew.c (row_equal_p, add_row_entry): Remove unused parameter `w'.
5304 (scrolling_window): Don't pass it.
5305
5306 2011-03-25 Juanma Barranquero <lekktu@gmail.com>
5307
5308 * dispextern.h (glyph_matric): Use #if GLYPH_DEBUG, not #ifdef.
5309
5310 * fileio.c (check_executable) [DOS_NT]: Remove unused variables `len'
5311 and `suffix'.
5312 (Fset_file_selinux_context) [HAVE_LIBSELINUX]: Move here declaration
5313 of variables specific to SELinux and computation of `encoded_absname'.
5314
5315 * image.c (XPutPixel): Remove unused variable `height'.
5316
5317 * keyboard.c (make_lispy_event): Remove unused variable `hpos'.
5318
5319 * unexw32.c (get_section_info): Remove unused variable `section'.
5320
5321 * w32.c (stat): Remove unused variables `drive_root' and `devtype'.
5322 (system_process_attributes): Remove unused variable `sess'.
5323 (sys_read): Remove unused variable `err'.
5324
5325 * w32fns.c (top): Wrap variables with #if GLYPH_DEBUG, not #ifdef.
5326 (w32_wnd_proc): Remove unused variable `isdead'.
5327 (unwind_create_frame): Use #if GLYPH_DEBUG, not #ifdef.
5328 (Fx_server_max_request_size): Remove unused variable `dpyinfo'.
5329 (x_create_tip_frame): Remove unused variable `tem'.
5330
5331 * w32inevt.c (w32_console_read_socket):
5332 Remove unused variable `no_events'.
5333
5334 * w32term.c (x_draw_composite_glyph_string_foreground):
5335 Remove unused variable `width'.
5336
5337 2011-03-24 Juanma Barranquero <lekktu@gmail.com>
5338
5339 * w32term.c (x_set_glyph_string_clipping):
5340 Don't pass uninitialized region to CombineRgn.
5341
5342 2011-03-23 Juanma Barranquero <lekktu@gmail.com>
5343
5344 * w32fns.c (x_set_menu_bar_lines): Remove unused variable `olines'.
5345 (w32_wnd_proc): Pass NULL to Windows API, not uninitialized buffer.
5346 (Fx_close_connection): Remove unused variable `i'.
5347
5348 * w32font.c (w32font_draw): Return number of glyphs.
5349 (w32font_open_internal): Remove unused variable `i'.
5350 (w32font_driver): Add missing initializer.
5351
5352 * w32menu.c (utf8to16): Remove unused variable `utf16'.
5353 (fill_in_menu): Remove unused variable `items_added'.
5354
5355 * w32term.c (last_mouse_press_frame): Remove static global variable.
5356 (w32_clip_to_row): Remove unused variable `f'.
5357 (x_delete_terminal): Remove unused variable `i'.
5358
5359 * w32uniscribe.c (uniscribe_shape): Remove unused variable `nclusters'.
5360 (NOTHING): Remove unused static global variable.
5361 (uniscribe_check_otf): Remove unused variable `table'.
5362 (uniscribe_font_driver): Add missing initializers.
5363
5364 2011-03-23 Julien Danjou <julien@danjou.info>
5365
5366 * term.c (Fsuspend_tty, Fresume_tty):
5367 * minibuf.c (read_minibuf, run_exit_minibuf_hook):
5368 * window.c (temp_output_buffer_show):
5369 * insdel.c (signal_before_change):
5370 * frame.c (Fhandle_switch_frame):
5371 * fileio.c (Fdo_auto_save):
5372 * emacs.c (Fkill_emacs):
5373 * editfns.c (save_excursion_restore):
5374 * cmds.c (internal_self_insert):
5375 * callint.c (Fcall_interactively):
5376 * buffer.c (Fkill_all_local_variables):
5377 * keyboard.c (Fcommand_execute, Fsuspend_emacs, safe_run_hooks_1):
5378 Use Frun_hooks.
5379 (command_loop_1): Use Frun_hooks. Call safe_run_hooks
5380 unconditionnaly since it does the check itself.
5381
5382 2011-03-23 Paul Eggert <eggert@cs.ucla.edu>
5383
5384 Fix more problems found by GCC 4.5.2's static checks.
5385
5386 * coding.c (encode_coding_raw_text): Avoid unnecessary test
5387 the first time through the loop, since we know p0 < p1 then.
5388 This also avoids a gcc -Wstrict-overflow warning.
5389
5390 * lisp.h (SAFE_ALLOCA, SAFE_ALLOCA_LISP): Avoid 'int' overflow
5391 leading to a memory leak, possible in functions like
5392 load_charset_map_from_file that can allocate an unbounded number
5393 of objects (Bug#8318).
5394
5395 * xmenu.c (set_frame_menubar): Use EMACS_UINT, not int, for indexes
5396 that could (at least in theory) be that large.
5397
5398 * xdisp.c (message_log_check_duplicate): Return unsigned long, not int.
5399 This is less likely to overflow, and avoids undefined behavior if
5400 overflow does occur. All callers changed. Use strtoul to scan
5401 for the unsigned long integer.
5402 (pint2hrstr): Simplify and tune code slightly.
5403 This also avoids a (bogus) GCC warning with gcc -Wstrict-overflow.
5404
5405 * scroll.c (do_scrolling): Work around GCC bug 48228.
5406 See <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48228>.
5407
5408 * frame.c (Fmodify_frame_parameters): Simplify loop counter.
5409 This also avoids a warning with gcc -Wstrict-overflow.
5410 (validate_x_resource_name): Simplify count usage.
5411 This also avoids a warning with gcc -Wstrict-overflow.
5412
5413 * fileio.c (Fcopy_file): Report error if fchown or fchmod
5414 fail (Bug#8306).
5415
5416 * emacs.c (Fdaemon_initialized): Do not ignore I/O errors (Bug#8303).
5417
5418 * process.c (Fmake_network_process): Use socklen_t, not int,
5419 where POSIX says socklen_t is required in portable programs.
5420 This fixes a porting bug on hosts like 64-bit HP-UX, where
5421 socklen_t is wider than int (Bug#8277).
5422 (Fmake_network_process, server_accept_connection):
5423 (wait_reading_process_output, read_process_output):
5424 Likewise.
5425
5426 * process.c: Rename or move locals to avoid shadowing.
5427 (list_processes_1, Fmake_network_process):
5428 (read_process_output_error_handler, exec_sentinel_error_handler):
5429 Rename or move locals.
5430 (Fmake_network_process): Define label "retry_connect" only if needed.
5431 (Fnetwork_interface_info): Fix pointer signedness.
5432 (process_send_signal): Add cast to avoid pointer signedness problem.
5433 (FIRST_PROC_DESC, IF_NON_BLOCKING_CONNECT): Remove unused macros.
5434 (create_process): Use 'volatile' to avoid vfork clobbering (Bug#8298).
5435
5436 Make tparam.h and terminfo.c consistent.
5437 * cm.c (tputs, tgoto, BC, UP): Remove extern decls.
5438 Include tparam.h instead, since it declares them.
5439 * cm.h (PC): Remove extern decl; tparam.h now does this.
5440 * deps.mk (cm.o, terminfo.o): Depend on tparam.h.
5441 * terminfo.c: Include tparam.h, to check interfaces.
5442 (tparm): Make 1st arg a const pointer in decl. Put it at top level.
5443 (tparam): Adjust signature to match interface in tparam.h;
5444 this removes some undefined behavior. Check that outstring and len
5445 are zero, which they always are with Emacs.
5446 * tparam.h (PC, BC, UP): New extern decls.
5447
5448 * xftfont.c (xftfont_shape): Now static, and defined only if needed.
5449 (xftfont_open): Rename locals to avoid shadowing.
5450
5451 * ftfont.c (ftfont_resolve_generic_family): Fix pointer signedness.
5452 (ftfont_otf_capability, ftfont_shape): Omit decls if not needed.
5453 (OTF_TAG_SYM): Omit macro if not needed.
5454 (ftfont_list): Remove unused local.
5455 (get_adstyle_property, ftfont_pattern_entity):
5456 (ftfont_lookup_cache, ftfont_open, ftfont_anchor_point):
5457 Rename locals to avoid shadowing.
5458
5459 * xfont.c (xfont_list_family): Mark var as initialized.
5460
5461 * xml.c (make_dom): Now static.
5462
5463 * composite.c (composition_compute_stop_pos): Rename local to
5464 avoid shadowing.
5465 (composition_reseat_it): Remove unused locals.
5466 (find_automatic_composition, composition_adjust_point): Likewise.
5467 (composition_update_it): Mark var as initialized.
5468 (find_automatic_composition): Mark vars as initialized,
5469 with a FIXME (Bug#8290).
5470
5471 character.h: Rename locals to avoid shadowing.
5472 * character.h (PREV_CHAR_BOUNDARY, FETCH_STRING_CHAR_ADVANCE):
5473 (FETCH_STRING_CHAR_AS_MULTIBYTE_ADVANCE, FETCH_CHAR_ADVANCE):
5474 (FETCH_CHAR_ADVANCE_NO_CHECK, INC_POS, DEC_POS, BUF_INC_POS):
5475 (BUF_DEC_POS): Be more systematic about renaming local temporaries
5476 to avoid shadowing.
5477
5478 * textprop.c (property_change_between_p): Remove; unused.
5479
5480 * intervals.c (interval_start_pos): Now static.
5481
5482 * intervals.h (CHECK_TOTAL_LENGTH): Avoid empty "else".
5483
5484 * atimer.c (start_atimer, append_atimer_lists, set_alarm):
5485 Rename locals to avoid shadowing.
5486
5487 * sound.c (wav_play, au_play, Fplay_sound_internal):
5488 Fix pointer signedness.
5489 (alsa_choose_format): Remove unused local var.
5490 (wav_play): Initialize a variable to 0, to prevent undefined
5491 behavior (Bug#8278).
5492
5493 * region-cache.c (insert_cache_boundary): Redo var to avoid shadowing.
5494
5495 * region-cache.h (pp_cache): New decl, for gcc -Wmissing-prototypes.
5496
5497 * callproc.c (Fcall_process): Use 'volatile' to avoid vfork
5498 clobbering (Bug#8298).
5499 * sysdep.c (sys_subshell): Likewise.
5500 Previously, the sys_subshell 'volatile' was incorrectly IF_LINTted out.
5501
5502 * lisp.h (child_setup): Now NO_RETURN unless DOS_NT.
5503 This should get cleaned up, so that child_setup has the
5504 same signature on all platforms.
5505
5506 * callproc.c (call_process_cleanup): Now static.
5507 (relocate_fd): Rename locals to avoid shadowing.
5508
5509 2011-03-22 Chong Yidong <cyd@stupidchicken.com>
5510
5511 * xterm.c (x_clear_frame): Remove XClearWindow call. This appears
5512 not to be necessary, and produces flickering.
5513
5514 2011-03-20 Glenn Morris <rgm@gnu.org>
5515
5516 * config.in: Remove file.
5517
5518 2011-03-20 Juanma Barranquero <lekktu@gmail.com>
5519
5520 * minibuf.c (Vcompleting_read_function): Don't declare, global variables
5521 are now in src/globals.h.
5522 (syms_of_minibuf): Remove spurious & from previous change.
5523
5524 2011-03-20 Leo <sdl.web@gmail.com>
5525
5526 * minibuf.c (completing-read-function): New variable.
5527 (completing-read-default): Rename from completing-read.
5528 (completing-read): Call completing-read-function.
5529
5530 2011-03-19 Juanma Barranquero <lekktu@gmail.com>
5531
5532 * xfaces.c (Fx_load_color_file):
5533 Read color file from absolute filename (bug#8250).
5534
5535 2011-03-19 Juanma Barranquero <lekktu@gmail.com>
5536
5537 * makefile.w32-in: Update dependencies.
5538
5539 2011-03-17 Eli Zaretskii <eliz@gnu.org>
5540
5541 * makefile.w32-in ($(BLD)/unexw32.$(O)): Depend on $(SRC)/unexec.h.
5542
5543 2011-03-17 Paul Eggert <eggert@cs.ucla.edu>
5544
5545 Fix more problems found by GCC 4.5.2's static checks.
5546
5547 * process.c (make_serial_process_unwind, send_process_trap):
5548 (sigchld_handler): Now static.
5549
5550 * process.c (allocate_pty): Let PTY_ITERATION declare iteration vars.
5551 That way, the code declares only the vars that it needs.
5552 * s/aix4-2.h (PTY_ITERATION): Declare iteration vars.
5553 * s/cygwin.h (PTY_ITERATION): Likewise.
5554 * s/darwin.h (PTY_ITERATION): Likewise.
5555 * s/gnu-linux.h (PTY_ITERATION): Likewise.
5556
5557 * s/irix6-5.h (PTY_OPEN): Declare stb, to loosen coupling.
5558 * process.c (allocate_pty): Don't declare stb unless it's needed.
5559
5560 * bytecode.c (MAYBE_GC): Rewrite so as not to use empty "else".
5561 (CONSTANTLIM): Remove; unused.
5562 (METER_CODE, Bscan_buffer, Bread_char, Bset_mark):
5563 Define only if needed.
5564
5565 * unexelf.c (unexec): Name an expression,
5566 to avoid gcc -Wbad-function-cast warning.
5567 Use a different way to cause a compilation error if anyone uses
5568 n rather than nn, a way that does not involve shadowing.
5569 (ELF_BSS_SECTION_NAME, OLD_PROGRAM_H): Remove; unused.
5570
5571 * deps.mk (unexalpha.o): Remove; unused.
5572
5573 New file unexec.h, the (simple) interface for unexec (Bug#8267).
5574 * unexec.h: New file.
5575 * deps.mk (emacs.o, unexaix.o, unexcw.o, unexcoff.o, unexelf.o):
5576 (unexhp9k800.o, unexmacosx.o, unexsol.o, unexw32.o):
5577 Depend on unexec.h.
5578 * emacs.c [!defined CANNOT_DUMP]: Include unexec.h.
5579 * unexaix.c, unexcoff.c, unexcw.c, unexelf.c, unexhp9k800.c:
5580 * unexmacosx.c, unexsol.c, unexw32.c: Include unexec.h.
5581 Change as necessary to match prototype in unexec.h.
5582
5583 * syntax.c (Fforward_comment, scan_lists): Rename locals to avoid
5584 shadowing.
5585 (back_comment, skip_chars): Mark vars as initialized.
5586
5587 * character.h (FETCH_STRING_CHAR_ADVANCE_NO_CHECK, BUF_INC_POS):
5588 Rename locals to avoid shadowing.
5589
5590 * lread.c (read1): Rewrite so as not to use empty "else".
5591 (Fload, readevalloop, read1): Rename locals to avoid shadowing.
5592
5593 * print.c (Fredirect_debugging_output): Fix pointer signedess.
5594
5595 * lisp.h (debug_output_compilation_hack): Add decl here, to avoid
5596 warning when compiling print.c.
5597
5598 * font.c (font_unparse_fcname): Abort in an "impossible" situation
5599 instead of using an uninitialized var.
5600 (font_sort_entities): Mark var as initialized.
5601
5602 * character.h (FETCH_CHAR_ADVANCE): Rename locals to avoid shadowing.
5603
5604 * font.c (font_unparse_xlfd): Don't mix pointers to variables with
5605 pointers to constants.
5606 (font_parse_fcname): Remove unused vars.
5607 (font_delete_unmatched): Now static.
5608 (font_get_spec): Remove; unused.
5609 (font_style_to_value, font_prop_validate_style, font_unparse_fcname):
5610 (font_update_drivers, Ffont_get_glyphs, font_add_log):
5611 Rename or move locals to avoid shadowing.
5612
5613 * fns.c (require_nesting_list, require_unwind): Now static.
5614 (Ffillarray): Rename locals to avoid shadowing.
5615
5616 * floatfns.c (domain_error2): Define only if needed.
5617 (Ffrexp, Fldexp): Rename locals to avoid shadowing.
5618
5619 * alloc.c (mark_backtrace): Move decl from here ...
5620 * lisp.h: ... to here, so that it can be checked.
5621
5622 * eval.c (call_debugger, do_debug_on_call, grow_specpdl): Now static.
5623 (Fdefvar): Rewrite so as not to use empty "else".
5624 (lisp_indirect_variable): Name an expression,
5625 to avoid gcc -Wbad-function-cast warning.
5626 (Fdefvar): Rename locals to avoid shadowing.
5627
5628 * callint.c (quotify_arg, quotify_args): Now static.
5629 (Fcall_interactively): Rename locals to avoid shadowing.
5630 Use const pointer when appropriate.
5631
5632 * lisp.h (get_system_name, get_operating_system_release):
5633 Move decls here, to check interfaces.
5634 * process.c (get_operating_system_release): Move decl to lisp.h.
5635 * xrdb.c (get_system_name): Likewise.
5636 * editfns.c (init_editfns, Fuser_login_name, Fuser_uid):
5637 (Fuser_real_uid, Fuser_full_name): Remove unnecessary casts,
5638 some of which prompt warnings from gcc -Wbad-function-cast.
5639 (Fformat_time_string, Fencode_time, Finsert_char):
5640 (Ftranslate_region_internal, Fformat):
5641 Rename or remove local vars to avoid shadowing.
5642 (Ftranslate_region_internal): Mark var as initialized.
5643
5644 * doc.c (Fdocumentation, Fsnarf_documentation): Move locals to
5645 avoid shadowing.
5646
5647 * lisp.h (eassert): Check that the argument compiles, even if
5648 ENABLE_CHECKING is not defined.
5649
5650 * data.c (Findirect_variable): Name an expression, to avoid
5651 gcc -Wbad-function-cast warning.
5652 (default_value, arithcompare, arith_driver, arith_error): Now static.
5653 (store_symval_forwarding): Rename local to avoid shadowing.
5654 (Fmake_variable_buffer_local, Fmake_local_variable):
5655 Mark variables as initialized.
5656 (do_blv_forwarding, do_symval_forwarding): Remove; unused.
5657
5658 * alloc.c (check_cons_list): Do not define unless GC_CHECK_CONS_LIST.
5659 (Fmake_vector, Fvector, Fmake_byte_code, Fgarbage_collect):
5660 Rename locals to avoid shadowing.
5661 (mark_stack): Move local variables into the #ifdef region where
5662 they're used.
5663 (BLOCK_INPUT_ALLOC, UNBLOCK_INPUT_ALLOC): Define only if
5664 ! defined SYSTEM_MALLOC && ! defined SYNC_INPUT, as they are not
5665 needed otherwise.
5666 (CHECK_ALLOCATED): Define only if GC_CHECK_MARKED_OBJECTS.
5667 (GC_STRING_CHARS): Remove; not used.
5668 (Fmemory_limit): Cast sbrk's returned value to char *.
5669
5670 * lisp.h (check_cons_list): Declare if GC_CHECK_CONS_LIST; this
5671 avoids undefined behavior in theory.
5672
5673 * regex.c (IF_LINT): Add defn, for benefit of ../lib-src.
5674
5675 Use functions, not macros, for up- and down-casing (Bug#8254).
5676 * buffer.h (DOWNCASE_TABLE, UPCASE_TABLE, DOWNCASE, UPPERCASEP):
5677 (NOCASEP, LOWERCASEP, UPCASE, UPCASE1): Remove. All callers changed
5678 to use the following functions instead of these macros.
5679 (downcase): Adjust to lack of DOWNCASE_TABLE. Return int, not
5680 EMACS_INT, since callers assume the returned value fits in int.
5681 (upcase1): Likewise, for UPCASE_TABLE.
5682 (uppercasep, lowercasep, upcase): New static inline functions.
5683 * editfns.c (Fchar_equal): Remove no-longer-needed workaround for
5684 the race-condition problem in the old DOWNCASE.
5685
5686 * regex.c (CHARSET_LOOKUP_RANGE_TABLE_RAW, POP_FAILURE_REG_OR_COUNT):
5687 Rename locals to avoid shadowing.
5688 (regex_compile, re_match_2_internal): Move locals to avoid shadowing.
5689 (regex_compile, re_search_2, re_match_2_internal):
5690 Remove unused local vars.
5691 (FREE_VAR): Rewrite so as not to use empty "else",
5692 which gcc can warn about.
5693 (regex_compile, re_match_2_internal): Mark locals as initialized.
5694 (RETALLOC_IF): Define only if needed.
5695 (WORDCHAR_P): Likewise. This one is never needed, but is used
5696 only in a comment talking about a compiler bug, so put inside
5697 the #if 0 of that comment.
5698 (CHARSET_LOOKUP_BITMAP, FAIL_STACK_FULL, RESET_FAIL_STACK):
5699 (PUSH_FAILURE_ELT, BUF_PUSH_3, STOP_ADDR_VSTRING):
5700 Remove; unused.
5701
5702 * search.c (boyer_moore): Rename locals to avoid shadowing.
5703 * character.h (FETCH_STRING_CHAR_AS_MULTIBYTE_ADVANCE):
5704 (PREV_CHAR_BOUNDARY): Likewise.
5705
5706 * search.c (simple_search): Remove unused var.
5707
5708 * dired.c (compile_pattern): Move decl from here ...
5709 * lisp.h: ... to here, so that it can be checked.
5710 (struct re_registers): New forward decl.
5711
5712 * character.h (INC_POS, DEC_POS): Rename locals to avoid shadowing.
5713
5714 * indent.c (MULTIBYTE_BYTES_WIDTH): New args bytes, width.
5715 All uses changed.
5716 (MULTIBYTE_BYTES_WIDTH, scan_for_column, compute_motion):
5717 Rename locals to avoid shadowing.
5718 (Fvertical_motion): Mark locals as initialized.
5719
5720 * casefiddle.c (casify_object, casify_region): Now static.
5721 (casify_region): Mark local as initialized.
5722
5723 * cmds.c (internal_self_insert): Rename local to avoid shadowing.
5724
5725 * lisp.h (GCPRO2_VAR, GCPRO3_VAR, GCPRO4_VAR, GCPRO5_VAR, GCPRO6_VAR):
5726 New macros, so that the caller can use some names other than
5727 gcpro1, gcpro2, etc.
5728 (GCPRO2, GCPRO3, GCPRO4, GCPRO5, GCPRO6): Reimplement in terms
5729 of the new macros.
5730 (GCPRO1_VAR, UNGCPRO_VAR): Change the meaning of the second
5731 argument, for consistency with GCPRO2_VAR, etc: it is now the
5732 prefix of the variable, not the variable itself. All uses
5733 changed.
5734 * dired.c (directory_files_internal, file_name_completion):
5735 Rename locals to avoid shadowing.
5736
5737 Fix a race condition diagnosed by gcc -Wsequence-point (Bug#8254).
5738 An expression of the form (DOWNCASE (x) == DOWNCASE (y)), found in
5739 dired.c's scmp function, had undefined behavior.
5740 * lisp.h (DOWNCASE_TABLE, UPCASE_TABLE, DOWNCASE, UPPERCASEP):
5741 (NOCASEP, LOWERCASEP, UPCASE, UPCASE1): Move from here ...
5742 * buffer.h: ... to here, because these macros use current_buffer,
5743 and the new implementation with inline functions needs to have
5744 current_buffer in scope now, rather than later when the macros
5745 are used.
5746 (downcase, upcase1): New static inline functions.
5747 (DOWNCASE, UPCASE1): Reimplement using these functions.
5748 This avoids undefined behavior in expressions like
5749 DOWNCASE (x) == DOWNCASE (y), which previously suffered
5750 from race conditions in accessing the global variables
5751 case_temp1 and case_temp2.
5752 * casetab.c (case_temp1, case_temp2): Remove; no longer needed.
5753 * lisp.h (case_temp1, case_temp2): Remove their decls.
5754 * character.h (ASCII_CHAR_P): Move from here ...
5755 * lisp.h: ... to here, so that the inline functions mentioned
5756 above can use them.
5757
5758 * dired.c (directory_files_internal_unwind): Now static.
5759
5760 * fileio.c (file_name_as_directory, directory_file_name):
5761 (barf_or_query_if_file_exists, auto_save_error, auto_save_1):
5762 Now static.
5763 (file_name_as_directory): Use const pointers when appropriate.
5764 (Fexpand_file_name): Likewise. In particular, newdir might
5765 point at constant storage, so make it a const pointer.
5766 (Fmake_directory_internal, Fread_file_name): Remove unused vars.
5767 (Ffile_selinux_context, Fset_file_selinux_context): Fix pointer
5768 signedness issues.
5769 (Fset_file_times, Finsert_file_contents, auto_save_error):
5770 Rename locals to avoid shadowing.
5771
5772 * minibuf.c (choose_minibuf_frame_1): Now static.
5773 (Ftry_completion, Fall_completions): Rename or remove locals
5774 to avoid shadowing.
5775
5776 * marker.c (bytepos_to_charpos): Remove; unused.
5777
5778 * lisp.h (verify_bytepos, count_markers): New decls,
5779 so that gcc does not warn that these functions aren't declared.
5780
5781 * insdel.c (check_markers, make_gap_larger, make_gap_smaller):
5782 (reset_var_on_error, Fcombine_after_change_execute_1): Now static.
5783 (CHECK_MARKERS): Redo to avoid gcc -Wempty-body diagnostic.
5784 (copy_text): Remove unused local var.
5785
5786 * filelock.c (within_one_second): Now static.
5787 (lock_file_1): Rename local to avoid shadowing.
5788
5789 * buffer.c (fix_overlays_before): Mark locals as initialized.
5790 (fix_start_end_in_overlays): Likewise. This function should be
5791 simplified by using pointers-to-pointers, but that's a different
5792 matter.
5793 (switch_to_buffer_1): Now static.
5794 (Fkill_buffer, record_buffer, Fbury_buffer, Fset_buffer_multibyte):
5795 (report_overlay_modification): Rename locals to avoid shadowing.
5796
5797 * sysdep.c (system_process_attributes): Rename vars to avoid shadowing.
5798 Fix pointer signedness issue.
5799 (sys_subshell): Mark local as volatile if checking for lint,
5800 to suppress a gcc -Wclobbered warning that does not seem to be right.
5801 (MAXPATHLEN): Define only if needed.
5802
5803 * process.c (serial_open, serial_configure): Move decls from here ...
5804 * systty.h: ... to here, so that they can be checked.
5805
5806 * fns.c (get_random, seed_random): Move extern decls from here ...
5807 * lisp.h: ... to here, so that they can be checked.
5808
5809 * sysdep.c (reset_io): Now static.
5810 (wait_for_termination_signal): Remove; unused.
5811
5812 * keymap.c (keymap_parent, keymap_memberp, map_keymap_internal):
5813 (copy_keymap_item, append_key, push_text_char_description):
5814 Now static.
5815 (Fwhere_is_internal): Don't test CONSP (sequences) unnecessarily.
5816 (DENSE_TABLE_SIZE): Remove; unused.
5817 (get_keymap, access_keymap, Fdefine_key, Fwhere_is_internal):
5818 (describe_map_tree):
5819 Rename locals to avoid shadowing.
5820
5821 * keyboard.c: Declare functions static if they are not used elsewhere.
5822 (echo_char, echo_dash, cmd_error, top_level_2):
5823 (poll_for_input, handle_async_input): Now static.
5824 (read_char, kbd_buffer_get_event, make_lispy_position):
5825 (make_lispy_event, make_lispy_movement, apply_modifiers):
5826 (decode_keyboard_code, tty_read_avail_input, menu_bar_items):
5827 (parse_tool_bar_item, read_key_sequence, Fread_key_sequence):
5828 (Fread_key_sequence_vector): Rename locals to avoid shadowing.
5829 (read_key_sequence, read_char): Mark locals as initialized.
5830 (Fexit_recursive_edit, Fabort_recursive_edit): Mark with NO_RETURN.
5831
5832 * keyboard.h (make_ctrl_char): New decl.
5833 (mark_kboards): Move decl here ...
5834 * alloc.c (mark_kboards): ... from here.
5835
5836 * lisp.h (force_auto_save_soon): New decl.
5837
5838 * emacs.c (init_cmdargs): Rename local to avoid shadowing.
5839 (DEFINE_DUMMY_FUNCTION): New macro.
5840 (__do_global_ctors, __do_global_ctors_aux, __do_global_dtors, __main):
5841 Use it.
5842 (main): Add casts to avoid warnings
5843 if GCC considers string literals to be constants.
5844
5845 * lisp.h (fatal_error_signal): Add decl, since it's exported.
5846
5847 * dbusbind.c: Pointer signedness fixes.
5848 (xd_signature, xd_append_arg, xd_initialize):
5849 (Fdbus_call_method, Fdbus_call_method_asynchronously):
5850 (Fdbus_method_return_internal, Fdbus_method_error_internal):
5851 (Fdbus_send_signal, xd_read_message_1, Fdbus_register_service):
5852 (Fdbus_register_signal): Use SSDATA when the context wants char *.
5853
5854 * dbusbind.c (Fdbus_init_bus): Add cast to avoid warning
5855 if GCC considers string literals to be constants.
5856 (Fdbus_register_service, Fdbus_register_method): Remove unused vars.
5857
5858 2011-03-16 Stefan Monnier <monnier@iro.umontreal.ca>
5859
5860 * print.c (PRINT_CIRCLE_CANDIDATE_P): New macro.
5861 (print_preprocess, print_object): New macro to fix last change.
5862
5863 * print.c (print_preprocess): Don't forget font objects.
5864
5865 2011-03-16 Juanma Barranquero <lekktu@gmail.com>
5866
5867 * emacs.c (USAGE3): Doc fixes.
5868
5869 2011-03-15 Andreas Schwab <schwab@linux-m68k.org>
5870
5871 * coding.c (detect_coding_iso_2022): Reorganize code to clarify
5872 structure.
5873
5874 2011-03-14 Juanma Barranquero <lekktu@gmail.com>
5875
5876 * lisp.h (VWindow_system, Qfile_name_history):
5877 * keyboard.h (lispy_function_keys) [WINDOWSNT]:
5878 * w32term.h (w32_system_caret_hwnd, w32_system_caret_height)
5879 (w32_system_caret_x, w32_system_caret_y): Declare extern.
5880
5881 * w32select.c: Don't #include "keyboard.h".
5882 (run_protected): Add extern declaration for waiting_for_input.
5883
5884 * w32.c (Qlocal, noninteractive1, inhibit_window_system):
5885 * w32console.c (detect_input_pending, read_input_pending)
5886 (encode_terminal_code):
5887 * w32fns.c (quit_char, lispy_function_keys, Qtooltip)
5888 (w32_system_caret_hwnd, w32_system_caret_height, w32_system_caret_x)
5889 (w32_system_caret_y, Qfile_name_history):
5890 * w32font.c (w32font_driver, QCantialias, QCotf, QClang):
5891 * w32inevt.c (reinvoke_input_signal, lispy_function_keys):
5892 * w32menu.c (Qmenu_bar, QCtoggle, QCradio, Qoverriding_local_map)
5893 (Qoverriding_terminal_local_map, Qmenu_bar_update_hook):
5894 * w32proc.c (Qlocal, report_file_error):
5895 * w32term.c (Vwindow_system, updating_frame):
5896 * w32uniscribe.c (initialized, uniscribe_font_driver):
5897 Remove unneeded extern declarations.
5898
5899 2011-03-14 Chong Yidong <cyd@stupidchicken.com>
5900
5901 * buffer.c (Fmake_indirect_buffer): Fix incorrect assertions.
5902
5903 2011-03-13 Chong Yidong <cyd@stupidchicken.com>
5904
5905 * buffer.h (BUF_BEGV, BUF_BEGV_BYTE, BUF_ZV, BUF_ZV_BYTE, BUF_PT)
5906 (BUF_PT_BYTE): Rewrite to handle indirect buffers (Bug#8219).
5907 These macros can no longer be used for assignment.
5908
5909 * buffer.c (Fget_buffer_create, Fmake_indirect_buffer):
5910 Assign struct members directly, instead of using BUF_BEGV etc.
5911 (record_buffer_markers, fetch_buffer_markers): New functions for
5912 recording and fetching special buffer markers.
5913 (set_buffer_internal_1, set_buffer_temp): Use them.
5914
5915 * lread.c (unreadchar): Use SET_BUF_PT_BOTH.
5916
5917 * insdel.c (adjust_point): Use SET_BUF_PT_BOTH.
5918
5919 * intervals.c (temp_set_point_both): Use SET_BUF_PT_BOTH.
5920 (get_local_map): Use SET_BUF_BEGV_BOTH and SET_BUF_ZV_BOTH.
5921
5922 * xdisp.c (hscroll_window_tree):
5923 (reconsider_clip_changes): Use PT instead of BUF_PT.
5924
5925 2011-03-13 Eli Zaretskii <eliz@gnu.org>
5926
5927 * makefile.w32-in ($(BLD)/editfns.$(O)): Depend on
5928 $(EMACS_ROOT)/lib/intprops.h.
5929
5930 2011-03-13 Paul Eggert <eggert@cs.ucla.edu>
5931
5932 Fix more problems found by GCC 4.5.2's static checks.
5933
5934 * gtkutil.c (xg_get_pixbuf_from_pixmap): Add cast from char *
5935 to unsigned char * to avoid compiler diagnostic.
5936 (xg_free_frame_widgets): Make it clear that a local variable is
5937 needed only if USE_GTK_TOOLTIP.
5938 (gdk_window_get_screen): Make it clear that this macro is needed
5939 only if USE_GTK_TOOLTIP.
5940 (int_gtk_range_get_value): New function, which avoids a diagnostic
5941 from gcc -Wbad-function-cast.
5942 (xg_set_toolkit_scroll_bar_thumb): Use it.
5943 (xg_tool_bar_callback, xg_tool_item_stale_p): Rewrite to avoid
5944 diagnostic from gcc -Wbad-function-cast.
5945 (get_utf8_string, xg_get_file_with_chooser):
5946 Rename locals to avoid shadowing.
5947 (create_dialog): Move locals to avoid shadowing.
5948
5949 * xgselect.c (xg_select): Remove unused var.
5950
5951 * image.c (four_corners_best): Mark locals as initialized.
5952 (gif_load): Initialize transparent_p to zero (Bug#8238).
5953 Mark another local as initialized.
5954 (my_png_error, my_error_exit): Mark with NO_RETURN.
5955
5956 * image.c (clear_image_cache): Now static.
5957 (DIM, HAVE_STDLIB_H_1): Remove unused macros.
5958 (xpm_load): Redo to avoid "discards qualifiers" gcc warning.
5959 (x_edge_detection): Remove unnecessary cast that
5960 gcc -Wbad-function-cast diagnoses.
5961 (gif_load): Fix pointer signedness.
5962 (clear_image_cache, xbm_read_bitmap_data, x_detect_edges):
5963 (jpeg_load, gif_load): Rename locals to avoid shadowing.
5964
5965 2011-03-12 Paul Eggert <eggert@cs.ucla.edu>
5966
5967 Improve quality of tests for time stamp overflow.
5968 For example, without this patch (encode-time 0 0 0 1 1
5969 1152921504606846976) returns the obviously-bogus value (-948597
5970 62170) on my RHEL 5.5 x86-64 host. With the patch, it correctly
5971 reports time overflow. See
5972 <http://lists.gnu.org/archive/html/emacs-devel/2011-03/msg00470.html>.
5973 * deps.mk (editfns.o): Depend on ../lib/intprops.h.
5974 * editfns.c: Include limits.h and intprops.h.
5975 (TIME_T_MIN, TIME_T_MAX): New macros.
5976 (time_overflow): Move earlier, to before first use.
5977 (hi_time, lo_time): New functions, for an accurate test for
5978 out-of-range times.
5979 (Fcurrent_time, Fget_internal_run_time, make_time): Use them.
5980 (Fget_internal_run_time): Don't assume time_t fits in int.
5981 (make_time): Use list2 instead of Fcons twice.
5982 (Fdecode_time): More accurate test for out-of-range times.
5983 (check_tm_member): New function.
5984 (Fencode_time): Use it, to test for out-of-range times.
5985 (lisp_time_argument): Don't rely on undefined left-shift and
5986 right-shift behavior when checking for time stamp overflow.
5987
5988 * editfns.c (time_overflow): New function, refactoring common code.
5989 (Fformat_time_string, Fdecode_time, Fencode_time):
5990 (Fcurrent_time_string): Use it.
5991
5992 Move 'make_time' to be next to its inverse 'lisp_time_argument'.
5993 * dired.c (make_time): Move to ...
5994 * editfns.c (make_time): ... here.
5995 * systime.h: Note the move.
5996
5997 2011-03-12 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
5998
5999 * fringe.c (update_window_fringes): Remove unused variables.
6000
6001 * unexmacosx.c (copy_data_segment): Also copy __got section.
6002 (Bug#8223)
6003
6004 2011-03-12 Eli Zaretskii <eliz@gnu.org>
6005
6006 * termcap.c [MSDOS]: Include "msdos.h".
6007 (find_capability, tgetnum, tgetflag, tgetstr, tputs, tgetent):
6008 Constify `char *' arguments and their references according to
6009 prototypes in tparam.h.
6010
6011 * deps.mk (termcap.o): Depend on tparam.h and msdos.h.
6012
6013 * msdos.c (XMenuAddPane): 3rd argument is `const char *' now.
6014 Adapt all references accordingly.
6015
6016 * msdos.h (XMenuAddPane): 3rd argument is `const char *' now.
6017
6018 2011-03-11 Tom Tromey <tromey@redhat.com>
6019
6020 * buffer.c (syms_of_buffer): Remove obsolete comment.
6021
6022 2011-03-11 Eli Zaretskii <eliz@gnu.org>
6023
6024 * termhooks.h (encode_terminal_code): Declare prototype.
6025
6026 * msdos.c (encode_terminal_code): Don't declare prototype.
6027
6028 * term.c (encode_terminal_code): Now external again, used by
6029 w32console.c and msdos.c.
6030
6031 * makefile.w32-in ($(BLD)/term.$(O), ($(BLD)/tparam.$(O)):
6032 Depend on $(SRC)/tparam.h, see 2011-03-11T07:24:21Z!eggert@cs.ucla.edu.
6033
6034 2011-03-11 Paul Eggert <eggert@cs.ucla.edu>
6035
6036 Fix some minor problems found by GCC 4.5.2's static checks.
6037
6038 * fringe.c (update_window_fringes): Mark locals as initialized
6039 (Bug#8227).
6040 (destroy_fringe_bitmap, init_fringe_bitmap): Now static.
6041
6042 * alloc.c (mark_fringe_data): Move decl from here ...
6043 * lisp.h (mark_fringe_data) [HAVE_WINDOW_SYSTEM]: ... to here,
6044 to check its interface.
6045 (init_fringe_once): Do not declare unless HAVE_WINDOW_SYSTEM.
6046
6047 * fontset.c (free_realized_fontset): Now static.
6048 (Fset_fontset_font): Rename local to avoid shadowing.
6049 (fontset_font): Mark local as initialized.
6050 (FONTSET_SPEC, FONTSET_REPERTORY, RFONT_DEF_REPERTORY): Remove; unused.
6051
6052 * xrdb.c: Include "xterm.h", to check x_load_resources's interface.
6053
6054 * xselect.c (x_disown_buffer_selections): Remove; not used.
6055 (TRACE3) [!defined TRACE_SELECTION]: Remove; not used.
6056 (x_own_selection, Fx_disown_selection_internal): Rename locals
6057 to avoid shadowing.
6058 (x_handle_dnd_message): Remove local to avoid shadowing.
6059
6060 * lisp.h (GCPRO1_VAR, UNGCPRO_VAR): New macros,
6061 so that the caller can use some name other than gcpro1.
6062 (GCPRO1, UNGCPRO): Reimplement in terms of the new macros.
6063 * xfns.c (Fx_create_frame, x_create_tip_frame, Fx_show_tip):
6064 (Fx_backspace_delete_keys_p):
6065 Use them to avoid shadowing, and rename vars to avoid shadowing.
6066 (x_decode_color, x_set_name, x_window): Now static.
6067 (Fx_create_frame): Add braces to silence GCC warning.
6068 (Fx_file_dialog, Fx_select_font): Fix pointer signedness.
6069 (x_real_positions, xg_set_icon_from_xpm_data, x_create_tip_frame):
6070 Remove unused locals.
6071 (Fx_create_frame, x_create_tip_frame, Fx_show_tip):
6072 (Fx_backspace_delete_keys_p): Rename locals to avoid shadowing.
6073 Some of these renamings use the new GCPRO1_VAR and UNGCPRO_VAR
6074 macros.
6075
6076 * xterm.h (x_mouse_leave): New decl.
6077
6078 * xterm.c (x_copy_dpy_color, x_focus_on_frame, x_unfocus_frame):
6079 Remove unused functions.
6080 (x_shift_glyphs_for_insert, XTflash, XTring_bell):
6081 (x_calc_absolute_position): Now static.
6082 (XTread_socket): Don't define label "out" unless it's used.
6083 Don't declare local "event" unless it's used.
6084 (x_iconify_frame, x_free_frame_resources): Don't declare locals
6085 unless they are used.
6086 (XEMBED_VERSION, xembed_set_info): Don't define unless needed.
6087 (x_fatal_error_signal): Remove; not used.
6088 (x_draw_image_foreground, redo_mouse_highlight, XTmouse_position):
6089 (x_scroll_bar_report_motion, handle_one_xevent, x_draw_bar_cursor):
6090 (x_error_catcher, x_connection_closed, x_error_handler):
6091 (x_error_quitter, xembed_send_message, x_iconify_frame):
6092 (my_log_handler): Rename locals to avoid shadowing.
6093 (x_delete_glyphs, x_ins_del_lines): Mark with NO_RETURN.
6094 (x_connection_closed): Tell GCC not to suggest NO_RETURN.
6095
6096 * xfaces.c (clear_face_cache, Fx_list_fonts, Fface_font):
6097 Rename or move locals to avoid shadowing.
6098 (tty_defined_color, merge_face_heights): Now static.
6099 (free_realized_faces_for_fontset): Remove; not used.
6100 (Fx_list_fonts): Mark variable that gcc -Wuninitialized
6101 does not deduce is never used uninitialized.
6102 (STRDUPA, LSTRDUPA, FONT_POINT_SIZE_QUANTUM): Remove; not used.
6103 (LFACEP): Define only if XASSERTS, as it's not needed otherwise.
6104
6105 * terminal.c (store_terminal_param): Now static.
6106
6107 * xmenu.c (menu_highlight_callback): Now static.
6108 (set_frame_menubar): Remove unused local.
6109 (xmenu_show): Rename parameter to avoid shadowing.
6110 (xmenu_show, xdialog_show, xmenu_show): Make local pointers "const"
6111 since they might point to immutable storage.
6112 (next_menubar_widget_id): Declare only if USE_X_TOOLKIT,
6113 since it's unused otherwise.
6114
6115 * xdisp.c (produce_glyphless_glyph): Initialize lower_xoff.
6116 Add a FIXME, since the code still doesn't look right. (Bug#8215)
6117 (Fcurrent_bidi_paragraph_direction): Simplify slightly; this
6118 avoids a gcc -Wuninitialized diagnostic.
6119 (display_line, BUILD_COMPOSITE_GLYPH_STRING, draw_glyphs):
6120 (note_mouse_highlight): Mark variables that gcc -Wuninitialized
6121 does not deduce are never used uninitialized.
6122
6123 * lisp.h (IF_LINT): New macro, copied from ../lib-src/emacsclient.c.
6124
6125 * xdisp.c (redisplay_window): Rename local to avoid shadowing.
6126 * window.c (window_loop, size_window):
6127 (run_window_configuration_change_hook, enlarge_window): Likewise.
6128
6129 * window.c (display_buffer): Now static.
6130 (size_window): Mark variables that gcc -Wuninitialized
6131 does not deduce are never used uninitialized.
6132 * window.h (check_all_windows): New decl, to forestall
6133 gcc -Wmissing-prototypes diagnostic.
6134 * dispextern.h (bidi_dump_cached_states): Likewise.
6135
6136 * charset.h (CHECK_CHARSET_GET_CHARSET): Rename locals to avoid
6137 shadowing.
6138 * charset.c (map_charset_for_dump, Fchar_charset): Likewise.
6139 Include <limits.h>.
6140 (Fsort_charsets): Redo min/max calculation to shorten the code a bit
6141 and to avoid gcc -Wuninitialized warning.
6142 (load_charset_map): Mark variables that gcc -Wuninitialized
6143 does not deduce are never used uninitialized.
6144 (load_charset): Abort instead of using uninitialized var (Bug#8229).
6145
6146 * coding.c (coding_set_source, coding_set_destination):
6147 Use "else { /* comment */ }" rather than "else /* comment */;"
6148 for clarity, and to avoid gcc -Wempty-body warning.
6149 (Fdefine_coding_system_internal): Don't redeclare 'i' inside
6150 a block, when the outer 'i' will do.
6151 (decode_coding_utf_8, decode_coding_utf_16, detect_coding_emacs_mule):
6152 (emacs_mule_char, decode_coding_emacs_mule, detect_coding_iso_2022):
6153 (decode_coding_iso_2022, decode_coding_sjis, decode_coding_big5):
6154 (decode_coding_raw_text, decode_coding_charset, get_translation_table):
6155 (Fdecode_sjis_char, Fdefine_coding_system_internal):
6156 Rename locals to avoid shadowing.
6157 * character.h (FETCH_STRING_CHAR_ADVANCE): Likewise.
6158 * coding.c (emacs_mule_char, encode_invocation_designation):
6159 Now static, since they're not used elsewhere.
6160 (decode_coding_iso_2022): Add "default: abort ();" as a safety check.
6161 (decode_coding_object, encode_coding_object, detect_coding_system):
6162 (decode_coding_emacs_mule): Mark variables that gcc
6163 -Wuninitialized does not deduce are never used uninitialized.
6164 (detect_coding_iso_2022): Initialize a local variable that might
6165 be used uninitialized. Leave a FIXME because it's not clear that
6166 this initialization is needed. (Bug#8211)
6167 (ISO_CODE_LF, ISO_CODE_CR, CODING_ISO_FLAG_EUC_TW_SHIFT):
6168 (ONE_MORE_BYTE_NO_CHECK, UTF_BOM, UTF_16_INVALID_P):
6169 (SHIFT_OUT_OK, ENCODE_CONTROL_SEQUENCE_INTRODUCER):
6170 (ENCODE_DIRECTION_R2L, ENCODE_DIRECTION_L2R):
6171 Remove unused macros.
6172
6173 * category.c (hash_get_category_set): Remove unused local var.
6174 (copy_category_table): Now static, since it's not used elsewhere.
6175 * character.c (string_count_byte8): Likewise.
6176
6177 * ccl.c (CCL_WRITE_STRING, CCL_ENCODE_CHAR, Fccl_execute_on_string):
6178 (Fregister_code_conversion_map): Rename locals to avoid shadowing.
6179
6180 * chartab.c (copy_sub_char_table): Now static, since it's not used
6181 elsewhere.
6182 (sub_char_table_ref_and_range, char_table_ref_and_range):
6183 Rename locals to avoid shadowing.
6184 (ASET_RANGE, GET_SUB_CHAR_TABLE): Remove unused macros.
6185
6186 * bidi.c (bidi_check_type): Now static, since it's not used elsewhere.
6187 (BIDI_BOB): Remove unused macro.
6188
6189 * cm.c (cmgoto): Mark variables that gcc -Wuninitialized does not
6190 deduce are never used uninitialized.
6191 * term.c (encode_terminal_code): Likewise.
6192
6193 * term.c (encode_terminal_code): Now static. Remove unused local.
6194
6195 * tparam.h: New file.
6196 * term.c, tparam.h: Include it.
6197 * deps.mk (term.o, tparam.o): Depend on tparam.h.
6198 * term.c (tputs, tgetent, tgetflag, tgetnum, tparam, tgetstr):
6199 Move these decls to tparam.h, and make them agree with what
6200 is actually in tparam.c. The previous trick of using incompatible
6201 decls in different modules does not conform to the C standard.
6202 All callers of tparam changed to use tparam's actual API.
6203 * tparam.c (tparam1, tparam, tgoto):
6204 Use const pointers where appropriate.
6205
6206 * cm.c (calccost, cmgoto): Use const pointers where appropriate.
6207 * cm.h (struct cm): Likewise.
6208 * dispextern.h (do_line_insertion_deletion_costs): Likewise.
6209 * scroll.c (ins_del_costs, do_line_insertion_deletion_costs): Likewise.
6210 * term.c (tty_ins_del_lines, calculate_costs, struct fkey_table):
6211 (term_get_fkeys_1, append_glyphless_glyph, produce_glyphless_glyph):
6212 (turn_on_face, init_tty): Likewise.
6213 * termchar.h (struct tty_display_info): Likewise.
6214
6215 * term.c (term_mouse_position): Rename local to avoid shadowing.
6216
6217 * alloc.c (mark_ttys): Move decl from here ...
6218 * lisp.h (mark_ttys): ... to here, so that it's checked against defn.
6219
6220 2011-03-11 Andreas Schwab <schwab@linux-m68k.org>
6221
6222 * .gdbinit (pwinx, xbuffer): Fix access to buffer name.
6223
6224 2011-03-09 Juanma Barranquero <lekktu@gmail.com>
6225
6226 * search.c (compile_pattern_1): Remove argument regp, unused since
6227 revid:rms@gnu.org-19941211082627-3x1g1wyqkjmwloig.
6228 (compile_pattern): Don't pass it.
6229
6230 2011-03-08 Jan Djärv <jan.h.d@swipnet.se>
6231
6232 * xterm.h (DEFAULT_GDK_DISPLAY): New define.
6233 (GDK_WINDOW_XID, gtk_widget_get_preferred_size): New defines
6234 for ! HAVE_GTK3.
6235 (GTK_WIDGET_TO_X_WIN): Use GDK_WINDOW_XID.
6236
6237 * xmenu.c (menu_position_func): Call gtk_widget_get_preferred_size.
6238
6239 * gtkutil.c: Include gtkx.h if HAVE_GTK3. If ! HAVE_GTK3, define
6240 gdk_window_get_screen, gdk_window_get_geometry,
6241 gdk_x11_window_lookup_for_display and GDK_KEY_g.
6242 (xg_set_screen): Use DEFAULT_GDK_DISPLAY.
6243 (xg_get_pixbuf_from_pixmap): New function.
6244 (xg_get_pixbuf_from_pix_and_mask): Change parameters from GdkPixmap
6245 to Pixmap, take frame as parameter, remove GdkColormap parameter.
6246 Call xg_get_pixbuf_from_pixmap instead of
6247 gdk_pixbuf_get_from_drawable.
6248 (xg_get_image_for_pixmap): Do not make GdkPixmaps, call
6249 xg_get_pixbuf_from_pix_and_mask with Pixmap parameters instead.
6250 (xg_check_special_colors): Use GtkStyleContext and its functions
6251 for HAVE_GTK3.
6252 (xg_prepare_tooltip, xg_hide_tooltip): Call gdk_window_get_screen.
6253 (xg_prepare_tooltip, create_dialog, menubar_map_cb)
6254 (xg_update_frame_menubar, xg_tool_bar_detach_callback)
6255 (xg_tool_bar_attach_callback, xg_update_tool_bar_sizes):
6256 Call gtk_widget_get_preferred_size.
6257 (xg_frame_resized): gdk_window_get_geometry only takes 5
6258 parameters.
6259 (xg_win_to_widget, xg_event_is_for_menubar):
6260 Call gdk_x11_window_lookup_for_display.
6261 (xg_set_widget_bg): New function.
6262 (delete_cb): New function.
6263 (xg_create_frame_widgets): Connect delete-event to delete_cb.
6264 Call xg_set_widget_bg. Only set backgrund pixmap for ! HAVE_GTK3
6265 (xg_set_background_color): Call xg_set_widget_bg.
6266 (xg_set_frame_icon): Call xg_get_pixbuf_from_pix_and_mask.
6267 (xg_create_scroll_bar): vadj is a GtkAdjustment for HAVE_GTK3.
6268 Only call gtk_range_set_update_policy if ! HAVE_GTK3.
6269 (xg_make_tool_item): Only connect xg_tool_bar_item_expose_callback
6270 if ! HAVE_GTK3.
6271 (update_frame_tool_bar): Call gtk_widget_hide.
6272 (xg_initialize): Use GDK_KEY_g.
6273
6274 * xsmfns.c (gdk_set_sm_client_id): Define to gdk_set_sm_client_id
6275 if ! HAVE_GTK3
6276 (x_session_initialize): Call gdk_x11_set_sm_client_id.
6277
6278 * xterm.c (XFillRectangle): Use cairo routines for HAVE_GTK3.
6279 (x_term_init): Disable Xinput(2) with GDK_CORE_DEVICE_EVENTS.
6280 Load ~/emacs.d/gtkrc only for ! HAVE_GTK3.
6281
6282 2011-03-08 Juanma Barranquero <lekktu@gmail.com>
6283
6284 * w32xfns.c (select_palette): Check success of RealizePalette against
6285 GDI_ERROR, not zero.
6286
6287 See ChangeLog.11 for earlier changes.
6288
6289 ;; Local Variables:
6290 ;; coding: utf-8
6291 ;; End:
6292
6293 Copyright (C) 2011 Free Software Foundation, Inc.
6294
6295 This file is part of GNU Emacs.
6296
6297 GNU Emacs is free software: you can redistribute it and/or modify
6298 it under the terms of the GNU General Public License as published by
6299 the Free Software Foundation, either version 3 of the License, or
6300 (at your option) any later version.
6301
6302 GNU Emacs is distributed in the hope that it will be useful,
6303 but WITHOUT ANY WARRANTY; without even the implied warranty of
6304 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6305 GNU General Public License for more details.
6306
6307 You should have received a copy of the GNU General Public License
6308 along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.