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