diff options
| author | Joakim Verona | 2011-10-02 09:44:26 +0200 |
|---|---|---|
| committer | Joakim Verona | 2011-10-02 09:44:26 +0200 |
| commit | 6ae1821f00fdc051a2c6b41d83afe9151c6093c1 (patch) | |
| tree | 931bee24ca25305ce4d6b4ea0fc48439b85ef6f8 /src | |
| parent | 7a982f9eef56799ebe5857f7b8b3e636c6715090 (diff) | |
| parent | 32c1fffd728cfed8427d144bf7c622257aad859f (diff) | |
| download | emacs-6ae1821f00fdc051a2c6b41d83afe9151c6093c1.tar.gz emacs-6ae1821f00fdc051a2c6b41d83afe9151c6093c1.zip | |
upstream
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 74 | ||||
| -rw-r--r-- | src/alloc.c | 68 | ||||
| -rw-r--r-- | src/buffer.c | 2 | ||||
| -rw-r--r-- | src/buffer.h | 4 | ||||
| -rw-r--r-- | src/charset.c | 36 | ||||
| -rw-r--r-- | src/dired.c | 3 | ||||
| -rw-r--r-- | src/fileio.c | 6 | ||||
| -rw-r--r-- | src/keymap.c | 7 | ||||
| -rw-r--r-- | src/minibuf.c | 4 | ||||
| -rw-r--r-- | src/nsterm.m | 18 | ||||
| -rw-r--r-- | src/sysdep.c | 4 |
11 files changed, 174 insertions, 52 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index f26754d1135..bc9ffc8f3fe 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,77 @@ | |||
| 1 | 2011-10-02 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | * dired.c (file_name_completion): Don't expand file name. | ||
| 4 | (Ffile_name_completion, Ffile_name_all_completions): Expand file name | ||
| 5 | before checking file name handler. | ||
| 6 | |||
| 7 | * minibuf.c (Finternal_complete_buffer): Only show internal buffers if | ||
| 8 | they've been requested explicitly (bug#9591). | ||
| 9 | |||
| 10 | 2011-10-01 Andreas Schwab <schwab@linux-m68k.org> | ||
| 11 | |||
| 12 | * keymap.c (Fsingle_key_description): Use make_specified_string | ||
| 13 | instead of build_string to build string from push_key_description. | ||
| 14 | (Bug#5193) | ||
| 15 | |||
| 16 | 2011-09-30 Paul Eggert <eggert@cs.ucla.edu> | ||
| 17 | |||
| 18 | * buffer.h (struct buffer): Use time_t, not int, for a time stamp. | ||
| 19 | This fixes a Y2038 bug on 64-bit hosts. | ||
| 20 | * buffer.c (reset_buffer): | ||
| 21 | * fileio.c (Fdo_auto_save, Fset_buffer_auto_saved) | ||
| 22 | (Fclear_buffer_auto_save_failure): | ||
| 23 | Use 0, not -1, to represent an unset failure time, since time_t | ||
| 24 | might not be signed. | ||
| 25 | |||
| 26 | Remove dependency on glibc malloc internals. | ||
| 27 | * alloc.c (XMALLOC_OVERRUN_CHECK_OVERHEAD, XMALLOC_OVERRUN_CHECK_SIZE): | ||
| 28 | Move back here from lisp.h, but with their new implementations. | ||
| 29 | (XMALLOC_BASE_ALIGNMENT, COMMON_MULTIPLE, XMALLOC_HEADER_ALIGNMENT) | ||
| 30 | (XMALLOC_OVERRUN_SIZE_SIZE): Move these new lisp.h macros here. | ||
| 31 | * charset.c (charset_table_init): New static var. | ||
| 32 | (syms_of_charset): Use it instead of xmalloc. This removes a | ||
| 33 | dependency on glibc malloc internals. See Eli Zaretskii's comment in | ||
| 34 | <http://lists.gnu.org/archive/html/emacs-devel/2011-09/msg00815.html>. | ||
| 35 | * lisp.h (XMALLOC_OVERRUN_CHECK_OVERHEAD, XMALLOC_OVERRUN_CHECK_SIZE): | ||
| 36 | Move back to alloc.c. | ||
| 37 | (XMALLOC_BASE_ALIGNMENT, COMMON_MULTIPLE, XMALLOC_HEADER_ALIGNMENT) | ||
| 38 | (XMALLOC_OVERRUN_SIZE_SIZE): Move to alloc.c. | ||
| 39 | |||
| 40 | 2011-09-30 Jan Djärv <jan.h.d@swipnet.se> | ||
| 41 | |||
| 42 | * nsterm.m (windowDidResize): Call x_set_window_size only when | ||
| 43 | ns_in_resize is true. Otherwise set pixelwidth/height and | ||
| 44 | call change_frame_size (Bug#9628). | ||
| 45 | |||
| 46 | 2011-09-30 Paul Eggert <eggert@cs.ucla.edu> | ||
| 47 | |||
| 48 | Port --enable-checking=all to Fedora 14 x86-64. | ||
| 49 | * charset.c (syms_of_charset): Also account for glibc malloc's | ||
| 50 | internal overhead when calculating the initial malloc maximum. | ||
| 51 | |||
| 52 | Port --enable-checking=all to Fedora 14 x86. | ||
| 53 | * alloc.c (XMALLOC_OVERRUN_CHECK_OVERHEAD, XMALLOC_OVERRUN_CHECK_SIZE): | ||
| 54 | Move to lisp.h. | ||
| 55 | (xmalloc_put_size, xmalloc_get_size, overrun_check_malloc) | ||
| 56 | (overrun_check_realloc, overrun_check_free): | ||
| 57 | Use XMALLOC_OVERRUN_SIZE_SIZE, not sizeof (size_t). | ||
| 58 | That way, xmalloc returns a properly-aligned pointer even if | ||
| 59 | XMALLOC_OVERRUN_CHECK is defined. The old debugging code happened | ||
| 60 | to align OK on typical 64-bit hosts, but not on Fedora 14 x86. | ||
| 61 | * charset.c (syms_of_charset): Take XMALLOC_OVERRUN_CHECK_OVERHEAD | ||
| 62 | into account when calculating the initial malloc maximum. | ||
| 63 | * lisp.h (XMALLOC_OVERRUN_CHECK_OVERHEAD, XMALLOC_OVERRUN_CHECK_SIZE): | ||
| 64 | Move here from alloc.c, so that charset.c can use it too. | ||
| 65 | Properly align; the old code wasn't right for common 32-bit hosts | ||
| 66 | when configured with --enable-checking=all. | ||
| 67 | (XMALLOC_BASE_ALIGNMENT, COMMON_MULTIPLE, XMALLOC_HEADER_ALIGNMENT) | ||
| 68 | (XMALLOC_OVERRUN_SIZE_SIZE): New macros. | ||
| 69 | |||
| 70 | 2011-09-29 Eli Zaretskii <eliz@gnu.org> | ||
| 71 | |||
| 72 | * sysdep.c (snprintf) [!EOVERFLOW]: If EOVERFLOW is not defined, | ||
| 73 | use EDOM. | ||
| 74 | |||
| 1 | 2011-09-28 Eli Zaretskii <eliz@gnu.org> | 75 | 2011-09-28 Eli Zaretskii <eliz@gnu.org> |
| 2 | 76 | ||
| 3 | * xdisp.c (compute_display_string_end): If there's no display | 77 | * xdisp.c (compute_display_string_end): If there's no display |
diff --git a/src/alloc.c b/src/alloc.c index ad1741e308f..ead5c8a8ca4 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -490,19 +490,45 @@ buffer_memory_full (EMACS_INT nbytes) | |||
| 490 | /* Check for overrun in malloc'ed buffers by wrapping a header and trailer | 490 | /* Check for overrun in malloc'ed buffers by wrapping a header and trailer |
| 491 | around each block. | 491 | around each block. |
| 492 | 492 | ||
| 493 | The header consists of 16 fixed bytes followed by sizeof (size_t) bytes | 493 | The header consists of XMALLOC_OVERRUN_CHECK_SIZE fixed bytes |
| 494 | containing the original block size in little-endian order, | 494 | followed by XMALLOC_OVERRUN_SIZE_SIZE bytes containing the original |
| 495 | while the trailer consists of 16 fixed bytes. | 495 | block size in little-endian order. The trailer consists of |
| 496 | XMALLOC_OVERRUN_CHECK_SIZE fixed bytes. | ||
| 496 | 497 | ||
| 497 | The header is used to detect whether this block has been allocated | 498 | The header is used to detect whether this block has been allocated |
| 498 | through these functions -- as it seems that some low-level libc | 499 | through these functions, as some low-level libc functions may |
| 499 | functions may bypass the malloc hooks. | 500 | bypass the malloc hooks. */ |
| 500 | */ | ||
| 501 | |||
| 502 | 501 | ||
| 503 | #define XMALLOC_OVERRUN_CHECK_SIZE 16 | 502 | #define XMALLOC_OVERRUN_CHECK_SIZE 16 |
| 504 | #define XMALLOC_OVERRUN_CHECK_OVERHEAD \ | 503 | #define XMALLOC_OVERRUN_CHECK_OVERHEAD \ |
| 505 | (2 * XMALLOC_OVERRUN_CHECK_SIZE + sizeof (size_t)) | 504 | (2 * XMALLOC_OVERRUN_CHECK_SIZE + XMALLOC_OVERRUN_SIZE_SIZE) |
| 505 | |||
| 506 | /* Define XMALLOC_OVERRUN_SIZE_SIZE so that (1) it's large enough to | ||
| 507 | hold a size_t value and (2) the header size is a multiple of the | ||
| 508 | alignment that Emacs needs for C types and for USE_LSB_TAG. */ | ||
| 509 | #define XMALLOC_BASE_ALIGNMENT \ | ||
| 510 | offsetof ( \ | ||
| 511 | struct { \ | ||
| 512 | union { long double d; intmax_t i; void *p; } u; \ | ||
| 513 | char c; \ | ||
| 514 | }, \ | ||
| 515 | c) | ||
| 516 | #ifdef USE_LSB_TAG | ||
| 517 | /* A common multiple of the positive integers A and B. Ideally this | ||
| 518 | would be the least common multiple, but there's no way to do that | ||
| 519 | as a constant expression in C, so do the best that we can easily do. */ | ||
| 520 | # define COMMON_MULTIPLE(a, b) \ | ||
| 521 | ((a) % (b) == 0 ? (a) : (b) % (a) == 0 ? (b) : (a) * (b)) | ||
| 522 | # define XMALLOC_HEADER_ALIGNMENT \ | ||
| 523 | COMMON_MULTIPLE (1 << GCTYPEBITS, XMALLOC_BASE_ALIGNMENT) | ||
| 524 | #else | ||
| 525 | # define XMALLOC_HEADER_ALIGNMENT XMALLOC_BASE_ALIGNMENT | ||
| 526 | #endif | ||
| 527 | #define XMALLOC_OVERRUN_SIZE_SIZE \ | ||
| 528 | (((XMALLOC_OVERRUN_CHECK_SIZE + sizeof (size_t) \ | ||
| 529 | + XMALLOC_HEADER_ALIGNMENT - 1) \ | ||
| 530 | / XMALLOC_HEADER_ALIGNMENT * XMALLOC_HEADER_ALIGNMENT) \ | ||
| 531 | - XMALLOC_OVERRUN_CHECK_SIZE) | ||
| 506 | 532 | ||
| 507 | static char const xmalloc_overrun_check_header[XMALLOC_OVERRUN_CHECK_SIZE] = | 533 | static char const xmalloc_overrun_check_header[XMALLOC_OVERRUN_CHECK_SIZE] = |
| 508 | { '\x9a', '\x9b', '\xae', '\xaf', | 534 | { '\x9a', '\x9b', '\xae', '\xaf', |
| @@ -522,9 +548,9 @@ static void | |||
| 522 | xmalloc_put_size (unsigned char *ptr, size_t size) | 548 | xmalloc_put_size (unsigned char *ptr, size_t size) |
| 523 | { | 549 | { |
| 524 | int i; | 550 | int i; |
| 525 | for (i = 0; i < sizeof (size_t); i++) | 551 | for (i = 0; i < XMALLOC_OVERRUN_SIZE_SIZE; i++) |
| 526 | { | 552 | { |
| 527 | *--ptr = size & (1 << CHAR_BIT) - 1; | 553 | *--ptr = size & ((1 << CHAR_BIT) - 1); |
| 528 | size >>= CHAR_BIT; | 554 | size >>= CHAR_BIT; |
| 529 | } | 555 | } |
| 530 | } | 556 | } |
| @@ -534,8 +560,8 @@ xmalloc_get_size (unsigned char *ptr) | |||
| 534 | { | 560 | { |
| 535 | size_t size = 0; | 561 | size_t size = 0; |
| 536 | int i; | 562 | int i; |
| 537 | ptr -= sizeof (size_t); | 563 | ptr -= XMALLOC_OVERRUN_SIZE_SIZE; |
| 538 | for (i = 0; i < sizeof (size_t); i++) | 564 | for (i = 0; i < XMALLOC_OVERRUN_SIZE_SIZE; i++) |
| 539 | { | 565 | { |
| 540 | size <<= CHAR_BIT; | 566 | size <<= CHAR_BIT; |
| 541 | size += *ptr++; | 567 | size += *ptr++; |
| @@ -579,7 +605,7 @@ overrun_check_malloc (size_t size) | |||
| 579 | if (val && check_depth == 1) | 605 | if (val && check_depth == 1) |
| 580 | { | 606 | { |
| 581 | memcpy (val, xmalloc_overrun_check_header, XMALLOC_OVERRUN_CHECK_SIZE); | 607 | memcpy (val, xmalloc_overrun_check_header, XMALLOC_OVERRUN_CHECK_SIZE); |
| 582 | val += XMALLOC_OVERRUN_CHECK_SIZE + sizeof (size_t); | 608 | val += XMALLOC_OVERRUN_CHECK_SIZE + XMALLOC_OVERRUN_SIZE_SIZE; |
| 583 | xmalloc_put_size (val, size); | 609 | xmalloc_put_size (val, size); |
| 584 | memcpy (val + size, xmalloc_overrun_check_trailer, | 610 | memcpy (val + size, xmalloc_overrun_check_trailer, |
| 585 | XMALLOC_OVERRUN_CHECK_SIZE); | 611 | XMALLOC_OVERRUN_CHECK_SIZE); |
| @@ -603,7 +629,7 @@ overrun_check_realloc (POINTER_TYPE *block, size_t size) | |||
| 603 | if (val | 629 | if (val |
| 604 | && check_depth == 1 | 630 | && check_depth == 1 |
| 605 | && memcmp (xmalloc_overrun_check_header, | 631 | && memcmp (xmalloc_overrun_check_header, |
| 606 | val - XMALLOC_OVERRUN_CHECK_SIZE - sizeof (size_t), | 632 | val - XMALLOC_OVERRUN_CHECK_SIZE - XMALLOC_OVERRUN_SIZE_SIZE, |
| 607 | XMALLOC_OVERRUN_CHECK_SIZE) == 0) | 633 | XMALLOC_OVERRUN_CHECK_SIZE) == 0) |
| 608 | { | 634 | { |
| 609 | size_t osize = xmalloc_get_size (val); | 635 | size_t osize = xmalloc_get_size (val); |
| @@ -611,8 +637,8 @@ overrun_check_realloc (POINTER_TYPE *block, size_t size) | |||
| 611 | XMALLOC_OVERRUN_CHECK_SIZE)) | 637 | XMALLOC_OVERRUN_CHECK_SIZE)) |
| 612 | abort (); | 638 | abort (); |
| 613 | memset (val + osize, 0, XMALLOC_OVERRUN_CHECK_SIZE); | 639 | memset (val + osize, 0, XMALLOC_OVERRUN_CHECK_SIZE); |
| 614 | val -= XMALLOC_OVERRUN_CHECK_SIZE + sizeof (size_t); | 640 | val -= XMALLOC_OVERRUN_CHECK_SIZE + XMALLOC_OVERRUN_SIZE_SIZE; |
| 615 | memset (val, 0, XMALLOC_OVERRUN_CHECK_SIZE + sizeof (size_t)); | 641 | memset (val, 0, XMALLOC_OVERRUN_CHECK_SIZE + XMALLOC_OVERRUN_SIZE_SIZE); |
| 616 | } | 642 | } |
| 617 | 643 | ||
| 618 | val = (unsigned char *) realloc ((POINTER_TYPE *)val, size + overhead); | 644 | val = (unsigned char *) realloc ((POINTER_TYPE *)val, size + overhead); |
| @@ -620,7 +646,7 @@ overrun_check_realloc (POINTER_TYPE *block, size_t size) | |||
| 620 | if (val && check_depth == 1) | 646 | if (val && check_depth == 1) |
| 621 | { | 647 | { |
| 622 | memcpy (val, xmalloc_overrun_check_header, XMALLOC_OVERRUN_CHECK_SIZE); | 648 | memcpy (val, xmalloc_overrun_check_header, XMALLOC_OVERRUN_CHECK_SIZE); |
| 623 | val += XMALLOC_OVERRUN_CHECK_SIZE + sizeof (size_t); | 649 | val += XMALLOC_OVERRUN_CHECK_SIZE + XMALLOC_OVERRUN_SIZE_SIZE; |
| 624 | xmalloc_put_size (val, size); | 650 | xmalloc_put_size (val, size); |
| 625 | memcpy (val + size, xmalloc_overrun_check_trailer, | 651 | memcpy (val + size, xmalloc_overrun_check_trailer, |
| 626 | XMALLOC_OVERRUN_CHECK_SIZE); | 652 | XMALLOC_OVERRUN_CHECK_SIZE); |
| @@ -640,7 +666,7 @@ overrun_check_free (POINTER_TYPE *block) | |||
| 640 | if (val | 666 | if (val |
| 641 | && check_depth == 1 | 667 | && check_depth == 1 |
| 642 | && memcmp (xmalloc_overrun_check_header, | 668 | && memcmp (xmalloc_overrun_check_header, |
| 643 | val - XMALLOC_OVERRUN_CHECK_SIZE - sizeof (size_t), | 669 | val - XMALLOC_OVERRUN_CHECK_SIZE - XMALLOC_OVERRUN_SIZE_SIZE, |
| 644 | XMALLOC_OVERRUN_CHECK_SIZE) == 0) | 670 | XMALLOC_OVERRUN_CHECK_SIZE) == 0) |
| 645 | { | 671 | { |
| 646 | size_t osize = xmalloc_get_size (val); | 672 | size_t osize = xmalloc_get_size (val); |
| @@ -648,12 +674,12 @@ overrun_check_free (POINTER_TYPE *block) | |||
| 648 | XMALLOC_OVERRUN_CHECK_SIZE)) | 674 | XMALLOC_OVERRUN_CHECK_SIZE)) |
| 649 | abort (); | 675 | abort (); |
| 650 | #ifdef XMALLOC_CLEAR_FREE_MEMORY | 676 | #ifdef XMALLOC_CLEAR_FREE_MEMORY |
| 651 | val -= XMALLOC_OVERRUN_CHECK_SIZE + sizeof (size_t); | 677 | val -= XMALLOC_OVERRUN_CHECK_SIZE + XMALLOC_OVERRUN_SIZE_SIZE; |
| 652 | memset (val, 0xff, osize + XMALLOC_OVERRUN_CHECK_OVERHEAD); | 678 | memset (val, 0xff, osize + XMALLOC_OVERRUN_CHECK_OVERHEAD); |
| 653 | #else | 679 | #else |
| 654 | memset (val + osize, 0, XMALLOC_OVERRUN_CHECK_SIZE); | 680 | memset (val + osize, 0, XMALLOC_OVERRUN_CHECK_SIZE); |
| 655 | val -= XMALLOC_OVERRUN_CHECK_SIZE + sizeof (size_t); | 681 | val -= XMALLOC_OVERRUN_CHECK_SIZE + XMALLOC_OVERRUN_SIZE_SIZE; |
| 656 | memset (val, 0, XMALLOC_OVERRUN_CHECK_SIZE + sizeof (size_t)); | 682 | memset (val, 0, XMALLOC_OVERRUN_CHECK_SIZE + XMALLOC_OVERRUN_SIZE_SIZE); |
| 657 | #endif | 683 | #endif |
| 658 | } | 684 | } |
| 659 | 685 | ||
diff --git a/src/buffer.c b/src/buffer.c index dffdeb536fc..f38c9a739a6 100644 --- a/src/buffer.c +++ b/src/buffer.c | |||
| @@ -724,7 +724,7 @@ reset_buffer (register struct buffer *b) | |||
| 724 | b->prevent_redisplay_optimizations_p = 1; | 724 | b->prevent_redisplay_optimizations_p = 1; |
| 725 | BVAR (b, backed_up) = Qnil; | 725 | BVAR (b, backed_up) = Qnil; |
| 726 | BUF_AUTOSAVE_MODIFF (b) = 0; | 726 | BUF_AUTOSAVE_MODIFF (b) = 0; |
| 727 | b->auto_save_failure_time = -1; | 727 | b->auto_save_failure_time = 0; |
| 728 | BVAR (b, auto_save_file_name) = Qnil; | 728 | BVAR (b, auto_save_file_name) = Qnil; |
| 729 | BVAR (b, read_only) = Qnil; | 729 | BVAR (b, read_only) = Qnil; |
| 730 | b->overlays_before = NULL; | 730 | b->overlays_before = NULL; |
diff --git a/src/buffer.h b/src/buffer.h index 73628fe6dfc..a6b82abf053 100644 --- a/src/buffer.h +++ b/src/buffer.h | |||
| @@ -566,8 +566,8 @@ struct buffer | |||
| 566 | Redisplay of this buffer is inhibited until it changes again. */ | 566 | Redisplay of this buffer is inhibited until it changes again. */ |
| 567 | int display_error_modiff; | 567 | int display_error_modiff; |
| 568 | /* The time at which we detected a failure to auto-save, | 568 | /* The time at which we detected a failure to auto-save, |
| 569 | Or -1 if we didn't have a failure. */ | 569 | Or 0 if we didn't have a failure. */ |
| 570 | int auto_save_failure_time; | 570 | time_t auto_save_failure_time; |
| 571 | /* Position in buffer at which display started | 571 | /* Position in buffer at which display started |
| 572 | the last time this buffer was displayed. */ | 572 | the last time this buffer was displayed. */ |
| 573 | EMACS_INT last_window_start; | 573 | EMACS_INT last_window_start; |
diff --git a/src/charset.c b/src/charset.c index 6967b9df611..8d6a3982d14 100644 --- a/src/charset.c +++ b/src/charset.c | |||
| @@ -1162,10 +1162,10 @@ usage: (define-charset-internal ...) */) | |||
| 1162 | sizeof *charset_table); | 1162 | sizeof *charset_table); |
| 1163 | memcpy (new_table, charset_table, old_size * sizeof *new_table); | 1163 | memcpy (new_table, charset_table, old_size * sizeof *new_table); |
| 1164 | charset_table = new_table; | 1164 | charset_table = new_table; |
| 1165 | /* FIXME: Doesn't this leak memory? The old charset_table becomes | 1165 | /* FIXME: This leaks memory, as the old charset_table becomes |
| 1166 | unreachable. It could be that this is intentional, because the | 1166 | unreachable. If the old charset table is charset_table_init |
| 1167 | old charset table may be in a dumped emacs, and reallocating such | 1167 | then this leak is intentional; otherwise, it's unclear. |
| 1168 | a table may not work. If the memory leak is intentional, a | 1168 | If the latter memory leak is intentional, a |
| 1169 | comment should be added to explain this. If not, the old | 1169 | comment should be added to explain this. If not, the old |
| 1170 | charset_table should be freed, by passing it as the 1st argument | 1170 | charset_table should be freed, by passing it as the 1st argument |
| 1171 | to xpalloc and removing the memcpy. */ | 1171 | to xpalloc and removing the memcpy. */ |
| @@ -2327,20 +2327,21 @@ init_charset_once (void) | |||
| 2327 | 2327 | ||
| 2328 | #ifdef emacs | 2328 | #ifdef emacs |
| 2329 | 2329 | ||
| 2330 | /* Allocate an initial charset table that is large enough to handle | ||
| 2331 | Emacs while it is bootstrapping. As of September 2011, the size | ||
| 2332 | needs to be at least 166; make it a bit bigger to allow for future | ||
| 2333 | expansion. | ||
| 2334 | |||
| 2335 | Don't make the value so small that the table is reallocated during | ||
| 2336 | bootstrapping, as glibc malloc calls larger than just under 64 KiB | ||
| 2337 | during an initial bootstrap wreak havoc after dumping; see the | ||
| 2338 | M_MMAP_THRESHOLD value in alloc.c, plus there is a extra overhead | ||
| 2339 | internal to glibc malloc and perhaps to Emacs malloc debugging. */ | ||
| 2340 | static struct charset charset_table_init[180]; | ||
| 2341 | |||
| 2330 | void | 2342 | void |
| 2331 | syms_of_charset (void) | 2343 | syms_of_charset (void) |
| 2332 | { | 2344 | { |
| 2333 | /* Allocate an initial charset table that is just under 64 KiB in size. | ||
| 2334 | This should be large enough so that the charset table need not be | ||
| 2335 | reallocated during an initial bootstrap. Allocating anything larger than | ||
| 2336 | 64 KiB in an initial run may not work, because glibc malloc might use | ||
| 2337 | mmap for larger allocations, and these don't work well across dumped | ||
| 2338 | systems. */ | ||
| 2339 | enum { | ||
| 2340 | initial_malloc_max = (1 << 16) - 1, | ||
| 2341 | charset_table_size_init = initial_malloc_max / sizeof (struct charset) | ||
| 2342 | }; | ||
| 2343 | |||
| 2344 | DEFSYM (Qcharsetp, "charsetp"); | 2345 | DEFSYM (Qcharsetp, "charsetp"); |
| 2345 | 2346 | ||
| 2346 | DEFSYM (Qascii, "ascii"); | 2347 | DEFSYM (Qascii, "ascii"); |
| @@ -2373,9 +2374,8 @@ syms_of_charset (void) | |||
| 2373 | Vcharset_hash_table = Fmake_hash_table (2, args); | 2374 | Vcharset_hash_table = Fmake_hash_table (2, args); |
| 2374 | } | 2375 | } |
| 2375 | 2376 | ||
| 2376 | charset_table = (struct charset *) xmalloc (sizeof (struct charset) | 2377 | charset_table = charset_table_init; |
| 2377 | * charset_table_size_init); | 2378 | charset_table_size = sizeof charset_table_init / sizeof *charset_table_init; |
| 2378 | charset_table_size = charset_table_size_init; | ||
| 2379 | charset_table_used = 0; | 2379 | charset_table_used = 0; |
| 2380 | 2380 | ||
| 2381 | defsubr (&Scharsetp); | 2381 | defsubr (&Scharsetp); |
diff --git a/src/dired.c b/src/dired.c index be94b16cf75..fac3a34ab9b 100644 --- a/src/dired.c +++ b/src/dired.c | |||
| @@ -401,6 +401,7 @@ determined by the variable `completion-ignored-extensions', which see. */) | |||
| 401 | (Lisp_Object file, Lisp_Object directory, Lisp_Object predicate) | 401 | (Lisp_Object file, Lisp_Object directory, Lisp_Object predicate) |
| 402 | { | 402 | { |
| 403 | Lisp_Object handler; | 403 | Lisp_Object handler; |
| 404 | directory = Fexpand_file_name (directory, Qnil); | ||
| 404 | 405 | ||
| 405 | /* If the directory name has special constructs in it, | 406 | /* If the directory name has special constructs in it, |
| 406 | call the corresponding file handler. */ | 407 | call the corresponding file handler. */ |
| @@ -424,6 +425,7 @@ These are all file names in directory DIRECTORY which begin with FILE. */) | |||
| 424 | (Lisp_Object file, Lisp_Object directory) | 425 | (Lisp_Object file, Lisp_Object directory) |
| 425 | { | 426 | { |
| 426 | Lisp_Object handler; | 427 | Lisp_Object handler; |
| 428 | directory = Fexpand_file_name (directory, Qnil); | ||
| 427 | 429 | ||
| 428 | /* If the directory name has special constructs in it, | 430 | /* If the directory name has special constructs in it, |
| 429 | call the corresponding file handler. */ | 431 | call the corresponding file handler. */ |
| @@ -474,7 +476,6 @@ file_name_completion (Lisp_Object file, Lisp_Object dirname, int all_flag, int v | |||
| 474 | bestmatch = Qnil; | 476 | bestmatch = Qnil; |
| 475 | encoded_file = encoded_dir = Qnil; | 477 | encoded_file = encoded_dir = Qnil; |
| 476 | GCPRO5 (file, dirname, bestmatch, encoded_file, encoded_dir); | 478 | GCPRO5 (file, dirname, bestmatch, encoded_file, encoded_dir); |
| 477 | dirname = Fexpand_file_name (dirname, Qnil); | ||
| 478 | specbind (Qdefault_directory, dirname); | 479 | specbind (Qdefault_directory, dirname); |
| 479 | 480 | ||
| 480 | /* Do completion on the encoded file name | 481 | /* Do completion on the encoded file name |
diff --git a/src/fileio.c b/src/fileio.c index e335dcf027f..44a85ab1977 100644 --- a/src/fileio.c +++ b/src/fileio.c | |||
| @@ -5344,7 +5344,7 @@ A non-nil CURRENT-ONLY argument means save only current buffer. */) | |||
| 5344 | EMACS_GET_TIME (before_time); | 5344 | EMACS_GET_TIME (before_time); |
| 5345 | 5345 | ||
| 5346 | /* If we had a failure, don't try again for 20 minutes. */ | 5346 | /* If we had a failure, don't try again for 20 minutes. */ |
| 5347 | if (b->auto_save_failure_time >= 0 | 5347 | if (b->auto_save_failure_time > 0 |
| 5348 | && EMACS_SECS (before_time) - b->auto_save_failure_time < 1200) | 5348 | && EMACS_SECS (before_time) - b->auto_save_failure_time < 1200) |
| 5349 | continue; | 5349 | continue; |
| 5350 | 5350 | ||
| @@ -5423,7 +5423,7 @@ No auto-save file will be written until the buffer changes again. */) | |||
| 5423 | they're not autosaved. */ | 5423 | they're not autosaved. */ |
| 5424 | BUF_AUTOSAVE_MODIFF (current_buffer) = MODIFF; | 5424 | BUF_AUTOSAVE_MODIFF (current_buffer) = MODIFF; |
| 5425 | XSETFASTINT (BVAR (current_buffer, save_length), Z - BEG); | 5425 | XSETFASTINT (BVAR (current_buffer, save_length), Z - BEG); |
| 5426 | current_buffer->auto_save_failure_time = -1; | 5426 | current_buffer->auto_save_failure_time = 0; |
| 5427 | return Qnil; | 5427 | return Qnil; |
| 5428 | } | 5428 | } |
| 5429 | 5429 | ||
| @@ -5432,7 +5432,7 @@ DEFUN ("clear-buffer-auto-save-failure", Fclear_buffer_auto_save_failure, | |||
| 5432 | doc: /* Clear any record of a recent auto-save failure in the current buffer. */) | 5432 | doc: /* Clear any record of a recent auto-save failure in the current buffer. */) |
| 5433 | (void) | 5433 | (void) |
| 5434 | { | 5434 | { |
| 5435 | current_buffer->auto_save_failure_time = -1; | 5435 | current_buffer->auto_save_failure_time = 0; |
| 5436 | return Qnil; | 5436 | return Qnil; |
| 5437 | } | 5437 | } |
| 5438 | 5438 | ||
diff --git a/src/keymap.c b/src/keymap.c index 4485080db21..739dfd8f2de 100644 --- a/src/keymap.c +++ b/src/keymap.c | |||
| @@ -2274,10 +2274,11 @@ around function keys and event symbols. */) | |||
| 2274 | 2274 | ||
| 2275 | if (INTEGERP (key)) /* Normal character */ | 2275 | if (INTEGERP (key)) /* Normal character */ |
| 2276 | { | 2276 | { |
| 2277 | char tem[KEY_DESCRIPTION_SIZE]; | 2277 | char tem[KEY_DESCRIPTION_SIZE], *p; |
| 2278 | 2278 | ||
| 2279 | *push_key_description (XINT (key), tem, 1) = 0; | 2279 | p = push_key_description (XINT (key), tem, 1); |
| 2280 | return build_string (tem); | 2280 | *p = 0; |
| 2281 | return make_specified_string (tem, -1, p - tem, 1); | ||
| 2281 | } | 2282 | } |
| 2282 | else if (SYMBOLP (key)) /* Function key or event-symbol */ | 2283 | else if (SYMBOLP (key)) /* Function key or event-symbol */ |
| 2283 | { | 2284 | { |
diff --git a/src/minibuf.c b/src/minibuf.c index 341d544ef51..f082cc01d97 100644 --- a/src/minibuf.c +++ b/src/minibuf.c | |||
| @@ -1859,8 +1859,8 @@ The arguments STRING and PREDICATE are as in `try-completion', | |||
| 1859 | /* First, look for a non-internal buffer in `res'. */ | 1859 | /* First, look for a non-internal buffer in `res'. */ |
| 1860 | while (CONSP (bufs) && SREF (XCAR (bufs), 0) == ' ') | 1860 | while (CONSP (bufs) && SREF (XCAR (bufs), 0) == ' ') |
| 1861 | bufs = XCDR (bufs); | 1861 | bufs = XCDR (bufs); |
| 1862 | if (NILP (bufs)) | 1862 | if (NILP (bufs) && EQ (Flength (res), Flength (Vbuffer_alist))) |
| 1863 | /* All bufs in `res' are internal, so don't trip them out. */ | 1863 | /* All bufs are internal, so don't trip them out. */ |
| 1864 | return res; | 1864 | return res; |
| 1865 | res = bufs; | 1865 | res = bufs; |
| 1866 | while (CONSP (XCDR (bufs))) | 1866 | while (CONSP (XCDR (bufs))) |
diff --git a/src/nsterm.m b/src/nsterm.m index 827404a2974..a2ae5e69512 100644 --- a/src/nsterm.m +++ b/src/nsterm.m | |||
| @@ -5357,7 +5357,23 @@ ns_term_shutdown (int sig) | |||
| 5357 | a "windowDidResize" which calls x_set_window_size). */ | 5357 | a "windowDidResize" which calls x_set_window_size). */ |
| 5358 | #ifndef NS_IMPL_GNUSTEP | 5358 | #ifndef NS_IMPL_GNUSTEP |
| 5359 | if (cols > 0 && rows > 0) | 5359 | if (cols > 0 && rows > 0) |
| 5360 | x_set_window_size (emacsframe, 0, cols, rows); | 5360 | { |
| 5361 | if (ns_in_resize) | ||
| 5362 | x_set_window_size (emacsframe, 0, cols, rows); | ||
| 5363 | else | ||
| 5364 | { | ||
| 5365 | NSWindow *window = [self window]; | ||
| 5366 | NSRect wr = [window frame]; | ||
| 5367 | FRAME_PIXEL_WIDTH (emacsframe) = (int)wr.size.width | ||
| 5368 | - emacsframe->border_width; | ||
| 5369 | FRAME_PIXEL_HEIGHT (emacsframe) = (int)wr.size.height | ||
| 5370 | - FRAME_NS_TITLEBAR_HEIGHT (emacsframe) | ||
| 5371 | - FRAME_TOOLBAR_HEIGHT (emacsframe); | ||
| 5372 | change_frame_size (emacsframe, rows, cols, 0, 0, 1); | ||
| 5373 | SET_FRAME_GARBAGED (emacsframe); | ||
| 5374 | cancel_mouse_face (emacsframe); | ||
| 5375 | } | ||
| 5376 | } | ||
| 5361 | #endif | 5377 | #endif |
| 5362 | 5378 | ||
| 5363 | ns_send_appdefined (-1); | 5379 | ns_send_appdefined (-1); |
diff --git a/src/sysdep.c b/src/sysdep.c index f97a8585253..b0d5a1abbe3 100644 --- a/src/sysdep.c +++ b/src/sysdep.c | |||
| @@ -1844,7 +1844,11 @@ snprintf (char *buf, size_t bufsize, char const *format, ...) | |||
| 1844 | 1844 | ||
| 1845 | if (INT_MAX < nbytes) | 1845 | if (INT_MAX < nbytes) |
| 1846 | { | 1846 | { |
| 1847 | #ifdef EOVERFLOW | ||
| 1847 | errno = EOVERFLOW; | 1848 | errno = EOVERFLOW; |
| 1849 | #else | ||
| 1850 | errno = EDOM; | ||
| 1851 | #endif | ||
| 1848 | return -1; | 1852 | return -1; |
| 1849 | } | 1853 | } |
| 1850 | return nbytes; | 1854 | return nbytes; |