diff options
| author | Paul Eggert | 2011-04-14 13:16:48 -0700 |
|---|---|---|
| committer | Paul Eggert | 2011-04-14 13:16:48 -0700 |
| commit | 8bd7b8304a41da5dc0c8a11967c1a6005e9465d0 (patch) | |
| tree | 145588110166df723c31f3fceaa00c190b77aa8c /src | |
| parent | cd64ea1d0df393beb93d1bdf19bd3990e3378f85 (diff) | |
| parent | 9024ff7943e9529ec38a80aaaa0db43224c1e885 (diff) | |
| download | emacs-8bd7b8304a41da5dc0c8a11967c1a6005e9465d0.tar.gz emacs-8bd7b8304a41da5dc0c8a11967c1a6005e9465d0.zip | |
Merge from mainline.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 76 | ||||
| -rw-r--r-- | src/ChangeLog.11 | 2 | ||||
| -rw-r--r-- | src/alloc.c | 14 | ||||
| -rw-r--r-- | src/charset.c | 2 | ||||
| -rw-r--r-- | src/fileio.c | 27 | ||||
| -rw-r--r-- | src/keyboard.c | 2 | ||||
| -rw-r--r-- | src/lisp.h | 4 | ||||
| -rw-r--r-- | src/sound.c | 8 | ||||
| -rw-r--r-- | src/sysdep.c | 26 | ||||
| -rw-r--r-- | src/termcap.c | 10 | ||||
| -rw-r--r-- | src/xdisp.c | 22 | ||||
| -rw-r--r-- | src/xfns.c | 2 | ||||
| -rw-r--r-- | src/xsettings.c | 6 |
13 files changed, 131 insertions, 70 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 29b2457e08a..2b0df1f7a30 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,8 +1,6 @@ | |||
| 1 | 2011-04-14 Paul Eggert <eggert@cs.ucla.edu> | 1 | 2011-04-14 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 2 | ||
| 3 | * lisp.h (INFUN): Remove. Suggested by Dan Nicolaescu in | 3 | Improve C-level modularity by making more things 'static'. |
| 4 | <http://lists.gnu.org/archive/html/emacs-devel/2011-04/msg00393.html>. | ||
| 5 | All uses spelled out. | ||
| 6 | 4 | ||
| 7 | Don't publish debugger-only interfaces to other modules. | 5 | Don't publish debugger-only interfaces to other modules. |
| 8 | * lisp.h (safe_debug_print, debug_output_compilation_hack): | 6 | * lisp.h (safe_debug_print, debug_output_compilation_hack): |
| @@ -49,7 +47,7 @@ | |||
| 49 | (get_tty_terminal): Now static. | 47 | (get_tty_terminal): Now static. |
| 50 | (term_mouse_moveto): Do not define if HAVE_WINDOW_SYSTEM. | 48 | (term_mouse_moveto): Do not define if HAVE_WINDOW_SYSTEM. |
| 51 | * termhooks.h (term_mouse_moveto): Do not declare if | 49 | * termhooks.h (term_mouse_moveto): Do not declare if |
| 52 | HAVE_WINDOW_SYSTEMM. | 50 | HAVE_WINDOW_SYSTEM. |
| 53 | * dispextern.h (tty_set_terminal_modes, tty_reset_terminal_modes): | 51 | * dispextern.h (tty_set_terminal_modes, tty_reset_terminal_modes): |
| 54 | (tty_turn_off_highlight, get_tty_terminal): Remove decls. | 52 | (tty_turn_off_highlight, get_tty_terminal): Remove decls. |
| 55 | 53 | ||
| @@ -132,8 +130,6 @@ | |||
| 132 | Now static. | 130 | Now static. |
| 133 | * intervals.h (merge_interval_right, delete_interval): Remove decls. | 131 | * intervals.h (merge_interval_right, delete_interval): Remove decls. |
| 134 | 132 | ||
| 135 | 2011-04-13 Paul Eggert <eggert@cs.ucla.edu> | ||
| 136 | |||
| 137 | * insdel.c: Make symbols static if they're not exported. | 133 | * insdel.c: Make symbols static if they're not exported. |
| 138 | However, leave prepare_to_modify_buffer alone. It's never | 134 | However, leave prepare_to_modify_buffer alone. It's never |
| 139 | called from outside this function, but that appears to be a bug. | 135 | called from outside this function, but that appears to be a bug. |
| @@ -218,8 +214,6 @@ | |||
| 218 | (xic_create_fontsetname): Declare only if HAVE_X_WINDOWS && | 214 | (xic_create_fontsetname): Declare only if HAVE_X_WINDOWS && |
| 219 | USE_X_TOOLKIT. | 215 | USE_X_TOOLKIT. |
| 220 | 216 | ||
| 221 | 2011-04-12 Paul Eggert <eggert@cs.ucla.edu> | ||
| 222 | |||
| 223 | * ftxfont.c: Make symbols static if they're not exported. | 217 | * ftxfont.c: Make symbols static if they're not exported. |
| 224 | (ftxfont_driver): Export only if !defined HAVE_XFT && def8ined | 218 | (ftxfont_driver): Export only if !defined HAVE_XFT && def8ined |
| 225 | HAVE_FREETYPE. | 219 | HAVE_FREETYPE. |
| @@ -281,8 +275,6 @@ | |||
| 281 | * lisp.h (circular_list_error, FOREACH): Remove; unused. | 275 | * lisp.h (circular_list_error, FOREACH): Remove; unused. |
| 282 | * data.c (circular_list_error): Remove. | 276 | * data.c (circular_list_error): Remove. |
| 283 | 277 | ||
| 284 | 2011-04-11 Paul Eggert <eggert@cs.ucla.edu> | ||
| 285 | |||
| 286 | * commands.h (last_point_position, last_point_position_buffer): | 278 | * commands.h (last_point_position, last_point_position_buffer): |
| 287 | (last_point_position_window): Remove decls. | 279 | (last_point_position_window): Remove decls. |
| 288 | * keyboard.c: Make these variables static. | 280 | * keyboard.c: Make these variables static. |
| @@ -370,11 +362,8 @@ | |||
| 370 | to see whether these functions can be called from other modules. | 362 | to see whether these functions can be called from other modules. |
| 371 | DEFUN now defines a static function. To make the function external | 363 | DEFUN now defines a static function. To make the function external |
| 372 | so that it can be used in other C modules, use the new macro DEFUE. | 364 | so that it can be used in other C modules, use the new macro DEFUE. |
| 373 | * lisp.h (DEFINE_FUNC): New macro, with the old contents of DEFUN. | 365 | * lisp.h (Funibyte_char_to_multibyte, Fsyntax_table_p): |
| 374 | (DEFUN): Rewrite in terms of DEFINE_FUNC. It now generates a | 366 | (Finit_image_library): |
| 375 | static function definition. Use DEFUE if you want an extern one. | ||
| 376 | (DEFUE, INFUN): New macros. | ||
| 377 | (Funibyte_char_to_multibyte, Fsyntax_table_p, Finit_image_library): | ||
| 378 | (Feval_region, Fbacktrace, Ffetch_bytecode, Fswitch_to_buffer): | 367 | (Feval_region, Fbacktrace, Ffetch_bytecode, Fswitch_to_buffer): |
| 379 | (Ffile_executable_p, Fmake_symbolic_link, Fcommand_execute): | 368 | (Ffile_executable_p, Fmake_symbolic_link, Fcommand_execute): |
| 380 | (Fget_process, Fdocumentation_property, Fbyte_code, Ffile_attributes): | 369 | (Fget_process, Fdocumentation_property, Fbyte_code, Ffile_attributes): |
| @@ -423,12 +412,63 @@ | |||
| 423 | (Fset_window_margins, Fset_window_vscroll): New forward static decls. | 412 | (Fset_window_margins, Fset_window_vscroll): New forward static decls. |
| 424 | * window.h (Fset_window_vscroll, Fset_window_margins): Remove decls. | 413 | * window.h (Fset_window_vscroll, Fset_window_margins): Remove decls. |
| 425 | 414 | ||
| 426 | 2011-04-10 Paul Eggert <eggert@cs.ucla.edu> | ||
| 427 | |||
| 428 | * editfns.c (Fformat): Remove unreachable code. | 415 | * editfns.c (Fformat): Remove unreachable code. |
| 429 | 416 | ||
| 417 | 2011-04-14 Andreas Schwab <schwab@linux-m68k.org> | ||
| 418 | |||
| 419 | * fileio.c (Finsert_file_contents): Fix typo in 2005-05-13 | ||
| 420 | change. (Bug#8496) | ||
| 421 | |||
| 422 | 2011-04-13 Eli Zaretskii <eliz@gnu.org> | ||
| 423 | |||
| 424 | * xdisp.c (handle_invisible_prop): Don't call bidi_paragraph_init | ||
| 425 | when at ZV. (Bug#8487) | ||
| 426 | |||
| 427 | 2011-04-12 Andreas Schwab <schwab@linux-m68k.org> | ||
| 428 | |||
| 429 | * charset.c (Fclear_charset_maps): Use xfree instead of free. | ||
| 430 | (Bug#8437) | ||
| 431 | * keyboard.c (parse_tool_bar_item): Likewise. | ||
| 432 | * sound.c (sound_cleanup, alsa_close): Likewise. | ||
| 433 | * termcap.c (tgetent): Likewise. | ||
| 434 | * xfns.c (x_default_font_parameter): Likewise. | ||
| 435 | * xsettings.c (read_and_apply_settings): Likewise. | ||
| 436 | |||
| 437 | * alloc.c (overrun_check_malloc, overrun_check_realloc) | ||
| 438 | (overrun_check_free): Protoize. | ||
| 439 | |||
| 440 | 2011-04-12 Paul Eggert <eggert@cs.ucla.edu> | ||
| 441 | |||
| 442 | * sysdep.c (emacs_read, emacs_write): Check for negative sizes | ||
| 443 | since callers should never pass a negative size. | ||
| 444 | Change the signature to match that of plain 'read' and 'write'; see | ||
| 445 | <http://lists.gnu.org/archive/html/emacs-devel/2011-04/msg00397.html>. | ||
| 446 | * lisp.h: Update prototypes of emacs_write and emacs_read. | ||
| 447 | |||
| 448 | 2011-04-11 Eli Zaretskii <eliz@gnu.org> | ||
| 449 | |||
| 450 | * xdisp.c (redisplay_window): Don't try to determine the character | ||
| 451 | position of the scroll margin if the window start point w->startp | ||
| 452 | is outside the buffer's accessible region. (Bug#8468) | ||
| 453 | |||
| 454 | 2011-04-10 Eli Zaretskii <eliz@gnu.org> | ||
| 455 | |||
| 456 | Fix write-region and its subroutines for buffers > 2GB. | ||
| 457 | * fileio.c (a_write, e_write): Modify declaration of arguments and | ||
| 458 | local variables to support buffers larger than 2GB. | ||
| 459 | (Fcopy_file): Use EMACS_INT for return value of emacs_read. | ||
| 460 | |||
| 461 | * sysdep.c (emacs_write, emacs_read): Use ssize_t for last | ||
| 462 | argument, local variables, and return value. | ||
| 463 | |||
| 464 | * lisp.h: Update prototypes of emacs_write and emacs_read. | ||
| 465 | |||
| 466 | * sound.c (vox_write): Use ssize_t for return value of emacs_write. | ||
| 467 | |||
| 430 | 2011-04-10 Paul Eggert <eggert@cs.ucla.edu> | 468 | 2011-04-10 Paul Eggert <eggert@cs.ucla.edu> |
| 431 | 469 | ||
| 470 | * xdisp.c (vmessage): Use memchr, not strnlen, which some hosts lack. | ||
| 471 | |||
| 432 | Fix more problems found by GCC 4.6.0's static checks. | 472 | Fix more problems found by GCC 4.6.0's static checks. |
| 433 | 473 | ||
| 434 | * xdisp.c (vmessage): Use a better test for character truncation. | 474 | * xdisp.c (vmessage): Use a better test for character truncation. |
| @@ -534,7 +574,7 @@ | |||
| 534 | * xselect.c (x_decline_selection_request) | 574 | * xselect.c (x_decline_selection_request) |
| 535 | (x_reply_selection_request): Avoid type-punned deref of X events. | 575 | (x_reply_selection_request): Avoid type-punned deref of X events. |
| 536 | 576 | ||
| 537 | 2011-04-09 Eli Zaretskii <eliz@emacstest.gnu.org> | 577 | 2011-04-09 Eli Zaretskii <eliz@gnu.org> |
| 538 | 578 | ||
| 539 | Fix some uses of `int' instead of EMACS_INT. | 579 | Fix some uses of `int' instead of EMACS_INT. |
| 540 | * search.c (string_match_1, fast_string_match) | 580 | * search.c (string_match_1, fast_string_match) |
diff --git a/src/ChangeLog.11 b/src/ChangeLog.11 index 703b084743c..6f462e32534 100644 --- a/src/ChangeLog.11 +++ b/src/ChangeLog.11 | |||
| @@ -4906,7 +4906,7 @@ | |||
| 4906 | (Finternal_describe_syntax_value): Recognize new flag; use the | 4906 | (Finternal_describe_syntax_value): Recognize new flag; use the |
| 4907 | SYNTAX_FLAGS_* macros. | 4907 | SYNTAX_FLAGS_* macros. |
| 4908 | (scan_sexps_forward, Fparse_partial_sexp): Change representation of | 4908 | (scan_sexps_forward, Fparse_partial_sexp): Change representation of |
| 4909 | comment style to accomodate the new styles. | 4909 | comment style to accommodate the new styles. |
| 4910 | (back_comment, forw_comment, Fforward_comment, scan_lists) | 4910 | (back_comment, forw_comment, Fforward_comment, scan_lists) |
| 4911 | (scan_sexps_forward): Update code to obey the new comment style flag. | 4911 | (scan_sexps_forward): Update code to obey the new comment style flag. |
| 4912 | 4912 | ||
diff --git a/src/alloc.c b/src/alloc.c index 1c793c985eb..16cd183aaa1 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -565,8 +565,7 @@ static int check_depth; | |||
| 565 | /* Like malloc, but wraps allocated block with header and trailer. */ | 565 | /* Like malloc, but wraps allocated block with header and trailer. */ |
| 566 | 566 | ||
| 567 | POINTER_TYPE * | 567 | POINTER_TYPE * |
| 568 | overrun_check_malloc (size) | 568 | overrun_check_malloc (size_t size) |
| 569 | size_t size; | ||
| 570 | { | 569 | { |
| 571 | register unsigned char *val; | 570 | register unsigned char *val; |
| 572 | size_t overhead = ++check_depth == 1 ? XMALLOC_OVERRUN_CHECK_SIZE*2 : 0; | 571 | size_t overhead = ++check_depth == 1 ? XMALLOC_OVERRUN_CHECK_SIZE*2 : 0; |
| @@ -590,11 +589,9 @@ overrun_check_malloc (size) | |||
| 590 | with header and trailer. */ | 589 | with header and trailer. */ |
| 591 | 590 | ||
| 592 | POINTER_TYPE * | 591 | POINTER_TYPE * |
| 593 | overrun_check_realloc (block, size) | 592 | overrun_check_realloc (POINTER_TYPE *block, size_t size) |
| 594 | POINTER_TYPE *block; | ||
| 595 | size_t size; | ||
| 596 | { | 593 | { |
| 597 | register unsigned char *val = (unsigned char *)block; | 594 | register unsigned char *val = (unsigned char *) block; |
| 598 | size_t overhead = ++check_depth == 1 ? XMALLOC_OVERRUN_CHECK_SIZE*2 : 0; | 595 | size_t overhead = ++check_depth == 1 ? XMALLOC_OVERRUN_CHECK_SIZE*2 : 0; |
| 599 | 596 | ||
| 600 | if (val | 597 | if (val |
| @@ -630,10 +627,9 @@ overrun_check_realloc (block, size) | |||
| 630 | /* Like free, but checks block for overrun. */ | 627 | /* Like free, but checks block for overrun. */ |
| 631 | 628 | ||
| 632 | void | 629 | void |
| 633 | overrun_check_free (block) | 630 | overrun_check_free (POINTER_TYPE *block) |
| 634 | POINTER_TYPE *block; | ||
| 635 | { | 631 | { |
| 636 | unsigned char *val = (unsigned char *)block; | 632 | unsigned char *val = (unsigned char *) block; |
| 637 | 633 | ||
| 638 | ++check_depth; | 634 | ++check_depth; |
| 639 | if (val | 635 | if (val |
diff --git a/src/charset.c b/src/charset.c index cc7c53ae61c..c4699dcb0a7 100644 --- a/src/charset.c +++ b/src/charset.c | |||
| @@ -2143,7 +2143,7 @@ It should be called only from temacs invoked for dumping. */) | |||
| 2143 | { | 2143 | { |
| 2144 | if (temp_charset_work) | 2144 | if (temp_charset_work) |
| 2145 | { | 2145 | { |
| 2146 | free (temp_charset_work); | 2146 | xfree (temp_charset_work); |
| 2147 | temp_charset_work = NULL; | 2147 | temp_charset_work = NULL; |
| 2148 | } | 2148 | } |
| 2149 | 2149 | ||
diff --git a/src/fileio.c b/src/fileio.c index 7f749536d56..b8c5e796db4 100644 --- a/src/fileio.c +++ b/src/fileio.c | |||
| @@ -146,8 +146,10 @@ static Lisp_Object Qcar_less_than_car; | |||
| 146 | 146 | ||
| 147 | static Lisp_Object Fmake_symbolic_link (Lisp_Object, Lisp_Object, Lisp_Object); | 147 | static Lisp_Object Fmake_symbolic_link (Lisp_Object, Lisp_Object, Lisp_Object); |
| 148 | static int a_write (int, Lisp_Object, int, int, | 148 | static int a_write (int, Lisp_Object, int, int, |
| 149 | static int a_write (int, Lisp_Object, EMACS_INT, EMACS_INT, | ||
| 149 | Lisp_Object *, struct coding_system *); | 150 | Lisp_Object *, struct coding_system *); |
| 150 | static int e_write (int, Lisp_Object, int, int, struct coding_system *); | 151 | static int e_write (int, Lisp_Object, EMACS_INT, EMACS_INT, |
| 152 | struct coding_system *); | ||
| 151 | 153 | ||
| 152 | 154 | ||
| 153 | void | 155 | void |
| @@ -1808,7 +1810,8 @@ If PRESERVE-SELINUX-CONTEXT is non-nil and SELinux is enabled | |||
| 1808 | on the system, we copy the SELinux context of FILE to NEWNAME. */) | 1810 | on the system, we copy the SELinux context of FILE to NEWNAME. */) |
| 1809 | (Lisp_Object file, Lisp_Object newname, Lisp_Object ok_if_already_exists, Lisp_Object keep_time, Lisp_Object preserve_uid_gid, Lisp_Object preserve_selinux_context) | 1811 | (Lisp_Object file, Lisp_Object newname, Lisp_Object ok_if_already_exists, Lisp_Object keep_time, Lisp_Object preserve_uid_gid, Lisp_Object preserve_selinux_context) |
| 1810 | { | 1812 | { |
| 1811 | int ifd, ofd, n; | 1813 | int ifd, ofd; |
| 1814 | EMACS_INT n; | ||
| 1812 | char buf[16 * 1024]; | 1815 | char buf[16 * 1024]; |
| 1813 | struct stat st, out_st; | 1816 | struct stat st, out_st; |
| 1814 | Lisp_Object handler; | 1817 | Lisp_Object handler; |
| @@ -3802,9 +3805,7 @@ variable `last-coding-system-used' to the coding system actually used. */) | |||
| 3802 | /* For a special file, all we can do is guess. */ | 3805 | /* For a special file, all we can do is guess. */ |
| 3803 | total = READ_BUF_SIZE; | 3806 | total = READ_BUF_SIZE; |
| 3804 | 3807 | ||
| 3805 | /* FIXME: This if-statement is a no-op, because 'inserted' must be zero here | 3808 | if (NILP (visit) && total > 0) |
| 3806 | (Bug#8496). */ | ||
| 3807 | if (NILP (visit) && inserted > 0) | ||
| 3808 | { | 3809 | { |
| 3809 | #ifdef CLASH_DETECTION | 3810 | #ifdef CLASH_DETECTION |
| 3810 | if (!NILP (BVAR (current_buffer, file_truename)) | 3811 | if (!NILP (BVAR (current_buffer, file_truename)) |
| @@ -3914,7 +3915,6 @@ variable `last-coding-system-used' to the coding system actually used. */) | |||
| 3914 | if (inserted == 0) | 3915 | if (inserted == 0) |
| 3915 | { | 3916 | { |
| 3916 | #ifdef CLASH_DETECTION | 3917 | #ifdef CLASH_DETECTION |
| 3917 | /* FIXME: This code is a no-op, too (Bug#8496). */ | ||
| 3918 | if (we_locked_file) | 3918 | if (we_locked_file) |
| 3919 | unlock_file (BVAR (current_buffer, file_truename)); | 3919 | unlock_file (BVAR (current_buffer, file_truename)); |
| 3920 | #endif | 3920 | #endif |
| @@ -4799,11 +4799,13 @@ build_annotations (Lisp_Object start, Lisp_Object end) | |||
| 4799 | The return value is negative in case of system call failure. */ | 4799 | The return value is negative in case of system call failure. */ |
| 4800 | 4800 | ||
| 4801 | static int | 4801 | static int |
| 4802 | a_write (int desc, Lisp_Object string, int pos, register int nchars, Lisp_Object *annot, struct coding_system *coding) | 4802 | a_write (int desc, Lisp_Object string, EMACS_INT pos, |
| 4803 | register EMACS_INT nchars, Lisp_Object *annot, | ||
| 4804 | struct coding_system *coding) | ||
| 4803 | { | 4805 | { |
| 4804 | Lisp_Object tem; | 4806 | Lisp_Object tem; |
| 4805 | int nextpos; | 4807 | EMACS_INT nextpos; |
| 4806 | int lastpos = pos + nchars; | 4808 | EMACS_INT lastpos = pos + nchars; |
| 4807 | 4809 | ||
| 4808 | while (NILP (*annot) || CONSP (*annot)) | 4810 | while (NILP (*annot) || CONSP (*annot)) |
| 4809 | { | 4811 | { |
| @@ -4843,7 +4845,8 @@ a_write (int desc, Lisp_Object string, int pos, register int nchars, Lisp_Object | |||
| 4843 | are indexes to the string STRING. */ | 4845 | are indexes to the string STRING. */ |
| 4844 | 4846 | ||
| 4845 | static int | 4847 | static int |
| 4846 | e_write (int desc, Lisp_Object string, int start, int end, struct coding_system *coding) | 4848 | e_write (int desc, Lisp_Object string, EMACS_INT start, EMACS_INT end, |
| 4849 | struct coding_system *coding) | ||
| 4847 | { | 4850 | { |
| 4848 | if (STRINGP (string)) | 4851 | if (STRINGP (string)) |
| 4849 | { | 4852 | { |
| @@ -4874,8 +4877,8 @@ e_write (int desc, Lisp_Object string, int start, int end, struct coding_system | |||
| 4874 | } | 4877 | } |
| 4875 | else | 4878 | else |
| 4876 | { | 4879 | { |
| 4877 | int start_byte = CHAR_TO_BYTE (start); | 4880 | EMACS_INT start_byte = CHAR_TO_BYTE (start); |
| 4878 | int end_byte = CHAR_TO_BYTE (end); | 4881 | EMACS_INT end_byte = CHAR_TO_BYTE (end); |
| 4879 | 4882 | ||
| 4880 | coding->src_multibyte = (end - start) < (end_byte - start_byte); | 4883 | coding->src_multibyte = (end - start) < (end_byte - start_byte); |
| 4881 | if (CODING_REQUIRE_ENCODING (coding)) | 4884 | if (CODING_REQUIRE_ENCODING (coding)) |
diff --git a/src/keyboard.c b/src/keyboard.c index 28e7e5bd463..7895d05b34f 100644 --- a/src/keyboard.c +++ b/src/keyboard.c | |||
| @@ -8270,7 +8270,7 @@ parse_tool_bar_item (Lisp_Object key, Lisp_Object item) | |||
| 8270 | PROP (TOOL_BAR_ITEM_LABEL) = new_lbl; | 8270 | PROP (TOOL_BAR_ITEM_LABEL) = new_lbl; |
| 8271 | else | 8271 | else |
| 8272 | PROP (TOOL_BAR_ITEM_LABEL) = make_string ("", 0); | 8272 | PROP (TOOL_BAR_ITEM_LABEL) = make_string ("", 0); |
| 8273 | free (buf); | 8273 | xfree (buf); |
| 8274 | } | 8274 | } |
| 8275 | 8275 | ||
| 8276 | /* If got a filter apply it on binding. */ | 8276 | /* If got a filter apply it on binding. */ |
diff --git a/src/lisp.h b/src/lisp.h index 09830a980f2..8b8e25eb689 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -3316,8 +3316,8 @@ extern long get_random (void); | |||
| 3316 | extern void seed_random (long); | 3316 | extern void seed_random (long); |
| 3317 | extern int emacs_open (const char *, int, int); | 3317 | extern int emacs_open (const char *, int, int); |
| 3318 | extern int emacs_close (int); | 3318 | extern int emacs_close (int); |
| 3319 | extern int emacs_read (int, char *, unsigned int); | 3319 | extern ssize_t emacs_read (int, char *, size_t); |
| 3320 | extern int emacs_write (int, const char *, unsigned int); | 3320 | extern ssize_t emacs_write (int, const char *, size_t); |
| 3321 | enum { READLINK_BUFSIZE = 1024 }; | 3321 | enum { READLINK_BUFSIZE = 1024 }; |
| 3322 | extern char *emacs_readlink (const char *, char [READLINK_BUFSIZE]); | 3322 | extern char *emacs_readlink (const char *, char [READLINK_BUFSIZE]); |
| 3323 | #ifndef HAVE_MEMSET | 3323 | #ifndef HAVE_MEMSET |
diff --git a/src/sound.c b/src/sound.c index e121b5e37f3..697e81c814b 100644 --- a/src/sound.c +++ b/src/sound.c | |||
| @@ -460,8 +460,8 @@ sound_cleanup (Lisp_Object arg) | |||
| 460 | current_sound_device->close (current_sound_device); | 460 | current_sound_device->close (current_sound_device); |
| 461 | if (current_sound->fd > 0) | 461 | if (current_sound->fd > 0) |
| 462 | emacs_close (current_sound->fd); | 462 | emacs_close (current_sound->fd); |
| 463 | free (current_sound_device); | 463 | xfree (current_sound_device); |
| 464 | free (current_sound); | 464 | xfree (current_sound); |
| 465 | 465 | ||
| 466 | return Qnil; | 466 | return Qnil; |
| 467 | } | 467 | } |
| @@ -897,7 +897,7 @@ vox_init (struct sound_device *sd) | |||
| 897 | static void | 897 | static void |
| 898 | vox_write (struct sound_device *sd, const char *buffer, int nbytes) | 898 | vox_write (struct sound_device *sd, const char *buffer, int nbytes) |
| 899 | { | 899 | { |
| 900 | int nwritten = emacs_write (sd->fd, buffer, nbytes); | 900 | ssize_t nwritten = emacs_write (sd->fd, buffer, nbytes); |
| 901 | if (nwritten < 0) | 901 | if (nwritten < 0) |
| 902 | sound_perror ("Error writing to sound device"); | 902 | sound_perror ("Error writing to sound device"); |
| 903 | } | 903 | } |
| @@ -1095,7 +1095,7 @@ alsa_close (struct sound_device *sd) | |||
| 1095 | snd_pcm_drain (p->handle); | 1095 | snd_pcm_drain (p->handle); |
| 1096 | snd_pcm_close (p->handle); | 1096 | snd_pcm_close (p->handle); |
| 1097 | } | 1097 | } |
| 1098 | free (p); | 1098 | xfree (p); |
| 1099 | } | 1099 | } |
| 1100 | } | 1100 | } |
| 1101 | 1101 | ||
diff --git a/src/sysdep.c b/src/sysdep.c index 3dc255933ee..0d9b31f35cd 100644 --- a/src/sysdep.c +++ b/src/sysdep.c | |||
| @@ -1825,10 +1825,18 @@ emacs_close (int fd) | |||
| 1825 | return rtnval; | 1825 | return rtnval; |
| 1826 | } | 1826 | } |
| 1827 | 1827 | ||
| 1828 | int | 1828 | ssize_t |
| 1829 | emacs_read (int fildes, char *buf, unsigned int nbyte) | 1829 | emacs_read (int fildes, char *buf, size_t nbyte) |
| 1830 | { | 1830 | { |
| 1831 | register int rtnval; | 1831 | register ssize_t rtnval; |
| 1832 | |||
| 1833 | /* Defend against the possibility that a buggy caller passes a negative NBYTE | ||
| 1834 | argument, which would be converted to a large unsigned size_t NBYTE. This | ||
| 1835 | defense prevents callers from doing large writes, unfortunately. This | ||
| 1836 | size restriction can be removed once we have carefully checked that there | ||
| 1837 | are no such callers. */ | ||
| 1838 | if ((ssize_t) nbyte < 0) | ||
| 1839 | abort (); | ||
| 1832 | 1840 | ||
| 1833 | while ((rtnval = read (fildes, buf, nbyte)) == -1 | 1841 | while ((rtnval = read (fildes, buf, nbyte)) == -1 |
| 1834 | && (errno == EINTR)) | 1842 | && (errno == EINTR)) |
| @@ -1836,14 +1844,18 @@ emacs_read (int fildes, char *buf, unsigned int nbyte) | |||
| 1836 | return (rtnval); | 1844 | return (rtnval); |
| 1837 | } | 1845 | } |
| 1838 | 1846 | ||
| 1839 | int | 1847 | ssize_t |
| 1840 | emacs_write (int fildes, const char *buf, unsigned int nbyte) | 1848 | emacs_write (int fildes, const char *buf, size_t nbyte) |
| 1841 | { | 1849 | { |
| 1842 | register int rtnval, bytes_written; | 1850 | register ssize_t rtnval, bytes_written; |
| 1851 | |||
| 1852 | /* Defend against negative NBYTE, as in emacs_read. */ | ||
| 1853 | if ((ssize_t) nbyte < 0) | ||
| 1854 | abort (); | ||
| 1843 | 1855 | ||
| 1844 | bytes_written = 0; | 1856 | bytes_written = 0; |
| 1845 | 1857 | ||
| 1846 | while (nbyte > 0) | 1858 | while (nbyte != 0) |
| 1847 | { | 1859 | { |
| 1848 | rtnval = write (fildes, buf, nbyte); | 1860 | rtnval = write (fildes, buf, nbyte); |
| 1849 | 1861 | ||
diff --git a/src/termcap.c b/src/termcap.c index 27a20a67ae1..5b71ad229d7 100644 --- a/src/termcap.c +++ b/src/termcap.c | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /* Work-alike for termcap, plus extra features. | 1 | /* Work-alike for termcap, plus extra features. |
| 2 | Copyright (C) 1985, 1986, 1993, 1994, 1995, 2000, 2001, 2002, 2003, | 2 | Copyright (C) 1985, 1986, 1993, 1994, 1995, 2000, 2001, 2002, 2003, |
| 3 | 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. | 3 | 2004, 2005, 2006, 2007, 2008, 2011 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
| 6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
| @@ -468,15 +468,15 @@ tgetent (char *bp, const char *name) | |||
| 468 | if (scan_file (term, fd, &buf) == 0) | 468 | if (scan_file (term, fd, &buf) == 0) |
| 469 | { | 469 | { |
| 470 | close (fd); | 470 | close (fd); |
| 471 | free (buf.beg); | 471 | xfree (buf.beg); |
| 472 | if (malloc_size) | 472 | if (malloc_size) |
| 473 | free (bp); | 473 | xfree (bp); |
| 474 | return 0; | 474 | return 0; |
| 475 | } | 475 | } |
| 476 | 476 | ||
| 477 | /* Free old `term' if appropriate. */ | 477 | /* Free old `term' if appropriate. */ |
| 478 | if (term != name) | 478 | if (term != name) |
| 479 | free (term); | 479 | xfree (term); |
| 480 | 480 | ||
| 481 | /* If BP is malloc'd by us, make sure it is big enough. */ | 481 | /* If BP is malloc'd by us, make sure it is big enough. */ |
| 482 | if (malloc_size) | 482 | if (malloc_size) |
| @@ -506,7 +506,7 @@ tgetent (char *bp, const char *name) | |||
| 506 | } | 506 | } |
| 507 | 507 | ||
| 508 | close (fd); | 508 | close (fd); |
| 509 | free (buf.beg); | 509 | xfree (buf.beg); |
| 510 | 510 | ||
| 511 | if (malloc_size) | 511 | if (malloc_size) |
| 512 | bp = (char *) xrealloc (bp, bp1 - bp + 1); | 512 | bp = (char *) xrealloc (bp, bp1 - bp + 1); |
diff --git a/src/xdisp.c b/src/xdisp.c index 3370d84d67f..4f1830f4c6c 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -3617,7 +3617,7 @@ handle_invisible_prop (struct it *it) | |||
| 3617 | _after_ bidi iteration avoids affecting the visual | 3617 | _after_ bidi iteration avoids affecting the visual |
| 3618 | order of the displayed text when invisible properties | 3618 | order of the displayed text when invisible properties |
| 3619 | are added or removed. */ | 3619 | are added or removed. */ |
| 3620 | if (it->bidi_it.first_elt) | 3620 | if (it->bidi_it.first_elt && it->bidi_it.charpos < ZV) |
| 3621 | { | 3621 | { |
| 3622 | /* If we were `reseat'ed to a new paragraph, | 3622 | /* If we were `reseat'ed to a new paragraph, |
| 3623 | determine the paragraph base direction. We need | 3623 | determine the paragraph base direction. We need |
| @@ -8374,10 +8374,13 @@ vmessage (const char *m, va_list ap) | |||
| 8374 | 8374 | ||
| 8375 | /* Do any truncation at a character boundary. */ | 8375 | /* Do any truncation at a character boundary. */ |
| 8376 | if (! (0 <= len && len < bufsize)) | 8376 | if (! (0 <= len && len < bufsize)) |
| 8377 | for (len = strnlen (buf, bufsize); | 8377 | { |
| 8378 | len && ! CHAR_HEAD_P (buf[len - 1]); | 8378 | char *end = memchr (buf, 0, bufsize); |
| 8379 | len--) | 8379 | for (len = end ? end - buf : bufsize; |
| 8380 | continue; | 8380 | len && ! CHAR_HEAD_P (buf[len - 1]); |
| 8381 | len--) | ||
| 8382 | continue; | ||
| 8383 | } | ||
| 8381 | 8384 | ||
| 8382 | message2 (FRAME_MESSAGE_BUF (f), len, 0); | 8385 | message2 (FRAME_MESSAGE_BUF (f), len, 0); |
| 8383 | } | 8386 | } |
| @@ -14206,7 +14209,14 @@ redisplay_window (Lisp_Object window, int just_this_one_p) | |||
| 14206 | 14209 | ||
| 14207 | /* If there is a scroll margin at the top of the window, find | 14210 | /* If there is a scroll margin at the top of the window, find |
| 14208 | its character position. */ | 14211 | its character position. */ |
| 14209 | if (margin) | 14212 | if (margin |
| 14213 | /* Cannot call start_display if startp is not in the | ||
| 14214 | accessible region of the buffer. This can happen when we | ||
| 14215 | have just switched to a different buffer and/or changed | ||
| 14216 | its restriction. In that case, startp is initialized to | ||
| 14217 | the character position 1 (BEG) because we did not yet | ||
| 14218 | have chance to display the buffer even once. */ | ||
| 14219 | && BEGV <= CHARPOS (startp) && CHARPOS (startp) <= ZV) | ||
| 14210 | { | 14220 | { |
| 14211 | struct it it1; | 14221 | struct it it1; |
| 14212 | 14222 | ||
diff --git a/src/xfns.c b/src/xfns.c index 1182ef8e770..290b6161215 100644 --- a/src/xfns.c +++ b/src/xfns.c | |||
| @@ -2958,7 +2958,7 @@ x_default_font_parameter (struct frame *f, Lisp_Object parms) | |||
| 2958 | { | 2958 | { |
| 2959 | char *name = xstrdup (system_font); | 2959 | char *name = xstrdup (system_font); |
| 2960 | font = font_open_by_name (f, name); | 2960 | font = font_open_by_name (f, name); |
| 2961 | free (name); | 2961 | xfree (name); |
| 2962 | } | 2962 | } |
| 2963 | } | 2963 | } |
| 2964 | 2964 | ||
diff --git a/src/xsettings.c b/src/xsettings.c index d09b702a428..2513bcc5aa8 100644 --- a/src/xsettings.c +++ b/src/xsettings.c | |||
| @@ -566,20 +566,20 @@ read_and_apply_settings (struct x_display_info *dpyinfo, int send_event_p) | |||
| 566 | if (send_event_p) | 566 | if (send_event_p) |
| 567 | store_config_changed_event (Qtool_bar_style, dpyname); | 567 | store_config_changed_event (Qtool_bar_style, dpyname); |
| 568 | } | 568 | } |
| 569 | free (settings.tb_style); | 569 | xfree (settings.tb_style); |
| 570 | } | 570 | } |
| 571 | 571 | ||
| 572 | if (settings.seen & SEEN_FONT) | 572 | if (settings.seen & SEEN_FONT) |
| 573 | { | 573 | { |
| 574 | if (!current_font || strcmp (current_font, settings.font) != 0) | 574 | if (!current_font || strcmp (current_font, settings.font) != 0) |
| 575 | { | 575 | { |
| 576 | free (current_font); | 576 | xfree (current_font); |
| 577 | current_font = settings.font; | 577 | current_font = settings.font; |
| 578 | if (send_event_p) | 578 | if (send_event_p) |
| 579 | store_config_changed_event (Qfont_name, dpyname); | 579 | store_config_changed_event (Qfont_name, dpyname); |
| 580 | } | 580 | } |
| 581 | else | 581 | else |
| 582 | free (settings.font); | 582 | xfree (settings.font); |
| 583 | } | 583 | } |
| 584 | } | 584 | } |
| 585 | 585 | ||