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